Skip to content

Commit ff1446e

Browse files
committed
* Improved on logging
1 parent d2d94b1 commit ff1446e

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

MemPlus/Windows/AboutWindow.xaml.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ private void LoadProperties()
6060
private void ChangeVisualStyle()
6161
{
6262
_logController.AddLog(new ApplicationLog("Changing AboutWindow theme style"));
63-
6463
StyleManager.ChangeStyle(this);
65-
6664
_logController.AddLog(new ApplicationLog("Done changing AboutWindow theme style"));
6765
}
6866

@@ -73,7 +71,6 @@ private void ChangeVisualStyle()
7371
/// <param name="e">The routed event arguments</param>
7472
private void BtnClose_OnClick(object sender, RoutedEventArgs e)
7573
{
76-
_logController.AddLog(new ApplicationLog("Closing AboutWindow"));
7774
Close();
7875
}
7976

@@ -84,9 +81,9 @@ private void BtnClose_OnClick(object sender, RoutedEventArgs e)
8481
/// <param name="e">The routed event arguments</param>
8582
private void BtnLicense_OnClick(object sender, RoutedEventArgs e)
8683
{
84+
_logController.AddLog(new ApplicationLog("Opening MemPlus license file"));
8785
try
8886
{
89-
_logController.AddLog(new ApplicationLog("Opening MemPlus license file"));
9087
Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\gpl.pdf");
9188
}
9289
catch (Exception ex)
@@ -103,9 +100,9 @@ private void BtnLicense_OnClick(object sender, RoutedEventArgs e)
103100
/// <param name="e">The routed event arguments</param>
104101
private void BtnCodeDead_OnClick(object sender, RoutedEventArgs e)
105102
{
103+
_logController.AddLog(new ApplicationLog("Opening CodeDead website"));
106104
try
107105
{
108-
_logController.AddLog(new ApplicationLog("Opening CodeDead website"));
109106
Process.Start("https://codedead.com/");
110107
}
111108
catch (Exception ex)

MemPlus/Windows/AnalyzerWindow.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ private void RefreshRamData()
7474
/// </summary>
7575
private void ChangeVisualStyle()
7676
{
77-
_logController.AddLog(new ApplicationLog("Changing LogWindow theme style"));
77+
_logController.AddLog(new ApplicationLog("Changing AnalyzerWindow theme style"));
7878
StyleManager.ChangeStyle(this);
79-
_logController.AddLog(new ApplicationLog("Done changing LogWindow theme style"));
79+
_logController.AddLog(new ApplicationLog("Done changing AnalyzerWindow theme style"));
8080
}
8181

8282
/// <summary>
@@ -116,8 +116,7 @@ private void BtnExport_OnClick(object sender, RoutedEventArgs e)
116116
{
117117
SaveFileDialog sfd = new SaveFileDialog
118118
{
119-
Filter =
120-
"Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
119+
Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
121120
};
122121
if (sfd.ShowDialog() != true) return;
123122
try

MemPlus/Windows/MainWindow.xaml.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public partial class MainWindow
3939
public MainWindow()
4040
{
4141
_logController = new LogController(600000);
42-
_updateManager = new UpdateManager.UpdateManager(Assembly.GetExecutingAssembly().GetName().Version, "https://codedead.com/Software/MemPlus/update.xml", "MemPlus");
4342
_logController.AddLog(new ApplicationLog("Initializing MainWindow"));
43+
_updateManager = new UpdateManager.UpdateManager(Assembly.GetExecutingAssembly().GetName().Version, "https://codedead.com/Software/MemPlus/update.xml", "MemPlus");
4444

4545
InitializeComponent();
4646
ChangeVisualStyle();
@@ -209,12 +209,12 @@ private async void BtnClearMemory_OnClick(object sender, RoutedEventArgs e)
209209
if (ramSavings < 0)
210210
{
211211
ramSavings = Math.Abs(ramSavings);
212-
_logController.AddLog(new ApplicationLog("RAM usage increase: " + ramSavings.ToString("F2") + " MB"));
212+
_logController.AddLog(new RamLog("RAM usage increase: " + ramSavings.ToString("F2") + " MB"));
213213
MessageBox.Show("Looks like your RAM usage has increased with " + ramSavings.ToString("F2") + " MB!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
214214
}
215215
else
216216
{
217-
_logController.AddLog(new ApplicationLog("RAM usage decrease: " + ramSavings.ToString("F2") + " MB"));
217+
_logController.AddLog(new RamLog("RAM usage decrease: " + ramSavings.ToString("F2") + " MB"));
218218
MessageBox.Show("You saved " + ramSavings.ToString("F2") + " MB of RAM!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
219219
}
220220

@@ -296,9 +296,9 @@ private void TopMenuItem_OnCheckedChanged(object sender, RoutedEventArgs e)
296296
/// <param name="e">The RoutedEventArgs</param>
297297
private void HomePageMenuItem_OnClick(object sender, RoutedEventArgs e)
298298
{
299+
_logController.AddLog(new ApplicationLog("Opening CodeDead website"));
299300
try
300301
{
301-
_logController.AddLog(new ApplicationLog("Opening CodeDead website"));
302302
System.Diagnostics.Process.Start("https://codedead.com/");
303303
}
304304
catch (Exception ex)
@@ -315,9 +315,9 @@ private void HomePageMenuItem_OnClick(object sender, RoutedEventArgs e)
315315
/// <param name="e">The RoutedEventArgs</param>
316316
private void DonateMenuItem_OnClick(object sender, RoutedEventArgs e)
317317
{
318+
_logController.AddLog(new ApplicationLog("Opening donation website"));
318319
try
319320
{
320-
_logController.AddLog(new ApplicationLog("Opening donation website"));
321321
System.Diagnostics.Process.Start("https://codedead.com/?page_id=302");
322322
}
323323
catch (Exception ex)
@@ -499,9 +499,9 @@ private void RamMonitorMenuItem_OnCheckedChanged(object sender, RoutedEventArgs
499499
/// <param name="e">The routed event arguments</param>
500500
private void LicenseMenuItem_OnClick(object sender, RoutedEventArgs e)
501501
{
502+
_logController.AddLog(new ApplicationLog("Opening MemPlus license file"));
502503
try
503504
{
504-
_logController.AddLog(new ApplicationLog("Opening MemPlus license file"));
505505
System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\gpl.pdf");
506506
}
507507
catch (Exception ex)
@@ -518,9 +518,9 @@ private void LicenseMenuItem_OnClick(object sender, RoutedEventArgs e)
518518
/// <param name="e">The routed event arguments</param>
519519
private void HelpMenuItem_OnClick(object sender, RoutedEventArgs e)
520520
{
521+
_logController.AddLog(new ApplicationLog("Opening MemPlus help file"));
521522
try
522523
{
523-
_logController.AddLog(new ApplicationLog("Opening MemPlus help file"));
524524
System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\help.pdf");
525525
}
526526
catch (Exception ex)
@@ -561,8 +561,7 @@ private void ExportRamAnalyzerDataMenuItem_OnClick(object sender, RoutedEventArg
561561
{
562562
SaveFileDialog sfd = new SaveFileDialog
563563
{
564-
Filter =
565-
"Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
564+
Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
566565
};
567566
if (sfd.ShowDialog() != true) return;
568567
try

0 commit comments

Comments
 (0)