Core - Fixed data model namespaces

Modules - Added IsPropertyInUse API
UI - Properly dispose data model paths wherever they are used
This commit is contained in:
Robert committed 2021-06-11 23:20:14 +02:00
1 parent 222fddd749
commit 3f22ebae8a
48 files changed
+305 -103

No files matched your search

@@ -1,5 +1,5 @@
using System;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
namespace Artemis.Core
{
@@ -1,5 +1,5 @@
using System;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
namespace Artemis.Core
{
@@ -1,5 +1,5 @@
using System;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
namespace Artemis.Core
{
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
namespace Artemis.Core
{
@@ -1,5 +1,5 @@
using System;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
namespace Artemis.Core
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core
@@ -175,6 +175,8 @@ namespace Artemis.Core
internal void Invalidate()
{
Target?.RemoveDataModelPath(this);
foreach (DataModelPathSegment dataModelPathSegment in _segments)
dataModelPathSegment.Dispose();
_segments.Clear();
@@ -187,11 +189,11 @@ namespace Artemis.Core
internal void Initialize()
{
Invalidate();
if (Target == null)
return;
Target.AddDataModelPath(this);
DataModelPathSegment startSegment = new(this, "target", "target");
startSegment.Node = _segments.AddFirst(startSegment);
@@ -260,7 +262,7 @@ namespace Artemis.Core
DataModelStore.DataModelAdded += DataModelStoreOnDataModelAdded;
DataModelStore.DataModelRemoved += DataModelStoreOnDataModelRemoved;
}
#region IDisposable
/// <summary>
@@ -330,6 +332,7 @@ namespace Artemis.Core
if (e.Registration.DataModel.Module.Id != Entity.DataModelId)
return;
Invalidate();
Target = e.Registration.DataModel;
Initialize();
}
@@ -339,8 +342,8 @@ namespace Artemis.Core
if (e.Registration.DataModel.Module.Id != Entity.DataModelId)
return;
Target = null;
Invalidate();
Target = null;
}
#endregion
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
using Humanizer;
namespace Artemis.Core
@@ -301,7 +301,7 @@ namespace Artemis.Core
private void DynamicChildOnDynamicChildRemoved(object? sender, DynamicDataModelChildEventArgs e)
{
if (e.DynamicChild.BaseValue == _dynamicDataModel)
DataModelPath.Initialize();
DataModelPath.Invalidate();
}
#endregion
@@ -1,4 +1,4 @@
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
namespace Artemis.Core
{
@@ -5,6 +5,9 @@ using Artemis.Storage.Entities.Profile;
namespace Artemis.Core
{
/// <summary>
/// Represents a category containing <see cref="ProfileConfigurations" />
/// </summary>
public class ProfileCategory : CorePropertyChanged, IStorageModel
{
private readonly List<ProfileConfiguration> _profileConfigurations = new();
@@ -59,6 +59,8 @@ namespace Artemis.Core
foreach (BaseLayerEffect baseLayerEffect in LayerEffects)
baseLayerEffect.Dispose();
DisplayCondition?.Dispose();
base.Dispose(disposing);
}