mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Scripts - Properly register script with its owner
Scripts UI - Save on close Scripts UI - Dispose script on removal
This commit is contained in:
1 parent
5367027471
commit
a5c13bb543
5 files changed
+28
-1
No files matched your search
@@ -68,6 +68,7 @@ namespace Artemis.UI.Screens.Scripting
|
||||
}
|
||||
|
||||
ScriptConfiguration.DiscardPendingChanges();
|
||||
ScriptConfiguration.Script?.Dispose();
|
||||
RequestClose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,15 +15,17 @@ namespace Artemis.UI.Screens.Scripting
|
||||
{
|
||||
private readonly IScriptingService _scriptingService;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IScriptVmFactory _scriptVmFactory;
|
||||
public Profile Profile { get; }
|
||||
public Layer Layer { get; }
|
||||
public ILayerProperty LayerProperty { get; }
|
||||
|
||||
public ScriptsDialogViewModel(Profile profile, IScriptingService scriptingService, IDialogService dialogService, IScriptVmFactory scriptVmFactory)
|
||||
public ScriptsDialogViewModel(Profile profile, IScriptingService scriptingService, IDialogService dialogService, IProfileEditorService profileEditorService, IScriptVmFactory scriptVmFactory)
|
||||
{
|
||||
_scriptingService = scriptingService;
|
||||
_dialogService = dialogService;
|
||||
_profileEditorService = profileEditorService;
|
||||
_scriptVmFactory = scriptVmFactory;
|
||||
|
||||
DisplayName = "Artemis | Profile Scripts";
|
||||
@@ -74,5 +76,17 @@ namespace Artemis.UI.Screens.Scripting
|
||||
|
||||
Items.Add(_scriptVmFactory.ScriptConfigurationViewModel(scriptConfiguration));
|
||||
}
|
||||
|
||||
#region Overrides of OneActive
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnClose()
|
||||
{
|
||||
_profileEditorService.SaveSelectedProfileConfiguration();
|
||||
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user