Skip to content

Commit 693a09f

Browse files
committed
* Implemented a fix for taskbar icons remaining visible after window is closed
1 parent c1aba2c commit 693a09f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

MemPlus/Windows/MainWindow.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
mc:Ignorable="d"
1010
UseLayoutRounding="True"
1111
TitleTextAlignment="Center"
12-
Title="MemPlus" Height="300" Width="500" WindowStartupLocation="CenterScreen" Icon="/Resources/Images/ram.png">
12+
Title="MemPlus" Height="300" Width="500" WindowStartupLocation="CenterScreen" Icon="/Resources/Images/ram.png"
13+
Closing="MainWindow_OnClosing">
1314
<Grid>
1415
<Grid.RowDefinitions>
1516
<RowDefinition Height="Auto"></RowDefinition>
1617
<RowDefinition Height="Auto"></RowDefinition>
1718
<RowDefinition></RowDefinition>
1819
</Grid.RowDefinitions>
1920

20-
<tb:TaskbarIcon
21+
<tb:TaskbarIcon x:Name="TbiIcon"
2122
ToolTipText="DeviceLog"
2223
IconSource="../ram.ico"
2324
TrayMouseDoubleClick="OpenTbItem_Click">

MemPlus/Windows/MainWindow.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Reflection;
34
using System.Windows;
45
using System.Windows.Media;
@@ -591,5 +592,15 @@ private void ExportRamAnalyzerDataMenuItem_OnClick(object sender, RoutedEventArg
591592
MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
592593
}
593594
}
595+
596+
/// <summary>
597+
/// Method that is called when the MainWindow is closing
598+
/// </summary>
599+
/// <param name="sender">The object that called this method</param>
600+
/// <param name="e">The CancelEventArgs</param>
601+
private void MainWindow_OnClosing(object sender, CancelEventArgs e)
602+
{
603+
TbiIcon.Visibility = Visibility.Hidden;
604+
}
594605
}
595606
}

MemPlus/Windows/SettingsWindow.xaml.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,9 @@ private void ClearExclusionsMenuItem_OnClick(object sender, RoutedEventArgs e)
334334
/// <param name="e">The RoutedEventArgs</param>
335335
private void ChbAutoOptimizePercentage_OnChecked(object sender, RoutedEventArgs e)
336336
{
337-
if (ChbRamMonitor.IsChecked != null && !ChbRamMonitor.IsChecked.Value)
338-
{
339-
MessageBox.Show("This option will only work if the RAM Monitor is enabled!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
340-
341-
ChbRamMonitor.IsChecked = true;
342-
}
337+
if (ChbRamMonitor.IsChecked == null || ChbRamMonitor.IsChecked.Value) return;
338+
MessageBox.Show("This option will only work if the RAM Monitor is enabled!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
339+
ChbRamMonitor.IsChecked = true;
343340
}
344341
}
345342
}

0 commit comments

Comments
 (0)