Dereference current view on close.

This commit is contained in:
2025-05-27 08:06:53 -04:00
parent f62aeac08f
commit 65df7da2bf
5 changed files with 13 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:osrs_toolbox" xmlns:local="clr-namespace:osrs_toolbox"
mc:Ignorable="d" mc:Ignorable="d"
Title="Competition Info" Height="800" Width="500" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" SizeToContent="WidthAndHeight" MouseDown="Window_MouseDown" Topmost="True"> Title="Competition Info" Height="800" Width="500" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" SizeToContent="WidthAndHeight" MouseDown="Window_MouseDown" Topmost="True" Closed="Window_Closed">
<Window.DataContext> <Window.DataContext>
<local:CompetitionOverlayViewModel/> <local:CompetitionOverlayViewModel/>
</Window.DataContext> </Window.DataContext>

View File

@@ -39,5 +39,10 @@ namespace osrs_toolbox
var hwnd = new WindowInteropHelper(this).Handle; var hwnd = new WindowInteropHelper(this).Handle;
WindowsServices.SetWindowExTransparent(hwnd); WindowsServices.SetWindowExTransparent(hwnd);
} }
private void Window_Closed(object sender, EventArgs e)
{
Current = null;
}
} }
} }

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:osrs_toolbox" xmlns:local="clr-namespace:osrs_toolbox"
mc:Ignorable="d" mc:Ignorable="d"
Title="Drop Chance Calculator" Height="450" Width="800" SizeToContent="WidthAndHeight"> Title="Drop Chance Calculator" Height="450" Width="800" SizeToContent="WidthAndHeight" Closed="Window_Closed">
<Window.DataContext> <Window.DataContext>
<local:DropChanceViewModel/> <local:DropChanceViewModel/>
</Window.DataContext> </Window.DataContext>

View File

@@ -25,5 +25,10 @@ namespace osrs_toolbox
InitializeComponent(); InitializeComponent();
Current = this; Current = this;
} }
private void Window_Closed(object sender, EventArgs e)
{
Current = null;
}
} }
} }

View File

@@ -55,6 +55,7 @@ namespace osrs_toolbox
Application.Current.MainWindow = HomePageView.Current; Application.Current.MainWindow = HomePageView.Current;
HomePageView.Current.Show(); HomePageView.Current.Show();
this.Close(); this.Close();
Current = null;
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)