diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
index 67d653575..fd9cab497 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
@@ -491,6 +491,9 @@ namespace Artemis.Core
Entity = entity ?? throw new ArgumentNullException(nameof(entity));
PropertyDescription = description ?? throw new ArgumentNullException(nameof(description));
IsLoadedFromStorage = fromStorage;
+
+ if (PropertyDescription.DisableKeyframes)
+ KeyframesSupported = false;
}
///
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
index cf8a17afe..1a60ac398 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
@@ -184,7 +184,7 @@ namespace Artemis.UI.Shared
return rotationRect.Size;
}
- private void OnUnloaded(object sender, RoutedEventArgs e)
+ private void OnUnloaded(object? sender, RoutedEventArgs e)
{
_timer.Stop();
@@ -196,12 +196,12 @@ namespace Artemis.UI.Shared
}
}
- private void OnLoaded(object sender, RoutedEventArgs e)
+ private void OnLoaded(object? sender, RoutedEventArgs e)
{
_timer.Start();
}
- private void TimerOnTick(object sender, EventArgs e)
+ private void TimerOnTick(object? sender, EventArgs e)
{
if (ShowColors && Visibility == Visibility.Visible)
Render();
diff --git a/src/Artemis.UI.Shared/Converters/ColorToStringConverter.cs b/src/Artemis.UI.Shared/Converters/ColorToStringConverter.cs
index 6b008793a..4519d8b83 100644
--- a/src/Artemis.UI.Shared/Converters/ColorToStringConverter.cs
+++ b/src/Artemis.UI.Shared/Converters/ColorToStringConverter.cs
@@ -13,20 +13,20 @@ namespace Artemis.UI.Shared
public class ColorToStringConverter : IValueConverter
{
///
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ public object? Convert(object? value, Type targetType, object parameter, CultureInfo culture)
{
return value?.ToString()?.ToUpper();
}
///
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ public object? ConvertBack(object? value, Type targetType, object parameter, CultureInfo culture)
{
try
{
- if (string.IsNullOrWhiteSpace((string) value))
+ if (string.IsNullOrWhiteSpace(value as string))
return default(Color);
- object color = ColorConverter.ConvertFromString((string) value);
+ object? color = ColorConverter.ConvertFromString((string) value!);
if (color is Color c)
return c;
diff --git a/src/Artemis.UI.Shared/Converters/SKColorToStringConverter.cs b/src/Artemis.UI.Shared/Converters/SKColorToStringConverter.cs
index ca3e04dca..d1dbfcde8 100644
--- a/src/Artemis.UI.Shared/Converters/SKColorToStringConverter.cs
+++ b/src/Artemis.UI.Shared/Converters/SKColorToStringConverter.cs
@@ -14,18 +14,18 @@ namespace Artemis.UI.Shared
public class SKColorToStringConverter : IValueConverter
{
///
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ public object? Convert(object? value, Type targetType, object parameter, CultureInfo culture)
{
return value?.ToString();
}
///
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ public object ConvertBack(object? value, Type targetType, object parameter, CultureInfo culture)
{
- if (string.IsNullOrWhiteSpace((string) value))
+ if (string.IsNullOrWhiteSpace(value as string))
return SKColor.Empty;
- return SKColor.TryParse((string) value, out SKColor color) ? color : SKColor.Empty;
+ return SKColor.TryParse((string) value!, out SKColor color) ? color : SKColor.Empty;
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Converters/TypeToStringConverter.cs b/src/Artemis.UI.Shared/Converters/TypeToStringConverter.cs
index 3afd7cc80..10570fa8a 100644
--- a/src/Artemis.UI.Shared/Converters/TypeToStringConverter.cs
+++ b/src/Artemis.UI.Shared/Converters/TypeToStringConverter.cs
@@ -11,7 +11,7 @@ namespace Artemis.UI.Shared
public class TypeToStringConverter : IValueConverter
{
///
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ public object? Convert(object value, Type targetType, object? parameter, CultureInfo culture)
{
bool humanizeProvided = bool.TryParse(parameter?.ToString(), out bool humanize);
if (value is Type type)
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs
index 623ed8a17..c9f198ebe 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs
@@ -1,4 +1,5 @@
-using Artemis.Core.DataModelExpansions;
+using System.Diagnostics.CodeAnalysis;
+using Artemis.Core.DataModelExpansions;
using Stylet;
namespace Artemis.UI.Shared
@@ -9,11 +10,13 @@ namespace Artemis.UI.Shared
/// The type of the data model
public abstract class DataModelDisplayViewModel : DataModelDisplayViewModel
{
- private T _displayValue;
+ [AllowNull]
+ private T _displayValue = default!;
///
/// Gets or sets value that the view model must display
///
+ [AllowNull]
public T DisplayValue
{
get => _displayValue;
@@ -24,10 +27,10 @@ namespace Artemis.UI.Shared
}
}
- internal override object InternalGuard => null;
+ internal override object InternalGuard => new object();
///
- public override void UpdateValue(object model)
+ public override void UpdateValue(object? model)
{
DisplayValue = model is T value ? value : default;
}
@@ -45,12 +48,12 @@ namespace Artemis.UI.Shared
///
public abstract class DataModelDisplayViewModel : PropertyChangedBase
{
- private DataModelPropertyAttribute _propertyDescription;
+ private DataModelPropertyAttribute? _propertyDescription;
///
/// Gets the property description of this value
///
- public DataModelPropertyAttribute PropertyDescription
+ public DataModelPropertyAttribute? PropertyDescription
{
get => _propertyDescription;
internal set => SetAndNotify(ref _propertyDescription, value);
@@ -65,6 +68,6 @@ namespace Artemis.UI.Shared
/// Updates the display value
///
/// The value to set
- public abstract void UpdateValue(object model);
+ public abstract void UpdateValue(object? model);
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
index 0bb4e1a46..171e2a4c6 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
@@ -16,7 +17,7 @@ namespace Artemis.UI.Shared
public abstract class DataModelInputViewModel : DataModelInputViewModel
{
private bool _closed;
- private T _inputValue;
+ [AllowNull] private T _inputValue = default!;
///
/// Creates a new instance of the class
@@ -32,6 +33,7 @@ namespace Artemis.UI.Shared
///
/// Gets or sets the value shown in the input
///
+ [AllowNull]
public T InputValue
{
get => _inputValue;
@@ -82,13 +84,13 @@ namespace Artemis.UI.Shared
// ReSharper disable once UnusedMember.Global
internal abstract object InternalGuard { get; }
- internal Action
public class DataModelPropertiesViewModel : DataModelVisualizationViewModel
{
- private object _displayValue;
- private Type _displayValueType;
+ private object? _displayValue;
+ private Type? _displayValueType;
- internal DataModelPropertiesViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath)
+ internal DataModelPropertiesViewModel(DataModel? dataModel, DataModelVisualizationViewModel? parent, DataModelPath? dataModelPath)
: base(dataModel, parent, dataModelPath)
{
}
@@ -21,7 +21,7 @@ namespace Artemis.UI.Shared
///
/// Gets the type of the property that is being visualized
///
- public Type DisplayValueType
+ public Type? DisplayValueType
{
get => _displayValueType;
private set => SetAndNotify(ref _displayValueType, value);
@@ -30,19 +30,19 @@ namespace Artemis.UI.Shared
///
/// Gets the value of the property that is being visualized
///
- public object DisplayValue
+ public object? DisplayValue
{
get => _displayValue;
private set => SetAndNotify(ref _displayValue, value);
}
///
- public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
+ public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration? configuration)
{
DisplayValueType = DataModelPath?.GetPropertyType();
// Only set a display value if ToString returns useful information and not just the type name
- object currentValue = GetCurrentValue();
+ object? currentValue = GetCurrentValue();
if (currentValue != null && currentValue.ToString() != currentValue.GetType().ToString())
DisplayValue = currentValue.ToString();
else
@@ -60,7 +60,7 @@ namespace Artemis.UI.Shared
}
///
- public override object GetCurrentValue()
+ public override object? GetCurrentValue()
{
if (Parent == null || Parent.IsRootViewModel || IsRootViewModel)
return DataModel;
@@ -68,7 +68,7 @@ namespace Artemis.UI.Shared
}
///
- public override string ToString()
+ public override string? ToString()
{
return DisplayPath ?? Path;
}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
index 3c12b6270..3d3b20102 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
@@ -11,11 +11,11 @@ namespace Artemis.UI.Shared
///
public class DataModelPropertyViewModel : DataModelVisualizationViewModel
{
- private object _displayValue;
- private Type _displayValueType;
- private DataModelDisplayViewModel _displayViewModel;
+ private object? _displayValue;
+ private Type? _displayValueType;
+ private DataModelDisplayViewModel? _displayViewModel;
- internal DataModelPropertyViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath)
+ internal DataModelPropertyViewModel(DataModel? dataModel, DataModelVisualizationViewModel? parent, DataModelPath? dataModelPath)
: base(dataModel, parent, dataModelPath)
{
}
@@ -23,7 +23,7 @@ namespace Artemis.UI.Shared
///
/// Gets the value of the property that is being visualized
///
- public object DisplayValue
+ public object? DisplayValue
{
get => _displayValue;
internal set => SetAndNotify(ref _displayValue, value);
@@ -32,7 +32,7 @@ namespace Artemis.UI.Shared
///
/// Gets the type of the property that is being visualized
///
- public Type DisplayValueType
+ public Type? DisplayValueType
{
get => _displayValueType;
protected set => SetAndNotify(ref _displayValueType, value);
@@ -41,26 +41,31 @@ namespace Artemis.UI.Shared
///
/// Gets the view model used to display the display value
///
- public DataModelDisplayViewModel DisplayViewModel
+ public DataModelDisplayViewModel? DisplayViewModel
{
get => _displayViewModel;
internal set => SetAndNotify(ref _displayViewModel, value);
}
///
- public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
+ public override void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration? configuration)
{
if (Parent != null && !Parent.IsVisualizationExpanded && !Parent.IsRootViewModel)
return;
if (DisplayViewModel == null)
{
- DisplayViewModel = dataModelUIService.GetDataModelDisplayViewModel(DataModelPath.GetPropertyType(), PropertyDescription, true);
- DisplayViewModel.PropertyDescription = DataModelPath.GetPropertyDescription();
+ Type? propertyType = DataModelPath?.GetPropertyType();
+ if (propertyType != null)
+ {
+ DisplayViewModel = dataModelUIService.GetDataModelDisplayViewModel(propertyType, PropertyDescription, true);
+ if (DisplayViewModel != null)
+ DisplayViewModel.PropertyDescription = DataModelPath?.GetPropertyDescription();
+ }
}
DisplayValue = GetCurrentValue();
- DisplayValueType = DisplayValue != null ? DisplayValue.GetType() : DataModelPath.GetPropertyType();
+ DisplayValueType = DisplayValue != null ? DisplayValue.GetType() : DataModelPath?.GetPropertyType();
DisplayViewModel?.UpdateValue(DisplayValue);
}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
index 67e563bcf..55fa3d730 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
@@ -17,24 +17,24 @@ namespace Artemis.UI.Shared
{
private const int MaxDepth = 4;
private BindableCollection _children;
- private DataModel _dataModel;
+ private DataModel? _dataModel;
private bool _isMatchingFilteredTypes;
private bool _isVisualizationExpanded;
- private DataModelVisualizationViewModel _parent;
- private DataModelPropertyAttribute _propertyDescription;
+ private DataModelVisualizationViewModel? _parent;
+ private DataModelPropertyAttribute? _propertyDescription;
- internal DataModelVisualizationViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath)
+ internal DataModelVisualizationViewModel(DataModel? dataModel, DataModelVisualizationViewModel? parent, DataModelPath? dataModelPath)
{
- DataModel = dataModel;
- Parent = parent;
+ _dataModel = dataModel;
+ _children = new BindableCollection();
+ _parent = parent;
DataModelPath = dataModelPath;
- Children = new BindableCollection();
IsMatchingFilteredTypes = true;
if (parent == null)
IsRootViewModel = true;
else
- PropertyDescription = DataModelPath?.GetPropertyDescription() ?? DataModel.DataModelDescription;
+ PropertyDescription = DataModelPath?.GetPropertyDescription() ?? DataModel?.DataModelDescription;
}
///
@@ -45,12 +45,12 @@ namespace Artemis.UI.Shared
///
/// Gets the data model path to the property this view model is visualizing
///
- public DataModelPath DataModelPath { get; }
+ public DataModelPath? DataModelPath { get; }
///
/// Gets a string representation of the path backing this model
///
- public string Path => DataModelPath?.Path;
+ public string? Path => DataModelPath?.Path;
///
/// Gets the property depth of the view model
@@ -60,7 +60,7 @@ namespace Artemis.UI.Shared
///
/// Gets the data model backing this view model
///
- public DataModel DataModel
+ public DataModel? DataModel
{
get => _dataModel;
protected set => SetAndNotify(ref _dataModel, value);
@@ -69,7 +69,7 @@ namespace Artemis.UI.Shared
///
/// Gets the property description of the property this view model is visualizing
///
- public DataModelPropertyAttribute PropertyDescription
+ public DataModelPropertyAttribute? PropertyDescription
{
get => _propertyDescription;
protected set => SetAndNotify(ref _propertyDescription, value);
@@ -78,7 +78,7 @@ namespace Artemis.UI.Shared
///
/// Gets the parent of this view model
///
- public DataModelVisualizationViewModel Parent
+ public DataModelVisualizationViewModel? Parent
{
get => _parent;
protected set => SetAndNotify(ref _parent, value);
@@ -119,7 +119,7 @@ namespace Artemis.UI.Shared
///
/// Gets a user-friendly representation of the
///
- public virtual string DisplayPath => DataModelPath != null
+ public virtual string? DisplayPath => DataModelPath != null
? string.Join(" › ", DataModelPath.Segments.Select(s => s.GetPropertyDescription()?.Name ?? s.Identifier))
: null;
@@ -128,18 +128,18 @@ namespace Artemis.UI.Shared
///
/// The data model UI service used during update
/// The configuration to apply while updating
- public abstract void Update(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration);
+ 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()
+ public virtual object? GetCurrentValue()
{
if (IsRootViewModel)
return null;
- return DataModelPath.GetValue();
+ return DataModelPath?.GetValue();
}
///
@@ -148,7 +148,7 @@ namespace Artemis.UI.Shared
///
/// 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)
+ public void ApplyTypeFilter(bool looseMatch, params Type[]? filteredTypes)
{
if (filteredTypes != null)
{
@@ -176,7 +176,7 @@ namespace Artemis.UI.Shared
}
// If the type couldn't be retrieved either way, assume false
- Type type = DataModelPath?.GetPropertyType();
+ Type? type = DataModelPath?.GetPropertyType();
if (type == null)
{
IsMatchingFilteredTypes = false;
@@ -197,12 +197,14 @@ namespace Artemis.UI.Shared
return 0;
}
- internal void PopulateProperties(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration dataModelUpdateConfiguration)
+ internal void PopulateProperties(IDataModelUIService dataModelUIService, DataModelUpdateConfiguration? dataModelUpdateConfiguration)
{
if (IsRootViewModel && DataModel == null)
return;
- Type modelType = IsRootViewModel ? DataModel.GetType() : DataModelPath.GetPropertyType();
+ Type? modelType = IsRootViewModel ? DataModel?.GetType() : DataModelPath?.GetPropertyType();
+ if (modelType == null)
+ throw new ArtemisSharedUIException("Failed to populate data model visualization properties, couldn't get a property type");
// Add missing static children
foreach (PropertyInfo propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(t => t.MetadataToken))
@@ -212,27 +214,30 @@ namespace Artemis.UI.Shared
continue;
if (propertyInfo.GetCustomAttribute() != null)
continue;
- MethodInfo getMethod = propertyInfo.GetGetMethod();
+ MethodInfo? getMethod = propertyInfo.GetGetMethod();
if (getMethod == null || getMethod.GetParameters().Any())
continue;
- DataModelVisualizationViewModel child = CreateChild(dataModelUIService, childPath, GetChildDepth());
+ DataModelVisualizationViewModel? child = CreateChild(dataModelUIService, childPath, GetChildDepth());
if (child != null)
Children.Add(child);
}
// Remove static children that should be hidden
- ReadOnlyCollection hiddenProperties = DataModel.GetHiddenProperties();
- foreach (PropertyInfo hiddenProperty in hiddenProperties)
+ if (DataModel != null)
{
- string childPath = AppendToPath(hiddenProperty.Name);
- DataModelVisualizationViewModel toRemove = Children.FirstOrDefault(c => c.Path != null && c.Path == childPath);
- if (toRemove != null)
- Children.Remove(toRemove);
+ ReadOnlyCollection hiddenProperties = DataModel.GetHiddenProperties();
+ foreach (PropertyInfo hiddenProperty in hiddenProperties)
+ {
+ string childPath = AppendToPath(hiddenProperty.Name);
+ DataModelVisualizationViewModel? toRemove = Children.FirstOrDefault(c => c.Path != null && c.Path == childPath);
+ if (toRemove != null)
+ Children.Remove(toRemove);
+ }
}
// Add missing dynamic children
- object value = Parent == null || Parent.IsRootViewModel ? DataModel : DataModelPath.GetValue();
+ object? value = Parent == null || Parent.IsRootViewModel ? DataModel : DataModelPath?.GetValue();
if (value is DataModel dataModel)
foreach (KeyValuePair kvp in dataModel.DynamicDataModels)
{
@@ -240,19 +245,21 @@ namespace Artemis.UI.Shared
if (Children.Any(c => c.Path != null && c.Path.Equals(childPath)))
continue;
- DataModelVisualizationViewModel child = CreateChild(dataModelUIService, childPath, GetChildDepth());
+ DataModelVisualizationViewModel? child = CreateChild(dataModelUIService, childPath, GetChildDepth());
if (child != null)
Children.Add(child);
}
// Remove dynamic children that have been removed from the data model
- List toRemoveDynamic = Children.Where(c => !c.DataModelPath.IsValid).ToList();
+ List toRemoveDynamic = Children.Where(c => c.DataModelPath != null && !c.DataModelPath.IsValid).ToList();
if (toRemoveDynamic.Any())
Children.RemoveRange(toRemoveDynamic);
}
- private DataModelVisualizationViewModel CreateChild(IDataModelUIService dataModelUIService, string path, int depth)
+ private DataModelVisualizationViewModel? CreateChild(IDataModelUIService dataModelUIService, string path, int depth)
{
+ if (DataModel == null)
+ throw new ArtemisSharedUIException("Cannot create a data model visualization child VM for a parent without a data model");
if (depth > MaxDepth)
return null;
@@ -260,8 +267,8 @@ namespace Artemis.UI.Shared
if (!dataModelPath.IsValid)
return null;
- PropertyInfo propertyInfo = dataModelPath.GetPropertyInfo();
- Type propertyType = dataModelPath.GetPropertyType();
+ PropertyInfo? propertyInfo = dataModelPath.GetPropertyInfo();
+ Type? propertyType = dataModelPath.GetPropertyType();
// Skip properties decorated with DataModelIgnore
if (propertyInfo != null && Attribute.IsDefined(propertyInfo, typeof(DataModelIgnoreAttribute)))
@@ -270,8 +277,11 @@ namespace Artemis.UI.Shared
if (DataModel.GetHiddenProperties().Any(p => p.Equals(propertyInfo)))
return null;
+ if (propertyType == null)
+ return null;
+
// If a display VM was found, prefer to use that in any case
- DataModelDisplayViewModel typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(propertyType, PropertyDescription);
+ DataModelDisplayViewModel? typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(propertyType, PropertyDescription);
if (typeViewModel != null)
return new DataModelPropertyViewModel(DataModel, this, dataModelPath) {DisplayViewModel = typeViewModel, Depth = depth};
// For primitives, create a property view model, it may be null that is fine
diff --git a/src/Artemis.UI.Shared/Events/DataModelInputDynamicEventArgs.cs b/src/Artemis.UI.Shared/Events/DataModelInputDynamicEventArgs.cs
index dc19cf765..e5a9806de 100644
--- a/src/Artemis.UI.Shared/Events/DataModelInputDynamicEventArgs.cs
+++ b/src/Artemis.UI.Shared/Events/DataModelInputDynamicEventArgs.cs
@@ -9,7 +9,7 @@ namespace Artemis.UI.Shared
///
public class DataModelInputDynamicEventArgs : EventArgs
{
- internal DataModelInputDynamicEventArgs(DataModelPath dataModelPath)
+ internal DataModelInputDynamicEventArgs(DataModelPath? dataModelPath)
{
DataModelPath = dataModelPath;
}
@@ -17,6 +17,6 @@ namespace Artemis.UI.Shared
///
/// Gets the data model path that was selected
///
- public DataModelPath DataModelPath { get; }
+ public DataModelPath? DataModelPath { get; }
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Events/DataModelInputStaticEventArgs.cs b/src/Artemis.UI.Shared/Events/DataModelInputStaticEventArgs.cs
index 7c5f8f4ef..650b558b8 100644
--- a/src/Artemis.UI.Shared/Events/DataModelInputStaticEventArgs.cs
+++ b/src/Artemis.UI.Shared/Events/DataModelInputStaticEventArgs.cs
@@ -8,7 +8,7 @@ namespace Artemis.UI.Shared
///
public class DataModelInputStaticEventArgs : EventArgs
{
- internal DataModelInputStaticEventArgs(object value)
+ internal DataModelInputStaticEventArgs(object? value)
{
Value = value;
}
@@ -16,6 +16,6 @@ namespace Artemis.UI.Shared
///
/// The value that was submitted
///
- public object Value { get; }
+ public object? Value { get; }
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Events/ProfileEventArgs.cs b/src/Artemis.UI.Shared/Events/ProfileEventArgs.cs
index 1f3212d02..95fe4aba3 100644
--- a/src/Artemis.UI.Shared/Events/ProfileEventArgs.cs
+++ b/src/Artemis.UI.Shared/Events/ProfileEventArgs.cs
@@ -8,12 +8,12 @@ namespace Artemis.UI.Shared
///
public class ProfileEventArgs : EventArgs
{
- internal ProfileEventArgs(Profile profile)
+ internal ProfileEventArgs(Profile? profile)
{
Profile = profile;
}
- internal ProfileEventArgs(Profile profile, Profile previousProfile)
+ internal ProfileEventArgs(Profile? profile, Profile? previousProfile)
{
Profile = profile;
PreviousProfile = previousProfile;
@@ -22,7 +22,7 @@ namespace Artemis.UI.Shared
///
/// Gets the profile the event was raised for
///
- public Profile Profile { get; }
+ public Profile? Profile { get; }
///
/// If applicable, the previous active profile before the event was raised
diff --git a/src/Artemis.UI.Shared/Events/RenderProfileElementEventArgs.cs b/src/Artemis.UI.Shared/Events/RenderProfileElementEventArgs.cs
index 0e70b7be9..e2555f3ab 100644
--- a/src/Artemis.UI.Shared/Events/RenderProfileElementEventArgs.cs
+++ b/src/Artemis.UI.Shared/Events/RenderProfileElementEventArgs.cs
@@ -8,12 +8,12 @@ namespace Artemis.UI.Shared
///
public class RenderProfileElementEventArgs : EventArgs
{
- internal RenderProfileElementEventArgs(RenderProfileElement renderProfileElement)
+ internal RenderProfileElementEventArgs(RenderProfileElement? renderProfileElement)
{
RenderProfileElement = renderProfileElement;
}
- internal RenderProfileElementEventArgs(RenderProfileElement renderProfileElement, RenderProfileElement previousRenderProfileElement)
+ internal RenderProfileElementEventArgs(RenderProfileElement? renderProfileElement, RenderProfileElement? previousRenderProfileElement)
{
RenderProfileElement = renderProfileElement;
PreviousRenderProfileElement = previousRenderProfileElement;
@@ -22,7 +22,7 @@ namespace Artemis.UI.Shared
///
/// Gets the profile element the event was raised for
///
- public RenderProfileElement RenderProfileElement { get; }
+ public RenderProfileElement? RenderProfileElement { get; }
///
/// If applicable, the previous active profile element before the event was raised
diff --git a/src/Artemis.UI.Shared/Plugins/LayerBrushes/LayerBrushConfigurationDialog.cs b/src/Artemis.UI.Shared/Plugins/LayerBrushes/LayerBrushConfigurationDialog.cs
index ed20b670b..e792dbe75 100644
--- a/src/Artemis.UI.Shared/Plugins/LayerBrushes/LayerBrushConfigurationDialog.cs
+++ b/src/Artemis.UI.Shared/Plugins/LayerBrushes/LayerBrushConfigurationDialog.cs
@@ -15,11 +15,6 @@ namespace Artemis.UI.Shared.LayerBrushes
///
public abstract class LayerBrushConfigurationDialog : ILayerBrushConfigurationDialog
{
- ///
- /// The layer brush this dialog belongs to
- ///
- internal BaseLayerBrush LayerBrush { get; set; }
-
///
/// The type of view model the tab contains
///
diff --git a/src/Artemis.UI.Shared/Plugins/LayerEffects/LayerEffectConfigurationDialog.cs b/src/Artemis.UI.Shared/Plugins/LayerEffects/LayerEffectConfigurationDialog.cs
index 604214b8c..81bcdb2af 100644
--- a/src/Artemis.UI.Shared/Plugins/LayerEffects/LayerEffectConfigurationDialog.cs
+++ b/src/Artemis.UI.Shared/Plugins/LayerEffects/LayerEffectConfigurationDialog.cs
@@ -15,10 +15,11 @@ namespace Artemis.UI.Shared.LayerEffects
///
public abstract class LayerEffectConfigurationDialog : ILayerEffectConfigurationDialog
{
+ // TODO: See if this is still in use
///
/// The layer effect this dialog belongs to
///
- internal BaseLayerEffect LayerEffect { get; set; }
+ public BaseLayerEffect? LayerEffect { get; set; }
///
/// The type of view model the tab contains
diff --git a/src/Artemis.UI.Shared/Plugins/PluginConfigurationDialog.cs b/src/Artemis.UI.Shared/Plugins/PluginConfigurationDialog.cs
index 7c7e62886..23f1fd0ed 100644
--- a/src/Artemis.UI.Shared/Plugins/PluginConfigurationDialog.cs
+++ b/src/Artemis.UI.Shared/Plugins/PluginConfigurationDialog.cs
@@ -15,11 +15,6 @@ namespace Artemis.UI.Shared
///
public abstract class PluginConfigurationDialog : IPluginConfigurationDialog
{
- ///
- /// The layer brush this dialog belongs to
- ///
- internal PluginFeature PluginFeature { get; set; }
-
///
/// The type of view model the tab contains
///
diff --git a/src/Artemis.UI.Shared/Properties/Annotations.cs b/src/Artemis.UI.Shared/Properties/Annotations.cs
index d2899bae9..227caf7b8 100644
--- a/src/Artemis.UI.Shared/Properties/Annotations.cs
+++ b/src/Artemis.UI.Shared/Properties/Annotations.cs
@@ -22,9 +22,10 @@ SOFTWARE. */
using System;
-// ReSharper disable InheritdocConsiderUsage
-
+#pragma warning disable 8618
#pragma warning disable 1591
+
+// ReSharper disable InheritdocConsiderUsage
// ReSharper disable UnusedMember.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
diff --git a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
index 28ea1f1e6..d6b4909bb 100644
--- a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
+++ b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics.CodeAnalysis;
using Artemis.Core;
using Artemis.UI.Shared.Services;
using Stylet;
@@ -12,7 +13,7 @@ namespace Artemis.UI.Shared
public abstract class PropertyInputViewModel : PropertyInputViewModel
{
private bool _inputDragging;
- private T _inputValue;
+ [AllowNull] private T _inputValue = default!;
///
/// Creates a new instance of the class
@@ -73,6 +74,7 @@ namespace Artemis.UI.Shared
///
/// Gets or sets the input value
///
+ [AllowNull]
public T InputValue
{
get => _inputValue;
diff --git a/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs
index 5b75224c5..4d65fe81c 100644
--- a/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs
+++ b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs
@@ -19,13 +19,13 @@ namespace Artemis.UI.Shared.Screens.Dialogs
public void Confirm()
{
- if (!Session.IsEnded)
+ if (Session != null && !Session.IsEnded)
Session.Close(true);
}
public void Cancel()
{
- if (!Session.IsEnded)
+ if (Session != null && !Session.IsEnded)
Session.Close(false);
}
}
diff --git a/src/Artemis.UI.Shared/Screens/Exceptions/ExceptionViewModel.cs b/src/Artemis.UI.Shared/Screens/Exceptions/ExceptionViewModel.cs
index 4945156f2..813778370 100644
--- a/src/Artemis.UI.Shared/Screens/Exceptions/ExceptionViewModel.cs
+++ b/src/Artemis.UI.Shared/Screens/Exceptions/ExceptionViewModel.cs
@@ -9,12 +9,12 @@ namespace Artemis.UI.Shared.Screens.Exceptions
{
private List _exceptions;
- public ExceptionViewModel(string message, Exception exception)
+ public ExceptionViewModel(string message, Exception? exception)
{
Header = message;
- Exceptions = new List();
+ _exceptions = new List();
- Exception currentException = exception;
+ Exception? currentException = exception;
while (currentException != null)
{
Exceptions.Add(new DialogException(currentException));
diff --git a/src/Artemis.UI.Shared/Screens/GradientEditor/ColorStopViewModel.cs b/src/Artemis.UI.Shared/Screens/GradientEditor/ColorStopViewModel.cs
index 99a7f9cf2..7d93d868a 100644
--- a/src/Artemis.UI.Shared/Screens/GradientEditor/ColorStopViewModel.cs
+++ b/src/Artemis.UI.Shared/Screens/GradientEditor/ColorStopViewModel.cs
@@ -59,7 +59,7 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
set => SetAndNotify(ref _willRemoveColorStop, value);
}
- private void ColorStopOnPropertyChanged(object sender, PropertyChangedEventArgs e)
+ private void ColorStopOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
_gradientEditorViewModel.ColorGradient.OnColorValuesUpdated();
}
@@ -90,7 +90,7 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
if (!((IInputElement) sender).IsMouseCaptured)
return;
- Canvas parent = VisualTreeUtilities.FindParent