Skip to content

Commit

Permalink
Cleanup forms initialization (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinvanpoppel committed Apr 11, 2020
1 parent 0617625 commit 1b44a2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
8 changes: 1 addition & 7 deletions KeeTrayTOTP/FormAbout.cs
Expand Up @@ -10,18 +10,12 @@ namespace KeeTrayTOTP
/// </summary>
internal partial class FormAbout : Form
{
/// <summary>
/// Plugin Host.
/// </summary>
private readonly KeeTrayTOTPExt _plugin;

/// <summary>
/// Windows Form Constructor.
/// </summary>
/// <param name="plugin">Plugin Host.</param>
internal FormAbout(KeeTrayTOTPExt plugin)
internal FormAbout()
{
_plugin = plugin;
InitializeComponent();
}

Expand Down
7 changes: 1 addition & 6 deletions KeeTrayTOTP/FormHelp.cs
Expand Up @@ -9,10 +9,6 @@ namespace KeeTrayTOTP
/// </summary>
internal partial class FormHelp : Form
{
/// <summary>
/// Plugin Host.
/// </summary>
private readonly KeeTrayTOTPExt _plugin;
/// <summary>
/// Getting started flag.
/// </summary>
Expand All @@ -23,9 +19,8 @@ internal partial class FormHelp : Form
/// </summary>
/// <param name="plugin">Plugin Host.</param>
/// <param name="gettingStarted">Getting Started Display Flag.</param>
internal FormHelp(KeeTrayTOTPExt plugin, bool gettingStarted = false)
internal FormHelp(bool gettingStarted = false)
{
_plugin = plugin;
_gettingStarted = gettingStarted;
InitializeComponent();
}
Expand Down
10 changes: 4 additions & 6 deletions KeeTrayTOTP/TrayTOTP_Plugin.cs
Expand Up @@ -244,7 +244,7 @@ public override bool Initialize(IPluginHost host)
PluginHost = host;

// Instantiate Help Form.
_helpForm = new FormHelp(this);
_helpForm = new FormHelp();

// Register events.
PluginHost.MainWindow.Shown += MainWindow_Shown;
Expand Down Expand Up @@ -302,7 +302,7 @@ private void MainWindow_Shown(object sender, EventArgs e)
PluginHost.CustomConfig.SetBool(setname_bool_FirstInstall_Shown, true);
if (!_helpForm.Visible)
{
_helpForm = new FormHelp(this, true);
_helpForm = new FormHelp(true);
_helpForm.Show();
}
else
Expand All @@ -319,8 +319,7 @@ private void MainWindow_Shown(object sender, EventArgs e)
/// <param name="e"></param>
private void OnMenuSettingsClick(object sender, EventArgs e)
{
var formSettings = new FormSettings(this);
UIUtil.ShowDialogAndDestroy(formSettings);
UIUtil.ShowDialogAndDestroy(new FormSettings(this));
}

/// <summary>
Expand All @@ -347,8 +346,7 @@ private void OnMenuHelpClick(object sender, EventArgs e)
/// <param name="e"></param>
private void OnMenuAboutClick(object sender, EventArgs e)
{
var formAbout = new FormAbout(this);
UIUtil.ShowDialogAndDestroy(formAbout);
UIUtil.ShowDialogAndDestroy(new FormAbout());
}

/// <summary>
Expand Down

0 comments on commit 1b44a2f

Please sign in to comment.