Skip to content

Commit eb88f03

Browse files
committed
* Code cleanup
1 parent 4a7ee77 commit eb88f03

File tree

5 files changed

+35
-29
lines changed

5 files changed

+35
-29
lines changed

MemPlus/Business/UTILS/Utils.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ internal static void RunAsAdministrator(LogController logController)
6767
/// <summary>
6868
/// Retrieve RAM information
6969
/// </summary>
70-
/// <returns>A list of RAM information</returns>
70+
/// <returns>A list of RamStick objects</returns>
7171
internal static List<RamStick> GetRamSticks()
7272
{
7373
List<RamStick> ramSticks = new List<RamStick>();
@@ -231,7 +231,7 @@ internal static void ExportProcessDetails(LogController logController)
231231
/// Retrieve a list of ProcessDetail objects
232232
/// </summary>
233233
/// <param name="logController">The LogController object that can be used to add logs</param>
234-
/// <returns></returns>
234+
/// <returns>A list of ProcessDetail objects that are currently available</returns>
235235
internal static List<ProcessDetail> GetProcessDetails(LogController logController)
236236
{
237237
logController.AddLog(new ProcessLog("Retrieving process details"));
@@ -257,5 +257,14 @@ internal static List<ProcessDetail> GetProcessDetails(LogController logControlle
257257
logController.AddLog(new ProcessLog("Done retrieving process details"));
258258
return processDetailsList;
259259
}
260+
261+
/// <summary>
262+
/// Check if the program starts automatically.
263+
/// </summary>
264+
/// <returns>A boolean to represent whether the program starts automatically or not.</returns>
265+
internal static bool AutoStartUp()
266+
{
267+
return Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "MemPlus", "").ToString() == Assembly.GetExecutingAssembly().Location;
268+
}
260269
}
261270
}

MemPlus/Views/Windows/LogWindow.xaml.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void OnMouseDown(object sender, MouseButtonEventArgs e)
100100
}
101101

102102
/// <summary>
103-
/// Method that will be called when all logs of a certain type have been cleared
103+
/// Method that is called when all logs of a certain type have been cleared
104104
/// </summary>
105105
/// <param name="clearedList">The list of Log objects that were removed</param>
106106
private void LogTypeClearedEvent(List<Log> clearedList)
@@ -126,7 +126,7 @@ private void FillLogView()
126126
}
127127

128128
/// <summary>
129-
/// Method that will be called when a Log object was removed
129+
/// Method that is called when a Log object was removed
130130
/// </summary>
131131
/// <param name="log">The Log object that was removed</param>
132132
private void LogDeletedEvent(Log log)
@@ -139,7 +139,7 @@ private void LogDeletedEvent(Log log)
139139
}
140140

141141
/// <summary>
142-
/// Method that will be called when all logs were removed
142+
/// Method that is called when all logs were removed
143143
/// </summary>
144144
private void LogsClearedEvent()
145145
{
@@ -150,7 +150,7 @@ private void LogsClearedEvent()
150150
}
151151

152152
/// <summary>
153-
/// Method that will be called when a Log object was added
153+
/// Method that is called when a Log object was added
154154
/// </summary>
155155
/// <param name="log">The Log object that was added</param>
156156
private void LogAddedEvent(Log log)
@@ -189,7 +189,7 @@ private void LsvLogs_OnScroll(object sender, ScrollEventArgs e)
189189
}
190190

191191
/// <summary>
192-
/// Method that will be called when all logs of a certain type should be cleared
192+
/// Method that is called when all logs of a certain type should be cleared
193193
/// </summary>
194194
/// <param name="sender">The object that called this method</param>
195195
/// <param name="e">The RoutedEventArgs</param>
@@ -199,7 +199,7 @@ private void BtnClear_OnClick(object sender, RoutedEventArgs e)
199199
}
200200

201201
/// <summary>
202-
/// Method that will be called when all Logs of a certain type should be exported
202+
/// Method that is called when all Logs of a certain type should be exported
203203
/// </summary>
204204
/// <param name="sender">The object that called this method</param>
205205
/// <param name="e">The RoutedEventArgs</param>
@@ -209,7 +209,7 @@ private void BtnExport_OnClick(object sender, RoutedEventArgs e)
209209
}
210210

211211
/// <summary>
212-
/// Method that will be called when a Log object should be removed
212+
/// Method that is called when a Log object should be removed
213213
/// </summary>
214214
/// <param name="sender">The object that called this method</param>
215215
/// <param name="e">The RoutedEventArgs</param>
@@ -220,7 +220,7 @@ private void DeleteMenuItem_OnClick(object sender, RoutedEventArgs e)
220220
}
221221

222222
/// <summary>
223-
/// Method that will be called when a Log object should be copied to the clipboard
223+
/// Method that is called when a Log object should be copied to the clipboard
224224
/// </summary>
225225
/// <param name="sender">The object that called this method</param>
226226
/// <param name="e">The RoutedEventArgs</param>
@@ -241,7 +241,7 @@ private void CopyMenuItem_OnClick(object sender, RoutedEventArgs e)
241241
}
242242

243243
/// <summary>
244-
/// Event that is called when the mouse wheel is used
244+
/// Method that is called when the mouse wheel is used
245245
/// </summary>
246246
/// <param name="sender">The object that called this method</param>
247247
/// <param name="e">The MouseWheelEventArgs</param>

