Skip to content

Commit 65a4f12

Browse files
committed
* Fixed task still executing after window has closed
1 parent 32eef6b commit 65a4f12

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

MemPlus/Views/Windows/LogWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.Linq;
45
using System.Windows;
56
using System.Windows.Controls;

MemPlus/Views/Windows/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
mc:Ignorable="d"
1010
UseLayoutRounding="True"
1111
TitleTextAlignment="Center"
12+
Closing="MainWindow_OnClosing"
1213
Title="MemPlus" Height="300" Width="500" WindowStartupLocation="CenterScreen" Icon="/Resources/Images/ram.png">
1314
<Grid>
1415
<Grid.RowDefinitions>

MemPlus/Views/Windows/MainWindow.xaml.cs

Lines changed: 12 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.Input;
@@ -738,5 +739,16 @@ private async void ClearMemory(int index)
738739
_clearingMemory = false;
739740
_logController.AddLog(new ApplicationLog("Done clearing RAM memory"));
740741
}
742+
743+
/// <summary>
744+
/// Method that is called when the MainWindow is closing
745+
/// </summary>
746+
/// <param name="sender">The object that called this method</param>
747+
/// <param name="e">The CancelEventArgs</param>
748+
private void MainWindow_OnClosing(object sender, CancelEventArgs e)
749+
{
750+
// Disable the RAM Monitor to prevent exceptions from being thrown
751+
_ramController?.DisableMonitor();
752+
}
741753
}
742754
}

0 commit comments

Comments
 (0)