File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 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}" >
You can’t perform that action at this time.
0 commit comments