Core - Nullable refactoring

Core - Nullable refactoring


Core - Nullable refactoring (finish)
This commit is contained in:
SpoinkyNL committed 2020-11-17 22:50:38 +01:00
1 parent b185b28645
commit fb3466e102
61 files changed
+320 -272

No files matched your search

@@ -10,10 +10,20 @@ namespace Artemis.Core.LayerBrushes
{
private LayerBrushType _brushType;
private ILayerBrushConfigurationDialog? _configurationDialog;
private LayerBrushDescriptor? _descriptor;
private LayerBrushDescriptor _descriptor;
private Layer _layer;
private bool _supportsTransformation = true;
/// <summary>
/// Creates a new instance of the <see cref="BaseLayerBrush" /> class
/// </summary>
protected BaseLayerBrush()
{
// Both are set right after construction to keep the constructor of inherited classes clean
_layer = null!;
_descriptor = null!;
}
/// <summary>
/// Gets the layer this brush is applied to
/// </summary>
@@ -26,7 +36,7 @@ namespace Artemis.Core.LayerBrushes
/// <summary>
/// Gets the descriptor of this brush
/// </summary>
public LayerBrushDescriptor? Descriptor
public LayerBrushDescriptor Descriptor
{
get => _descriptor;
internal set => SetAndNotify(ref _descriptor, value);
@@ -7,7 +7,7 @@ namespace Artemis.Core.LayerBrushes
/// </summary>
public abstract class PropertiesLayerBrush<T> : BaseLayerBrush where T : LayerPropertyGroup
{
private T _properties;
private T _properties = null!;
/// <summary>
/// Gets whether all properties on this brush are initialized
@@ -35,7 +35,7 @@ namespace Artemis.Core.LayerBrushes
internal void InitializeProperties()
{
Properties = Activator.CreateInstance<T>();
Properties.GroupDescription ??= new PropertyGroupDescriptionAttribute {Name = Descriptor.DisplayName, Description = Descriptor.Description};
Properties.GroupDescription = new PropertyGroupDescriptionAttribute {Name = Descriptor.DisplayName, Description = Descriptor.Description};
Properties.LayerBrush = this;
Properties.Initialize(Layer, "LayerBrush.", Descriptor.Provider);
PropertiesInitialized = true;