diff --git a/src/Artemis.Core/Stores/Registrations/LayerBrushRegistration.cs b/src/Artemis.Core/Stores/Registrations/LayerBrushRegistration.cs
index 812a2e836..948a06e4c 100644
--- a/src/Artemis.Core/Stores/Registrations/LayerBrushRegistration.cs
+++ b/src/Artemis.Core/Stores/Registrations/LayerBrushRegistration.cs
@@ -1,10 +1,11 @@
using System;
using Artemis.Core.LayerBrushes;
+using Artemis.Core.Services;
namespace Artemis.Core
{
///
- /// Represents a layer brush registration
+ /// Represents a layer brush registration returned by calling
///
public class LayerBrushRegistration
{
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
index 97f5e5fa7..0bb4e1a46 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
@@ -116,6 +116,7 @@ namespace Artemis.UI.Shared
{
}
+ ///
public void AttachView(UIElement view)
{
if (View != null)
@@ -131,6 +132,7 @@ namespace Artemis.UI.Shared
});
}
+ ///
public UIElement View { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs
index 5ed47be76..310063ef0 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs
@@ -5,11 +5,16 @@ using Artemis.UI.Shared.Services;
namespace Artemis.UI.Shared
{
+ ///
+ /// Represents a layer brush registered through
+ /// or
+ ///
+ ///
public class DataModelVisualizationRegistration
{
private readonly IDataModelUIService _dataModelUIService;
- public DataModelVisualizationRegistration(IDataModelUIService dataModelUIService,
+ internal DataModelVisualizationRegistration(IDataModelUIService dataModelUIService,
RegistrationType registrationType,
Plugin plugin,
Type supportedType,
@@ -25,12 +30,30 @@ namespace Artemis.UI.Shared
Plugin.Disabled += InstanceOnDisabled;
}
+ ///
+ /// Gets the type of registration, either a display or an input
+ ///
public RegistrationType RegistrationType { get; }
+
+ ///
+ /// Gets the plugin that registered the visualization
+ ///
public Plugin Plugin { get; }
+
+ ///
+ /// Gets the type supported by the visualization
+ ///
public Type SupportedType { get; }
+
+ ///
+ /// Gets the view model type of the visualization
+ ///
public Type ViewModelType { get; }
- public IReadOnlyCollection CompatibleConversionTypes { get; internal set; }
+ ///
+ /// Gets a read only collection of types this visualization can convert to and from
+ ///
+ public IReadOnlyCollection? CompatibleConversionTypes { get; internal set; }
internal void Unsubscribe()
{
@@ -38,7 +61,7 @@ namespace Artemis.UI.Shared
Plugin.Disabled -= InstanceOnDisabled;
}
- private void InstanceOnDisabled(object sender, EventArgs e)
+ private void InstanceOnDisabled(object? sender, EventArgs e)
{
if (RegistrationType == RegistrationType.Input)
_dataModelUIService.RemoveDataModelInput(this);
@@ -47,9 +70,19 @@ namespace Artemis.UI.Shared
}
}
+ ///
+ /// Represents a type of data model visualization registration
+ ///
public enum RegistrationType
{
+ ///
+ /// A visualization used for displaying values
+ ///
Display,
+
+ ///
+ /// A visualization used for inputting values
+ ///
Input
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
index dd5091d0c..efe20a809 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
@@ -10,9 +10,6 @@ using Artemis.UI.Shared.Services;
using MaterialDesignColors.ColorManipulation;
using Stylet;
-// Remove, annoying while working on it
-#pragma warning disable 1591
-
namespace Artemis.UI.Shared.Input
{
public class DataModelDynamicViewModel : PropertyChangedBase, IDisposable
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticView.xaml.cs b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticView.xaml.cs
deleted file mode 100644
index 5aacbb841..000000000
--- a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticView.xaml.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Windows.Controls;
-
-namespace Artemis.UI.Shared.Input
-{
- ///
- /// Interaction logic for DataModelStaticView.xaml
- ///
- public partial class DataModelStaticView : UserControl
- {
- public DataModelStaticView()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs
index 2f3fc3ddf..1d3479a68 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs
@@ -4,54 +4,66 @@ using Artemis.UI.Shared.Services;
namespace Artemis.UI.Shared
{
+ ///
+ /// Represents a view model that visualizes a single data model property contained in a
+ ///
+ ///
public class DataModelListPropertyViewModel : DataModelPropertyViewModel
{
private int _index;
private Type _listType;
- public DataModelListPropertyViewModel(Type listType, DataModelDisplayViewModel displayViewModel) : base(null, null, null)
+ internal DataModelListPropertyViewModel(Type listType, DataModelDisplayViewModel displayViewModel) : base(null, null, null)
{
DataModel = ListPredicateWrapperDataModel.Create(listType);
ListType = listType;
DisplayViewModel = displayViewModel;
}
- public DataModelListPropertyViewModel(Type listType) : base(null, null, null)
+ internal DataModelListPropertyViewModel(Type listType) : base(null, null, null)
{
DataModel = ListPredicateWrapperDataModel.Create(listType);
ListType = listType;
}
+ ///
+ /// Gets the index of the element within the list
+ ///
public int Index
{
get => _index;
- set => SetAndNotify(ref _index, value);
+ internal set => SetAndNotify(ref _index, value);
}
+ ///
+ /// Gets the type of elements contained in the list
+ ///
public Type ListType
{
get => _listType;
- set => SetAndNotify(ref _listType, value);
+ private set => SetAndNotify(ref _listType, value);
}
+ ///
public override object GetCurrentValue()
{
return DisplayValue;
}
+ ///
public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
{
// Display value gets updated by parent, don't do anything if it is null
if (DisplayValue == null)
return;
- ((ListPredicateWrapperDataModel)DataModel).UntypedValue = DisplayValue;
+ ((ListPredicateWrapperDataModel) DataModel).UntypedValue = DisplayValue;
if (DisplayViewModel == null)
DisplayViewModel = dataModelUIService.GetDataModelDisplayViewModel(DisplayValue.GetType(), PropertyDescription, true);
ListType = DisplayValue.GetType();
- UpdateDisplayParameters();
+ DisplayViewModel?.UpdateValue(DisplayValue);
}
///
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs
index feac25943..cba6df286 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs
@@ -7,44 +7,69 @@ using Stylet;
namespace Artemis.UI.Shared
{
+ ///
+ /// Represents a view model that visualizes a list data model property
+ ///
public class DataModelListViewModel : DataModelVisualizationViewModel
{
private string _countDisplay;
- private IEnumerable _list;
- private int _listCount;
private Type _displayValueType;
+ private IEnumerable _list;
+ private BindableCollection _listChildren;
+ private int _listCount;
- internal DataModelListViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath) : base(dataModel, parent, dataModelPath)
+ internal DataModelListViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath)
+ : base(dataModel, parent, dataModelPath)
{
ListChildren = new BindableCollection();
}
+ ///
+ /// Gets the instance of the list that is being visualized
+ ///
public IEnumerable List
{
get => _list;
- set => SetAndNotify(ref _list, value);
+ private set => SetAndNotify(ref _list, value);
}
+ ///
+ /// Gets amount of elements in the list that is being visualized
+ ///
public int ListCount
{
get => _listCount;
- set => SetAndNotify(ref _listCount, value);
+ private set => SetAndNotify(ref _listCount, value);
}
+ ///
+ /// Gets the type of elements this list contains and that must be displayed as children
+ ///
public Type DisplayValueType
{
get => _displayValueType;
set => SetAndNotify(ref _displayValueType, value);
}
+ ///
+ /// Gets a human readable display count
+ ///
public string CountDisplay
{
get => _countDisplay;
set => SetAndNotify(ref _countDisplay, value);
}
- public BindableCollection ListChildren { get; set; }
-
+ ///
+ /// Gets a list of child view models that visualize the elements in the list
+ ///
+ public BindableCollection ListChildren
+ {
+ get => _listChildren;
+ private set => SetAndNotify(ref _listChildren, value);
+ }
+
+ ///
public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
{
if (Parent != null && !Parent.IsVisualizationExpanded)
@@ -101,7 +126,7 @@ namespace Artemis.UI.Shared
return $"[List] {DisplayPath ?? Path} - {ListCount} item(s)";
}
- protected DataModelVisualizationViewModel CreateListChild(IDataModelUIService dataModelUIService, Type listType)
+ private DataModelVisualizationViewModel CreateListChild(IDataModelUIService dataModelUIService, Type listType)
{
// If a display VM was found, prefer to use that in any case
DataModelDisplayViewModel typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(listType, PropertyDescription);
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs
index 4ac8c0bc7..5dc784157 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs
@@ -5,27 +5,38 @@ using Artemis.UI.Shared.Services;
namespace Artemis.UI.Shared
{
+ ///
+ /// Represents a view model that visualizes a class (POCO) data model property containing child properties
+ ///
public class DataModelPropertiesViewModel : DataModelVisualizationViewModel
{
private object _displayValue;
private Type _displayValueType;
- internal DataModelPropertiesViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath) : base(dataModel, parent, dataModelPath)
+ internal DataModelPropertiesViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath)
+ : base(dataModel, parent, dataModelPath)
{
}
+ ///
+ /// Gets the type of the property that is being visualized
+ ///
public Type DisplayValueType
{
get => _displayValueType;
- set => SetAndNotify(ref _displayValueType, value);
+ private set => SetAndNotify(ref _displayValueType, value);
}
+ ///
+ /// Gets the value of the property that is being visualized
+ ///
public object DisplayValue
{
get => _displayValue;
- set => SetAndNotify(ref _displayValue, value);
+ private set => SetAndNotify(ref _displayValue, value);
}
+ ///
public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
{
DisplayValueType = DataModelPath?.GetPropertyType();
@@ -48,6 +59,7 @@ namespace Artemis.UI.Shared
dataModelVisualizationViewModel.Update(dataModelUIService, configuration);
}
+ ///
public override object GetCurrentValue()
{
if (Parent == null || Parent.IsRootViewModel || IsRootViewModel)
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
index 4174176b8..3c12b6270 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
@@ -5,34 +5,49 @@ using Artemis.UI.Shared.Services;
namespace Artemis.UI.Shared
{
+ ///
+ /// Represents a view model that visualizes a single data model property contained in a
+ ///
+ ///
public class DataModelPropertyViewModel : DataModelVisualizationViewModel
{
private object _displayValue;
- private DataModelDisplayViewModel _displayViewModel;
private Type _displayValueType;
+ private DataModelDisplayViewModel _displayViewModel;
- internal DataModelPropertyViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath) : base(dataModel, parent, dataModelPath)
+ internal DataModelPropertyViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath)
+ : base(dataModel, parent, dataModelPath)
{
}
+ ///
+ /// Gets the value of the property that is being visualized
+ ///
public object DisplayValue
{
get => _displayValue;
- set => SetAndNotify(ref _displayValue, value);
+ internal set => SetAndNotify(ref _displayValue, value);
}
+ ///
+ /// Gets the type of the property that is being visualized
+ ///
public Type DisplayValueType
{
get => _displayValueType;
- set => SetAndNotify(ref _displayValueType, value);
+ protected set => SetAndNotify(ref _displayValueType, value);
}
+ ///
+ /// Gets the view model used to display the display value
+ ///
public DataModelDisplayViewModel DisplayViewModel
{
get => _displayViewModel;
- set => SetAndNotify(ref _displayViewModel, value);
+ internal set => SetAndNotify(ref _displayViewModel, value);
}
+ ///
public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
{
if (Parent != null && !Parent.IsVisualizationExpanded && !Parent.IsRootViewModel)
@@ -47,11 +62,6 @@ namespace Artemis.UI.Shared
DisplayValue = GetCurrentValue();
DisplayValueType = DisplayValue != null ? DisplayValue.GetType() : DataModelPath.GetPropertyType();
- UpdateDisplayParameters();
- }
-
- protected void UpdateDisplayParameters()
- {
DisplayViewModel?.UpdateValue(DisplayValue);
}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelUpdateConfiguration.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelUpdateConfiguration.cs
new file mode 100644
index 000000000..bd4747b1d
--- /dev/null
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelUpdateConfiguration.cs
@@ -0,0 +1,22 @@
+namespace Artemis.UI.Shared
+{
+ ///
+ /// Represents a configuration to use while updating a
+ ///
+ public class DataModelUpdateConfiguration
+ {
+ ///
+ /// Creates a new instance of the class
+ ///
+ /// A boolean indicating whether or not event children should be created
+ public DataModelUpdateConfiguration(bool createEventChildren)
+ {
+ CreateEventChildren = createEventChildren;
+ }
+
+ ///
+ /// Gets a boolean indicating whether or not event children should be created
+ ///
+ public bool CreateEventChildren { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
index 18e67c5e3..67e563bcf 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
@@ -10,6 +10,9 @@ using Stylet;
namespace Artemis.UI.Shared
{
+ ///
+ /// Represents a base class for a view model that visualizes a part of the data model
+ ///
public abstract class DataModelVisualizationViewModel : PropertyChangedBase
{
private const int MaxDepth = 4;
@@ -34,42 +37,75 @@ namespace Artemis.UI.Shared
PropertyDescription = DataModelPath?.GetPropertyDescription() ?? DataModel.DataModelDescription;
}
+ ///
+ /// Gets a boolean indicating whether this view model is at the root of the data model
+ ///
public bool IsRootViewModel { get; protected set; }
+
+ ///
+ /// Gets the data model path to the property this view model is visualizing
+ ///
public DataModelPath DataModelPath { get; }
+
+ ///
+ /// Gets a string representation of the path backing this model
+ ///
public string Path => DataModelPath?.Path;
+ ///
+ /// Gets the property depth of the view model
+ ///
public int Depth { get; private set; }
+ ///
+ /// Gets the data model backing this view model
+ ///
public DataModel DataModel
{
get => _dataModel;
protected set => SetAndNotify(ref _dataModel, value);
}
+ ///
+ /// Gets the property description of the property this view model is visualizing
+ ///
public DataModelPropertyAttribute PropertyDescription
{
get => _propertyDescription;
protected set => SetAndNotify(ref _propertyDescription, value);
}
+ ///
+ /// Gets the parent of this view model
+ ///
public DataModelVisualizationViewModel Parent
{
get => _parent;
protected set => SetAndNotify(ref _parent, value);
}
+ ///
+ /// Gets or sets a bindable collection containing the children of this view model
+ ///
public BindableCollection Children
{
get => _children;
set => SetAndNotify(ref _children, value);
}
+ ///
+ /// Gets a boolean indicating whether the property being visualized matches the types last provided to
+ ///
+ ///
public bool IsMatchingFilteredTypes
{
get => _isMatchingFilteredTypes;
- set => SetAndNotify(ref _isMatchingFilteredTypes, value);
+ private set => SetAndNotify(ref _isMatchingFilteredTypes, value);
}
+ ///
+ /// Gets or sets a boolean indicating whether the visualization is expanded, exposing the
+ ///
public bool IsVisualizationExpanded
{
get => _isVisualizationExpanded;
@@ -80,6 +116,9 @@ namespace Artemis.UI.Shared
}
}
+ ///
+ /// Gets a user-friendly representation of the
+ ///
public virtual string DisplayPath => DataModelPath != null
? string.Join(" › ", DataModelPath.Segments.Select(s => s.GetPropertyDescription()?.Name ?? s.Identifier))
: null;
@@ -91,6 +130,10 @@ namespace Artemis.UI.Shared
/// The configuration to apply while updating
public abstract void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration);
+ ///
+ /// Gets the current value of the property being visualized
+ ///
+ /// The current value of the property being visualized
public virtual object GetCurrentValue()
{
if (IsRootViewModel)
@@ -99,6 +142,12 @@ namespace Artemis.UI.Shared
return DataModelPath.GetValue();
}
+ ///
+ /// Determines whether the provided types match the type of the property being visualized and sets the result in
+ ///
+ ///
+ /// Whether the type may be a loose match, meaning it can be cast or converted
+ /// The types to filter
public void ApplyTypeFilter(bool looseMatch, params Type[] filteredTypes)
{
if (filteredTypes != null)
@@ -154,7 +203,7 @@ namespace Artemis.UI.Shared
return;
Type modelType = IsRootViewModel ? DataModel.GetType() : DataModelPath.GetPropertyType();
-
+
// Add missing static children
foreach (PropertyInfo propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(t => t.MetadataToken))
{
@@ -252,8 +301,14 @@ namespace Artemis.UI.Shared
#region Events
- public event EventHandler UpdateRequested;
+ ///
+ /// Occurs when an update to the property this view model visualizes is requested
+ ///
+ public event EventHandler? UpdateRequested;
+ ///
+ /// Invokes the event
+ ///
protected virtual void OnUpdateRequested()
{
UpdateRequested?.Invoke(this, EventArgs.Empty);
@@ -261,14 +316,4 @@ namespace Artemis.UI.Shared
#endregion
}
-
- public class DataModelUpdateConfiguration
- {
- public bool CreateEventChildren { get; }
-
- public DataModelUpdateConfiguration(bool createEventChildren)
- {
- CreateEventChildren = createEventChildren;
- }
- }
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayViewModel.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayViewModel.cs
index 15df20112..cced51797 100644
--- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayViewModel.cs
+++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayViewModel.cs
@@ -2,12 +2,16 @@
namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display
{
- public class DefaultDataModelDisplayViewModel : DataModelDisplayViewModel