Skip to content

Commit

Permalink
Added comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
krisdb2009 committed Jan 26, 2020
1 parent 4da69ec commit 7915b84
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
35 changes: 35 additions & 0 deletions SuperGrate/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ private void lbxUsers_KeyDown(object sender, KeyEventArgs e)
btnStartStop.PerformClick();
}
}
/// <summary>
/// This event will fire when the miHelpButton menu item is clicked, and will toggle the help on hover function in the main window.
/// </summary>
private void miHelpButton_Click(object sender, EventArgs e)
{
if (Cursor == Cursors.Help)
Expand All @@ -420,10 +423,16 @@ private void miHelpButton_Click(object sender, EventArgs e)
Cursor = Cursors.Help;
}
}
/// <summary>
/// This event will fire when the miNewInstance menu item is clicked and will start a new instance of Super Grate.
/// </summary>
private void miNewInstance_Click(object sender, EventArgs e)
{
Process.Start(Application.ExecutablePath);
}
/// <summary>
/// This event fires when the miAddRemoveCol menu item is clicked, and will display the column selection dialog box.
/// </summary>
private void miAddRemoveCol_Click(object sender, EventArgs e)
{
string SettingKey = "";
Expand Down Expand Up @@ -480,6 +489,9 @@ private void miAddRemoveCol_Click(object sender, EventArgs e)
}
}
}
/// <summary>
/// This event will open the User Properties dialog box.
/// </summary>
private async void OpenUserProperties_Event(object sender, EventArgs e)
{
if(listUsers.SelectedItems.Count == 1)
Expand Down Expand Up @@ -509,10 +521,16 @@ private async void OpenUserProperties_Event(object sender, EventArgs e)
new UserProperties(template, row).ShowDialog();
}
}
/// <summary>
/// This event fires when the menu item miSettings is clicked. It will show the settings menu dialog box.
/// </summary>
private void miSettings_Click(object sender, EventArgs e)
{
new Settings().ShowDialog();
}
/// <summary>
/// This event fires when view mode menu items are clicked. It will apply the settings and the new view mode the list box "listUsers".
/// </summary>
private void miViewMode_Click(object sender, EventArgs e)
{
MenuItem mi = (MenuItem)sender;
Expand All @@ -530,6 +548,9 @@ private void miViewMode_Click(object sender, EventArgs e)
listUsers.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
}
/// <summary>
/// This event fires before the miView menu is shown, and determines what menu items are checked based on current settings.
/// </summary>
private void miView_Popup(object sender, EventArgs e)
{
View ViewMode = ULControl.ParseViewMode(Config.Settings["ULViewMode"]);
Expand All @@ -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;
}
/// <summary>
/// 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.
/// </summary>
private void listUsers_ColumnClick(object sender, ColumnClickEventArgs e)
{
ULColumnType selColumn = (ULColumnType)listUsers.Columns[e.Column].Tag;
Expand All @@ -558,6 +583,10 @@ private void listUsers_ColumnClick(object sender, ColumnClickEventArgs e)
CurrentSortColumn[CurrentListSource] = selColumn;
listUsers.SetRows(CurrentUserRows, CurrentSortColumn[CurrentListSource], CurrentSortDirection[CurrentListSource]);
}
/// <summary>
/// Event fired when user right clicks the listUsers control.
/// The method will display a context menu at the user's mouse.
/// </summary>
private void listUsers_MouseClick(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
Expand All @@ -574,12 +603,18 @@ private void listUsers_MouseClick(object sender, MouseEventArgs e)
}
}
}
/// <summary>
/// Enum of user sources that can be displayed in Super Grate.
/// </summary>
public enum ListSources
{
Unknown = -1,
SourceComputer = 1,
MigrationStore = 2
}
/// <summary>
/// Enum of tasks that can be running in Super Grate.
/// </summary>
public enum RunningTask
{
Unknown = -2,
Expand Down
6 changes: 3 additions & 3 deletions SuperGrate/Program.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,6 +18,9 @@ static void Main(string[] parameters)
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.Run(new Main(parameters));
}
/// <summary>
/// Thread Exception event for uncaught UI errors.
/// </summary>
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
Logger.Error("\r-----------FATAL ERROR-----------\r", true);
Expand Down

0 comments on commit 7915b84

Please sign in to comment.