diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerBrushSettingsWindowViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerBrushSettingsWindowViewModel.cs index 94e2bf4ba..bea20cbd8 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerBrushSettingsWindowViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerBrushSettingsWindowViewModel.cs @@ -1,4 +1,5 @@ -using Artemis.Core.LayerBrushes; +using System; +using Artemis.Core.LayerBrushes; using Stylet; namespace Artemis.UI.Screens.ProfileEditor @@ -7,7 +8,14 @@ namespace Artemis.UI.Screens.ProfileEditor { public LayerBrushSettingsWindowViewModel(BrushConfigurationViewModel configurationViewModel) { - ActiveItem = configurationViewModel; + ActiveItem = configurationViewModel ?? throw new ArgumentNullException(nameof(configurationViewModel)); + ActiveItem.Closed += ActiveItemOnClosed; + } + + private void ActiveItemOnClosed(object sender, CloseEventArgs e) + { + ActiveItem.Closed -= ActiveItemOnClosed; + RequestClose(); } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerEffectSettingsWindowViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerEffectSettingsWindowViewModel.cs index cf23efa2e..d8e31a5a3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerEffectSettingsWindowViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerEffectSettingsWindowViewModel.cs @@ -1,4 +1,5 @@ -using Artemis.Core.LayerEffects; +using System; +using Artemis.Core.LayerEffects; using Stylet; namespace Artemis.UI.Screens.ProfileEditor @@ -7,7 +8,14 @@ namespace Artemis.UI.Screens.ProfileEditor { public LayerEffectSettingsWindowViewModel(EffectConfigurationViewModel configurationViewModel) { - ActiveItem = configurationViewModel; + ActiveItem = configurationViewModel ?? throw new ArgumentNullException(nameof(configurationViewModel)); + ActiveItem.Closed += ActiveItemOnClosed; + } + + private void ActiveItemOnClosed(object sender, CloseEventArgs e) + { + ActiveItem.Closed -= ActiveItemOnClosed; + RequestClose(); } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsWindowViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsWindowViewModel.cs index 5ad07c1f3..cb06d38c4 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsWindowViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsWindowViewModel.cs @@ -1,4 +1,5 @@ -using Artemis.Core; +using System; +using Artemis.Core; using MaterialDesignThemes.Wpf; using Stylet; @@ -9,14 +10,14 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins public PluginSettingsWindowViewModel(PluginConfigurationViewModel configurationViewModel, PackIconKind icon) { Icon = icon; - ActiveItem = configurationViewModel; + ActiveItem = configurationViewModel ?? throw new ArgumentNullException(nameof(configurationViewModel)); ActiveItem.Closed += ActiveItemOnClosed; } public PackIconKind Icon { get; } - private void ActiveItemOnClosed(object? sender, CloseEventArgs e) + private void ActiveItemOnClosed(object sender, CloseEventArgs e) { ActiveItem.Closed -= ActiveItemOnClosed; RequestClose();