MemPlus/Views/Windows/MainWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public MainWindow()
116116
}
117117

118118
/// <summary>
119-
/// Event that is called when the GUI statistics should be updated
119+
/// Method that is called when the GUI statistics should be updated
120120
/// </summary>
121121
private void UpdateGuiStatistics()
122122
{
@@ -141,7 +141,7 @@ private void UpdateGuiStatistics()
141141
}
142142

143143
/// <summary>
144-
/// Event that is called when a RAM clearing has occurred and statistics could be shown to the user
144+
/// Method that is called when a RAM clearing has occurred and statistics could be shown to the user
145145
/// </summary>
146146
private void RamClearingCompleted()
147147
{
@@ -226,7 +226,7 @@ internal void LoadProperties()
226226

227227
/// <inheritdoc />
228228
/// <summary>
229-
/// Event that is called when the source is initialized
229+
/// Method that is called when the source is initialized
230230
/// </summary>
231231
/// <param name="e">The EventArgs</param>
232232
protected override void OnSourceInitialized(EventArgs e)

MemPlus/Views/Windows/ProcessAnalyzerWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private void OnMouseDown(object sender, MouseButtonEventArgs e)
9090
}
9191

9292
/// <summary>
93-
/// Method that will be called when all ProcessDetail objects should be cleared
93+
/// Method that is called when all ProcessDetail objects should be cleared
9494
/// </summary>
9595
/// <param name="sender">The object that called this method</param>
9696
/// <param name="e">The RoutedEventArgs</param>
@@ -100,7 +100,7 @@ private void BtnClear_OnClick(object sender, RoutedEventArgs e)
100100
}
101101

102102
/// <summary>
103-
/// Method that will be called when all ProcessDetail objects should be exported
103+
/// Method that is called when all ProcessDetail objects should be exported
104104
/// </summary>
105105
/// <param name="sender">The object that called this method</param>
106106
/// <param name="e">The RoutedEventArgs</param>
@@ -134,7 +134,7 @@ private void RefreshProcessDetails()
134134
}
135135

136136
/// <summary>
137-
/// Method that will be called when a ProcessDetail object should be copied to the clipboard
137+
/// Method that is called when a ProcessDetail object should be copied to the clipboard
138138
/// </summary>
139139
/// <param name="sender">The object that called this method</param>
140140
/// <param name="e">The RoutedEventArgs</param>

MemPlus/Views/Windows/SettingsWindow.xaml.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Windows.Interop;
88
using MemPlus.Business.GUI;
99
using MemPlus.Business.LOG;
10+
using MemPlus.Business.UTILS;
1011
using Microsoft.Win32;
1112

1213
namespace MemPlus.Views.Windows
@@ -78,7 +79,7 @@ private void LoadProperties()
7879
try
7980
{
8081
//General
81-
ChbAutoStart.IsChecked = AutoStartUp();
82+
ChbAutoStart.IsChecked = Utils.AutoStartUp();
8283
ChbAutoUpdate.IsChecked = Properties.Settings.Default.AutoUpdate;
8384
ChbStartHidden.IsChecked = Properties.Settings.Default.HideOnStart;
8485
ChbHideOnClose.IsChecked = Properties.Settings.Default.HideOnClose;
@@ -200,15 +201,6 @@ private void OnMouseDown(object sender, MouseButtonEventArgs e)
200201
}
201202
}
202203

203-
/// <summary>
204-
/// Check if the program starts automatically.
205-
/// </summary>
206-
/// <returns>A boolean to represent whether the program starts automatically or not.</returns>
207-
private static bool AutoStartUp()
208-
{
209-
return Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "MemPlus", "").ToString() == System.Reflection.Assembly.GetExecutingAssembly().Location;
210-
}
211-
212204
/// <summary>
213205
/// Save all properties
214206
/// </summary>
@@ -376,7 +368,7 @@ private void BtnReset_OnClick(object sender, RoutedEventArgs e)
376368
}
377369

378370
/// <summary>
379-
/// Method that will be called when all properties should be saved
371+
/// Method that is called when all properties should be saved
380372
/// </summary>
381373
/// <param name="sender">The object that called this method</param>
382374
/// <param name="e">The RoutedEventArgs</param>
@@ -521,10 +513,15 @@ private void SldWindowResize_OnValueChanged(object sender, RoutedPropertyChanged
521513
ResizeBorderThickness = new Thickness(SldWindowResize.Value);
522514
}
523515

516+
/// <summary>
517+
/// Method that is called when the user is pressing a key on the textbox
518+
/// </summary>
519+
/// <param name="sender">The object that called this method</param>
520+
/// <param name="e">The KeyEventArgs</param>
524521
private void TxtHotKey_PreviewKeyDown(object sender, KeyEventArgs e)
525522
{
526523
e.Handled = true;
527-
Key key = (e.Key == Key.System ? e.SystemKey : e.Key);
524+
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
528525

529526
if (key == Key.Back || key == Key.LeftShift || key == Key.RightShift || key == Key.LeftCtrl || key == Key.RightCtrl || key == Key.LeftAlt || key == Key.RightAlt || key == Key.LWin || key == Key.RWin)
530527
{

0 commit comments

Comments
 (0)