Skip to content

Commit d21b788

Browse files
committed
* Dispose the LogController in correct method
* Minor design changes
1 parent 234c48f commit d21b788

File tree

2 files changed

+26
-40
lines changed

2 files changed

+26
-40
lines changed

MemPlus/Views/Windows/MainWindow.xaml.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public MainWindow()
9191
Application app = Application.Current;
9292
app.Activated += Active;
9393
app.Deactivated += Passive;
94-
if (app.MainWindow != null) app.MainWindow.Closing += MainWindow_Closing;
9594

9695
LoadProperties();
9796

@@ -139,17 +138,6 @@ public MainWindow()
139138
_logController.AddLog(new ApplicationLog("Done initializing MainWindow"));
140139
}
141140

142-
/// <summary>
143-
/// Event that is called when the MainWindow is closing
144-
/// </summary>
145-
/// <param name="sender">The object that called this method</param>
146-
/// <param name="e">The CancelEventArgs</param>
147-
private void MainWindow_Closing(object sender, CancelEventArgs e)
148-
{
149-
// Dispose of the LogController object gracefully
150-
_logController.Dispose();
151-
}
152-
153141
/// <summary>
154142
/// Load the strings that are required for the UpdateManager library
155143
/// </summary>
@@ -1048,11 +1036,13 @@ private void MainWindow_OnClosing(object sender, CancelEventArgs e)
10481036
}
10491037
else
10501038
{
1051-
// Unregister any hotkeys, if applicable
1039+
// De-register any hotkeys, if applicable
10521040
_hotKeyController?.Dispose();
10531041
// Disable the RAM Monitor to prevent exceptions from being thrown
10541042
_ramController?.DisableMonitor();
10551043
TbiIcon?.Dispose();
1044+
// Dispose of the LogController object gracefully
1045+
_logController.Dispose();
10561046
}
10571047
}
10581048
}

MemPlus/Views/Windows/SettingsWindow.xaml

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -101,43 +101,39 @@
101101
<RowDefinition Height="Auto" />
102102
</Grid.RowDefinitions>
103103

104-
<Grid Grid.Row="0">
105-
<Grid.ColumnDefinitions>
106-
<ColumnDefinition Width="Auto" />
107-
<ColumnDefinition Width="Auto" />
108-
<ColumnDefinition Width="Auto" />
109-
</Grid.ColumnDefinitions>
104+
<Grid.ColumnDefinitions>
105+
<ColumnDefinition Width="Auto" />
106+
<ColumnDefinition Width="Auto" />
107+
<ColumnDefinition Width="Auto" />
108+
</Grid.ColumnDefinitions>
110109

111-
<CheckBox x:Name="ChbAutoClearLogs" Margin="3" Content="{DynamicResource AutoClearLogs}" />
112-
<syncfusion:IntegerTextBox x:Name="ItbAutoClearLogsInterval" Margin="3" Grid.Row="0" Grid.Column="1" MinValue="1" />
110+
<CheckBox x:Name="ChbAutoClearLogs" Grid.Row="0" Grid.Column="0" Margin="3" Content="{DynamicResource AutoClearLogs}" />
111+
<syncfusion:IntegerTextBox x:Name="ItbAutoClearLogsInterval" Margin="3" Grid.Row="0" Grid.Column="1" MinValue="1" />
113112

114-
<ComboBox x:Name="CboLogClearInterval" Grid.Column="2" Margin="3" SelectedIndex="0">
115-
<ComboBoxItem Content="{DynamicResource Milliseconds}" />
116-
<ComboBoxItem Content="{DynamicResource Seconds}" />
117-
<ComboBoxItem Content="{DynamicResource Minutes}" />
118-
<ComboBoxItem Content="{DynamicResource Hours}" />
119-
</ComboBox>
113+
<ComboBox x:Name="CboLogClearInterval" Grid.Row="0" Grid.Column="2" Margin="3" SelectedIndex="0">
114+
<ComboBoxItem Content="{DynamicResource Milliseconds}" />
115+
<ComboBoxItem Content="{DynamicResource Seconds}" />
116+
<ComboBoxItem Content="{DynamicResource Minutes}" />
117+
<ComboBoxItem Content="{DynamicResource Hours}" />
118+
</ComboBox>
120119

121-
</Grid>
120+
<CheckBox x:Name="ChbSaveLogsToFile" Margin="3" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Content="{DynamicResource LogFile}" />
121+
122+
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
123+
<Grid.RowDefinitions>
124+
<RowDefinition Height="Auto" />
125+
</Grid.RowDefinitions>
122126

123-
<CheckBox x:Name="ChbSaveLogsToFile" Margin="3" Grid.Row="1" Content="{DynamicResource LogFile}" />
124-
<Grid Grid.Row="2">
125127
<Grid.ColumnDefinitions>
126128
<ColumnDefinition Width="Auto" />
127-
<ColumnDefinition Width="Auto" />
129+
<ColumnDefinition Width="*" />
128130
<ColumnDefinition Width="Auto" />
129131
</Grid.ColumnDefinitions>
130132

131-
<Grid.RowDefinitions>
132-
<RowDefinition />
133-
<RowDefinition />
134-
</Grid.RowDefinitions>
135-
136-
<Label Margin="3" Content="{DynamicResource LogFilePath}" Grid.Row="1" Grid.Column="0" />
137-
<TextBox x:Name="TxtLogFilePath" Margin="3" Grid.Row="1" Grid.Column="1" MaxWidth="300" MouseDoubleClick="BtnSelectLogFilePath" />
138-
<Button Margin="3" MinWidth="40" Grid.Row="1" Grid.Column="2" Content="..." Click="BtnSelectLogFilePath" />
133+
<Label Margin="3" Content="{DynamicResource LogFilePath}" Grid.Column="0" />
134+
<TextBox x:Name="TxtLogFilePath" HorizontalAlignment="Stretch" MaxWidth="350" Margin="3" Grid.Column="1" MouseDoubleClick="BtnSelectLogFilePath" />
135+
<Button Margin="3" MinWidth="40" Grid.Column="2" Content="..." Click="BtnSelectLogFilePath" />
139136
</Grid>
140-
141137
</Grid>
142138

143139
</syncfusion:TabItemExt>

0 commit comments

Comments
 (0)