Skip to content

Commit d352f36

Browse files
committed
* No need to keep updating the GUI RAM usage when application is not active (better system performance)
1 parent 4deac14 commit d352f36

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

MemPlus/Windows/MainWindow.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
<MenuItem Header="Application logs" />
3535
</MenuItem>
3636
<Separator />
37+
<MenuItem Header="GUI">
38+
<MenuItem Header="Always on top" IsCheckable="True" />
39+
</MenuItem>
3740
<MenuItem Header="Settings" />
3841
</MenuItem>
3942

MemPlus/Windows/MainWindow.xaml.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,24 @@ public MainWindow()
2727
InitializeComponent();
2828
ChangeVisualStyle();
2929

30-
_ramController = new RamController(Dispatcher, CgRamUsage,LblTotalPhysicalMemory, LblAvailablePhysicalMemory, 5000, _logController);
30+
_ramController = new RamController(Dispatcher, CgRamUsage,LblTotalPhysicalMemory, LblAvailablePhysicalMemory, 1000, _logController);
3131
_ramController.EnableMonitor();
32+
33+
Application app = Application.Current;
34+
app.Activated += Active;
35+
app.Deactivated += Passive;
36+
37+
_logController.AddLog(new ApplicationLog("Done initializing MemPlus"));
38+
}
39+
40+
private void Active(object sender, EventArgs args)
41+
{
42+
_ramController.EnableMonitor();
43+
}
44+
45+
private void Passive(object sender, EventArgs args)
46+
{
47+
_ramController.DisableMonitor();
3248
}
3349

3450
private static void LogAddedEvent(Log log)

0 commit comments

Comments
 (0)