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 98eca30 commit df0d95f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
16 changes: 16 additions & 0 deletions SuperGrate/Controls/ChangeSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ namespace SuperGrate.Controls
public partial class ChangeSetting : Form
{
private string Setting = "";
/// <summary>
/// Entry point for the ChangeSetting class. This method will display a form with the selected setting and allow the user to change it's value.
/// </summary>
/// <param name="SettingToChange">The key name of the Config.Settings[] dictionary to change.</param>
public ChangeSetting(string SettingToChange)
{
InitializeComponent();
Expand All @@ -16,6 +20,9 @@ public ChangeSetting(string SettingToChange)
btnRestoreDefault.SetSystemIcon(Properties.Resources.reload);
Setting = SettingToChange;
}
/// <summary>
/// This event will fire when the changeSetting form has loaded. The method will fill in the selected information into the form's controls.
/// </summary>
private void ChangeSetting_Load(object sender, EventArgs e)
{
Text += Setting;
Expand All @@ -31,11 +38,17 @@ private void ChangeSetting_Load(object sender, EventArgs e)
}
tbComment.Text = lastComment + "\r\n\r\n" + "Default Value: " + Config.DefaultSettings[Setting];
}
/// <summary>
/// This event will fire when the btnSave button is clicked. The method will apply the setting to the session.
/// </summary>
private void BtnSave_Click(object sender, EventArgs e)
{
Config.Settings[Setting] = tbValue.Text;
DialogResult = DialogResult.OK;
}
/// <summary>
/// This event will fire when the tbValue text box gets an input. The method will simulate a click for the btnSave button if the enter key is pressed.
/// </summary>
private void TbValue_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
Expand All @@ -44,6 +57,9 @@ private void TbValue_KeyPress(object sender, KeyPressEventArgs e)
btnSave.PerformClick();
}
}
/// <summary>
/// This event will fire when the btnRestoreDefault button is clicked. The method will restore the default value for the setting.
/// </summary>
private void btnRestoreDefault_Click(object sender, EventArgs e)
{
tbValue.Text = Config.DefaultSettings[Setting];
Expand Down
6 changes: 6 additions & 0 deletions SuperGrate/Controls/ConfirmDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ namespace SuperGrate.Controls
{
public partial class ConfirmDialog : Form
{
/// <summary>
/// Entry point for the ConfirmDialog class. This method displays a Dialog box with a custom title, message, and icon.
/// </summary>
/// <param name="DialogTitle">Title text.</param>
/// <param name="DialogDescription">Main message text.</param>
/// <param name="DialogIcon">Icon to show in the dialog box.</param>
public ConfirmDialog(string DialogTitle, string DialogDescription = null, Icon DialogIcon = null)
{
InitializeComponent();
Expand Down
18 changes: 18 additions & 0 deletions SuperGrate/Controls/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace SuperGrate.Controls
{
public partial class Settings : Form
{
/// <summary>
/// This method is the entrypoint for the settings class.
/// </summary>
public Settings()
{
InitializeComponent();
Expand All @@ -15,11 +18,17 @@ public Settings()
btnRevert.SetSystemIcon(Properties.Resources.reload);
btnApply.SetSystemIcon(Properties.Resources.x);
}
/// <summary>
/// This event fires when the settings form loads. The method calls RefreshSettings.
/// </summary>
private void Settings_Load(object sender, EventArgs e)
{
RefreshSettings();
btnSave.Enabled = Config.CanSaveConfig();
}
/// <summary>
/// This method loads the Config.Settings dictionary into the settingsList.
/// </summary>
private void RefreshSettings()
{
settingsList.Items.Clear();
Expand All @@ -41,6 +50,9 @@ private void RefreshSettings()
}
settingsList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
}
/// <summary>
/// This event fires when the btnRevert button is clicked. The method re-loads the configuration on disk back into the settingsList control.
/// </summary>
private async void btnRevert_Click(object sender, EventArgs e)
{
btnRevert.Enabled = false;
Expand All @@ -54,6 +66,9 @@ private async void btnRevert_Click(object sender, EventArgs e)
btnRevert.Text = text;
btnRevert.Enabled = true;
}
/// <summary>
/// This event fires when the settingsList list is double clicked. The method opens the selected setting for editing.
/// </summary>
private void SettingsList_DoubleClick(object sender, EventArgs e)
{
if (settingsList.SelectedItems.Count != 0)
Expand All @@ -69,6 +84,9 @@ private void SettingsList_DoubleClick(object sender, EventArgs e)
btnApply.Focus();
}
}
/// <summary>
/// This event fires when the btnSave button is clicked. The method will attempt to save the configuration to disk.
/// </summary>
private async void BtnSave_Click(object sender, EventArgs e)
{
Config.SaveConfig();
Expand Down
5 changes: 5 additions & 0 deletions SuperGrate/Controls/UserProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ namespace SuperGrate.Controls
{
public partial class UserProperties : Form
{
/// <summary>
/// The entry point for the UserProperties form.
/// </summary>
/// <param name="Template">Template user rows to generate the "Properties" column.</param>
/// <param name="Row">The rows with data to fill in the "Values" column.</param>
public UserProperties(UserRow Template, UserRow Row)
{
InitializeComponent();
Expand Down

0 comments on commit df0d95f

Please sign in to comment.