From 65df7da2bf5644ed2706ce78fef95d32562b1e87 Mon Sep 17 00:00:00 2001 From: Kalakoi Date: Tue, 27 May 2025 08:06:53 -0400 Subject: [PATCH] Dereference current view on close. --- osrs-toolbox/Views/CompetitionOverlayView.xaml | 2 +- osrs-toolbox/Views/CompetitionOverlayView.xaml.cs | 5 +++++ osrs-toolbox/Views/DropChanceView.xaml | 2 +- osrs-toolbox/Views/DropChanceView.xaml.cs | 5 +++++ osrs-toolbox/Views/SplashScreenView.xaml.cs | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osrs-toolbox/Views/CompetitionOverlayView.xaml b/osrs-toolbox/Views/CompetitionOverlayView.xaml index 8ea8bca..fc56978 100644 --- a/osrs-toolbox/Views/CompetitionOverlayView.xaml +++ b/osrs-toolbox/Views/CompetitionOverlayView.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:osrs_toolbox" 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"> diff --git a/osrs-toolbox/Views/CompetitionOverlayView.xaml.cs b/osrs-toolbox/Views/CompetitionOverlayView.xaml.cs index d9e002e..e724d1d 100644 --- a/osrs-toolbox/Views/CompetitionOverlayView.xaml.cs +++ b/osrs-toolbox/Views/CompetitionOverlayView.xaml.cs @@ -39,5 +39,10 @@ namespace osrs_toolbox var hwnd = new WindowInteropHelper(this).Handle; WindowsServices.SetWindowExTransparent(hwnd); } + + private void Window_Closed(object sender, EventArgs e) + { + Current = null; + } } } diff --git a/osrs-toolbox/Views/DropChanceView.xaml b/osrs-toolbox/Views/DropChanceView.xaml index 85510bb..04fa3bb 100644 --- a/osrs-toolbox/Views/DropChanceView.xaml +++ b/osrs-toolbox/Views/DropChanceView.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:osrs_toolbox" 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"> diff --git a/osrs-toolbox/Views/DropChanceView.xaml.cs b/osrs-toolbox/Views/DropChanceView.xaml.cs index 1559ef0..ffa1bc7 100644 --- a/osrs-toolbox/Views/DropChanceView.xaml.cs +++ b/osrs-toolbox/Views/DropChanceView.xaml.cs @@ -25,5 +25,10 @@ namespace osrs_toolbox InitializeComponent(); Current = this; } + + private void Window_Closed(object sender, EventArgs e) + { + Current = null; + } } } diff --git a/osrs-toolbox/Views/SplashScreenView.xaml.cs b/osrs-toolbox/Views/SplashScreenView.xaml.cs index 9911f29..81af1e8 100644 --- a/osrs-toolbox/Views/SplashScreenView.xaml.cs +++ b/osrs-toolbox/Views/SplashScreenView.xaml.cs @@ -55,6 +55,7 @@ namespace osrs_toolbox Application.Current.MainWindow = HomePageView.Current; HomePageView.Current.Show(); this.Close(); + Current = null; } private void Window_Loaded(object sender, RoutedEventArgs e)