From 7915b8441e6a30702a3086663c3f7b196709a5ac Mon Sep 17 00:00:00 2001 From: Dylan Bickerstaff Date: Sat, 25 Jan 2020 22:37:15 -0500 Subject: [PATCH] Added comments. --- SuperGrate/Main.cs | 35 +++++++++++++++++++++++++++++++++++ SuperGrate/Program.cs | 6 +++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/SuperGrate/Main.cs b/SuperGrate/Main.cs index e338e12..8635983 100644 --- a/SuperGrate/Main.cs +++ b/SuperGrate/Main.cs @@ -407,6 +407,9 @@ private void lbxUsers_KeyDown(object sender, KeyEventArgs e) btnStartStop.PerformClick(); } } + /// + /// This event will fire when the miHelpButton menu item is clicked, and will toggle the help on hover function in the main window. + /// private void miHelpButton_Click(object sender, EventArgs e) { if (Cursor == Cursors.Help) @@ -420,10 +423,16 @@ private void miHelpButton_Click(object sender, EventArgs e) Cursor = Cursors.Help; } } + /// + /// This event will fire when the miNewInstance menu item is clicked and will start a new instance of Super Grate. + /// private void miNewInstance_Click(object sender, EventArgs e) { Process.Start(Application.ExecutablePath); } + /// + /// This event fires when the miAddRemoveCol menu item is clicked, and will display the column selection dialog box. + /// private void miAddRemoveCol_Click(object sender, EventArgs e) { string SettingKey = ""; @@ -480,6 +489,9 @@ private void miAddRemoveCol_Click(object sender, EventArgs e) } } } + /// + /// This event will open the User Properties dialog box. + /// private async void OpenUserProperties_Event(object sender, EventArgs e) { if(listUsers.SelectedItems.Count == 1) @@ -509,10 +521,16 @@ private async void OpenUserProperties_Event(object sender, EventArgs e) new UserProperties(template, row).ShowDialog(); } } + /// + /// This event fires when the menu item miSettings is clicked. It will show the settings menu dialog box. + /// private void miSettings_Click(object sender, EventArgs e) { new Settings().ShowDialog(); } + /// + /// This event fires when view mode menu items are clicked. It will apply the settings and the new view mode the list box "listUsers". + /// private void miViewMode_Click(object sender, EventArgs e) { MenuItem mi = (MenuItem)sender; @@ -530,6 +548,9 @@ private void miViewMode_Click(object sender, EventArgs e) listUsers.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } } + /// + /// This event fires before the miView menu is shown, and determines what menu items are checked based on current settings. + /// private void miView_Popup(object sender, EventArgs e) { View ViewMode = ULControl.ParseViewMode(Config.Settings["ULViewMode"]); @@ -540,6 +561,10 @@ private void miView_Popup(object sender, EventArgs e) if (ViewMode == View.SmallIcon) miViewSmall.Checked = true; if (ViewMode == View.Tile) miViewTile.Checked = true; } + /// + /// Event fired when a user clicks a column button (Sort Button) in the listUsers control. + /// This method toggles the sort direction for each column in each list mode. + /// private void listUsers_ColumnClick(object sender, ColumnClickEventArgs e) { ULColumnType selColumn = (ULColumnType)listUsers.Columns[e.Column].Tag; @@ -558,6 +583,10 @@ private void listUsers_ColumnClick(object sender, ColumnClickEventArgs e) CurrentSortColumn[CurrentListSource] = selColumn; listUsers.SetRows(CurrentUserRows, CurrentSortColumn[CurrentListSource], CurrentSortDirection[CurrentListSource]); } + /// + /// Event fired when user right clicks the listUsers control. + /// The method will display a context menu at the user's mouse. + /// private void listUsers_MouseClick(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) @@ -574,12 +603,18 @@ private void listUsers_MouseClick(object sender, MouseEventArgs e) } } } + /// + /// Enum of user sources that can be displayed in Super Grate. + /// public enum ListSources { Unknown = -1, SourceComputer = 1, MigrationStore = 2 } + /// + /// Enum of tasks that can be running in Super Grate. + /// public enum RunningTask { Unknown = -2, diff --git a/SuperGrate/Program.cs b/SuperGrate/Program.cs index 43cbe1d..e98309a 100644 --- a/SuperGrate/Program.cs +++ b/SuperGrate/Program.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; namespace SuperGrate @@ -21,6 +18,9 @@ static void Main(string[] parameters) Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.Run(new Main(parameters)); } + /// + /// Thread Exception event for uncaught UI errors. + /// private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { Logger.Error("\r-----------FATAL ERROR-----------\r", true);