Skip to content

Commit 2f7d89d

Browse files
committed
Fixed export window closing entire application instead of just the window.
1 parent c7d2101 commit 2f7d89d

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

SplatNet.Stream/Windows/Controls/CustomWindowHeader.xaml.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ namespace SplatNet.Stream.Windows.Controls
2020
/// </summary>
2121
public partial class CustomWindowHeader : UserControl
2222
{
23+
public bool ShouldCloseExit
24+
{
25+
get => (bool)this.GetValue(ShouldClosingExitProperty);
26+
set => this.SetValue(ShouldClosingExitProperty, value);
27+
}
28+
29+
public static readonly DependencyProperty ShouldClosingExitProperty =
30+
DependencyProperty.Register
31+
(
32+
"ShouldCloseExit",
33+
typeof (bool),
34+
typeof (CustomWindowHeader),
35+
new PropertyMetadata (true)
36+
);
37+
2338
public CustomWindowHeader()
2439
{
2540
this.InitializeComponent();
@@ -36,7 +51,15 @@ private void Minimize_Click(object sender, RoutedEventArgs e)
3651

3752
private void Close_Click(object sender, RoutedEventArgs e)
3853
{
39-
Environment.Exit(0);
54+
if (this.ShouldCloseExit)
55+
{
56+
Environment.Exit(0);
57+
}
58+
else
59+
{
60+
Window window = Window.GetWindow(this);
61+
window?.Close();
62+
}
4063
}
4164
}
4265
}

SplatNet.Stream/Windows/ExportWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<RowDefinition/>
2222
<RowDefinition Height="Auto"/>
2323
</Grid.RowDefinitions>
24-
<controls:CustomWindowHeader/>
24+
<controls:CustomWindowHeader ShouldCloseExit="False"/>
2525
<TreeView Grid.Row="1" x:Name="trvExport" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding}">
2626
<TreeView.Resources>
2727
<HierarchicalDataTemplate DataType="{x:Type controls:CheckableTreeItem}" ItemsSource="{Binding Items}">

0 commit comments

Comments
 (0)