Effect/brush dialogs - Fixed window not closing on RequestClose();

This commit is contained in:
SpoinkyNL committed 2020-09-04 16:28:49 +02:00
1 parent 18225ca6fa
commit 76dcbaf6d7
3 files changed
+24 -7

No files matched your search

@@ -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();
}
}
}
@@ -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();
}
}
}
@@ -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();