Class DataModelVisualizationViewModel
- Namespace
- Artemis.UI.Shared.DataModelVisualization.Shared
- Assembly
- Artemis.UI.Shared.dll
Represents a base class for a view model that visualizes a part of the data model
public abstract class DataModelVisualizationViewModel : ReactiveObject, IReactiveNotifyPropertyChanged<IReactiveObject>, IHandleObservableErrors, IReactiveObject, IEnableLogger, IDisposable
- Inheritance
-
objectReactiveObjectDataModelVisualizationViewModel
- Implements
-
IReactiveNotifyPropertyChanged<IReactiveObject>IHandleObservableErrorsIReactiveObjectIEnableLogger
- Derived
- Inherited Members
-
ReactiveObject.SuppressChangeNotifications()ReactiveObject.AreChangeNotificationsEnabled()ReactiveObject.DelayChangeNotifications()ReactiveObject.ChangingReactiveObject.ChangedReactiveObject.ThrownExceptionsReactiveObject.PropertyChangingReactiveObject.PropertyChanged
Properties
Children
Gets or sets an observable collection containing the children of this view model
public ObservableCollection<DataModelVisualizationViewModel> Children { get; set; }
Property Value
CopyPath
Copies the path of the data model to the clipboard.
public ReactiveCommand<Unit, Unit> CopyPath { get; }
Property Value
- ReactiveCommand<Unit, Unit>
DataModel
Gets the data model backing this view model
public DataModel? DataModel { get; protected set; }
Property Value
DataModelPath
Gets the data model path to the property this view model is visualizing
public DataModelPath? DataModelPath { get; }
Property Value
Depth
Gets the property depth of the view model
public int Depth { get; }
Property Value
DisplayPath
Gets a user-friendly representation of the DataModelPath
public virtual string? DisplayPath { get; }
Property Value
IsMatchingFilteredTypes
Gets a boolean indicating whether the property being visualized matches the types last provided to ApplyTypeFilter(bool, params Type?[]?)
public bool IsMatchingFilteredTypes { get; }
Property Value
IsRootViewModel
Gets a boolean indicating whether this view model is at the root of the data model
public bool IsRootViewModel { get; protected set; }
Property Value
IsVisualizationExpanded
Gets or sets a boolean indicating whether the visualization is expanded, exposing the Children
public bool IsVisualizationExpanded { get; set; }
Property Value
Parent
Gets the parent of this view model
public DataModelVisualizationViewModel? Parent { get; protected set; }
Property Value
Path
Gets a string representation of the path backing this model
public string? Path { get; }
Property Value
PropertyDescription
Gets the property description of the property this view model is visualizing
public DataModelPropertyAttribute? PropertyDescription { get; protected set; }
Property Value
Methods
ApplyTypeFilter(bool, params Type?[]?)
Determines whether the provided types match the type of the property being visualized and sets the result in IsMatchingFilteredTypes
public void ApplyTypeFilter(bool looseMatch, params Type?[]? filteredTypes)
Parameters
looseMatchboolWhether the type may be a loose match, meaning it can be cast or converted
filteredTypesType[]The types to filter
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
ExpandToPath(DataModelPath)
Expands this view model and any children to expose the provided dataModelPath.
public void ExpandToPath(DataModelPath dataModelPath)
Parameters
dataModelPathDataModelPathThe data model path to expose.
GetCurrentValue()
Gets the current value of the property being visualized
public virtual object? GetCurrentValue()
Returns
- object
The current value of the property being visualized
GetSearchResults(string)
Gets the search results for the provided search string
public abstract IEnumerable<DataModelVisualizationViewModel> GetSearchResults(string search)
Parameters
searchstringThe search string
Returns
- IEnumerable<DataModelVisualizationViewModel>
The search results
GetViewModelForPath(DataModelPath)
Finds the view model that hosts the given path.
public DataModelVisualizationViewModel? GetViewModelForPath(DataModelPath dataModelPath)
Parameters
dataModelPathDataModelPathThe path to find
Returns
- DataModelVisualizationViewModel
The matching view model, may be null if the path doesn't exist or isn't expanded
OnUpdateRequested()
Invokes the UpdateRequested event
protected virtual void OnUpdateRequested()
Update(IDataModelUIService, DataModelUpdateConfiguration?)
Updates the datamodel and if in an parent, any children
public abstract void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration? configuration)
Parameters
dataModelUIServiceIDataModelUIServiceThe data model UI service used during update
configurationDataModelUpdateConfigurationThe configuration to apply while updating
Events
UpdateRequested
Occurs when an update to the property this view model visualizes is requested
public event EventHandler? UpdateRequested