Skip to content

Commit

Permalink
* Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDead committed Apr 4, 2018
1 parent 4a7ee77 commit eb88f03
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 29 deletions.
13 changes: 11 additions & 2 deletions MemPlus/Business/UTILS/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal static void RunAsAdministrator(LogController logController)
/// <summary>
/// Retrieve RAM information
/// </summary>
/// <returns>A list of RAM information</returns>
/// <returns>A list of RamStick objects</returns>
internal static List<RamStick> GetRamSticks()
{
List<RamStick> ramSticks = new List<RamStick>();
Expand Down Expand Up @@ -231,7 +231,7 @@ internal static void ExportProcessDetails(LogController logController)
/// Retrieve a list of ProcessDetail objects
/// </summary>
/// <param name="logController">The LogController object that can be used to add logs</param>
/// <returns></returns>
/// <returns>A list of ProcessDetail objects that are currently available</returns>
internal static List<ProcessDetail> GetProcessDetails(LogController logController)
{
logController.AddLog(new ProcessLog("Retrieving process details"));
Expand All @@ -257,5 +257,14 @@ internal static List<ProcessDetail> GetProcessDetails(LogController logControlle
logController.AddLog(new ProcessLog("Done retrieving process details"));
return processDetailsList;
}

/// <summary>
/// Check if the program starts automatically.
/// </summary>
/// <returns>A boolean to represent whether the program starts automatically or not.</returns>
internal static bool AutoStartUp()
{
return Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "MemPlus", "").ToString() == Assembly.GetExecutingAssembly().Location;
}
}
}
18 changes: 9 additions & 9 deletions MemPlus/Views/Windows/LogWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void OnMouseDown(object sender, MouseButtonEventArgs e)
}

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

/// <summary>
/// Method that will be called when a Log object was removed
/// Method that is called when a Log object was removed
/// </summary>
/// <param name="log">The Log object that was removed</param>
private void LogDeletedEvent(Log log)
Expand All @@ -139,7 +139,7 @@ private void LogDeletedEvent(Log log)
}

/// <summary>
/// Method that will be called when all logs were removed
/// Method that is called when all logs were removed
/// </summary>
private void LogsClearedEvent()
{
Expand All @@ -150,7 +150,7 @@ private void LogsClearedEvent()
}

/// <summary>
/// Method that will be called when a Log object was added
/// Method that is called when a Log object was added
/// </summary>
/// <param name="log">The Log object that was added</param>
private void LogAddedEvent(Log log)
Expand Down Expand Up @@ -189,7 +189,7 @@ private void LsvLogs_OnScroll(object sender, ScrollEventArgs e)
}

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

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

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

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

/// <summary>
/// Event that is called when the mouse wheel is used
/// Method that is called when the mouse wheel is used
/// </summary>
/// <param name="sender">The object that called this method</param>
/// <param name="e">The MouseWheelEventArgs</param>
Expand Down
6 changes: 3 additions & 3 deletions MemPlus/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public MainWindow()
}

/// <summary>
/// Event that is called when the GUI statistics should be updated
/// Method that is called when the GUI statistics should be updated
/// </summary>
private void UpdateGuiStatistics()
{
Expand All @@ -141,7 +141,7 @@ private void UpdateGuiStatistics()
}

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

/// <inheritdoc />
/// <summary>
/// Event that is called when the source is initialized
/// Method that is called when the source is initialized
/// </summary>
/// <param name="e">The EventArgs</param>
protected override void OnSourceInitialized(EventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions MemPlus/Views/Windows/ProcessAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void OnMouseDown(object sender, MouseButtonEventArgs e)
}

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

/// <summary>
/// Method that will be called when all ProcessDetail objects should be exported
/// Method that is called when all ProcessDetail objects should be exported
/// </summary>
/// <param name="sender">The object that called this method</param>
/// <param name="e">The RoutedEventArgs</param>
Expand Down Expand Up @@ -134,7 +134,7 @@ private void RefreshProcessDetails()
}

/// <summary>
/// Method that will be called when a ProcessDetail object should be copied to the clipboard
/// Method that is called when a ProcessDetail object should be copied to the clipboard
/// </summary>
/// <param name="sender">The object that called this method</param>
/// <param name="e">The RoutedEventArgs</param>
Expand Down
21 changes: 9 additions & 12 deletions MemPlus/Views/Windows/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Windows.Interop;
using MemPlus.Business.GUI;
using MemPlus.Business.LOG;
using MemPlus.Business.UTILS;
using Microsoft.Win32;

namespace MemPlus.Views.Windows
Expand Down Expand Up @@ -78,7 +79,7 @@ private void LoadProperties()
try
{
//General
ChbAutoStart.IsChecked = AutoStartUp();
ChbAutoStart.IsChecked = Utils.AutoStartUp();
ChbAutoUpdate.IsChecked = Properties.Settings.Default.AutoUpdate;
ChbStartHidden.IsChecked = Properties.Settings.Default.HideOnStart;
ChbHideOnClose.IsChecked = Properties.Settings.Default.HideOnClose;
Expand Down Expand Up @@ -200,15 +201,6 @@ private void OnMouseDown(object sender, MouseButtonEventArgs e)
}
}

/// <summary>
/// Check if the program starts automatically.
/// </summary>
/// <returns>A boolean to represent whether the program starts automatically or not.</returns>
private static bool AutoStartUp()
{
return Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "MemPlus", "").ToString() == System.Reflection.Assembly.GetExecutingAssembly().Location;
}

/// <summary>
/// Save all properties
/// </summary>
Expand Down Expand Up @@ -376,7 +368,7 @@ private void BtnReset_OnClick(object sender, RoutedEventArgs e)
}

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

/// <summary>
/// Method that is called when the user is pressing a key on the textbox
/// </summary>
/// <param name="sender">The object that called this method</param>
/// <param name="e">The KeyEventArgs</param>
private void TxtHotKey_PreviewKeyDown(object sender, KeyEventArgs e)
{
e.Handled = true;
Key key = (e.Key == Key.System ? e.SystemKey : e.Key);
Key key = e.Key == Key.System ? e.SystemKey : e.Key;

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)
{
Expand Down

0 comments on commit eb88f03

Please sign in to comment.