Skip to content

Commit

Permalink
(Un)register windows at the global windows manager of keepass
Browse files Browse the repository at this point in the history
  • Loading branch information
dannoe committed Apr 6, 2020
1 parent 813e54a commit 75ab859
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions KeeTrayTOTP/FormAbout.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions KeeTrayTOTP/FormAbout.cs
@@ -1,6 +1,7 @@
using System;
using System.Reflection;
using System.Windows.Forms;
using KeePass.UI;

namespace KeeTrayTOTP
{
Expand Down Expand Up @@ -32,6 +33,8 @@ internal FormAbout(KeeTrayTOTPExt plugin)
/// <param name="e"></param>
private void FormAbout_Load(object sender, EventArgs e)
{
GlobalWindowManager.AddWindow(this);

Text = Localization.Strings.About + @" - " + Localization.Strings.TrayTOTPPlugin;
ListViewAbout.Items[0].SubItems.Add(AssemblyTitle);
ListViewAbout.Items[1].SubItems.Add(AssemblyCompany);
Expand Down Expand Up @@ -151,5 +154,10 @@ internal string AssemblyCompany
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}

private void FormAbout_FormClosed(object sender, FormClosedEventArgs e)
{
GlobalWindowManager.RemoveWindow(this);
}
}
}
1 change: 1 addition & 0 deletions KeeTrayTOTP/FormSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions KeeTrayTOTP/FormSettings.cs
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using KeePass.UI;

namespace KeeTrayTOTP
{
Expand Down Expand Up @@ -43,6 +44,8 @@ internal FormSettings(KeeTrayTOTPExt plugin)
/// <param name="e"></param>
private void FormSettings_Load(object sender, EventArgs e)
{
GlobalWindowManager.AddWindow(this);

Text = Localization.Strings.Settings + @" - " + Localization.Strings.TrayTOTPPlugin; // Set form's name using constants.
Working(true, true); // Set controls depending on the state of action.
WorkerLoad.RunWorkerAsync(); // Load Settings in form controls.
Expand Down Expand Up @@ -479,5 +482,10 @@ private void WorkerReset_RunWorkerCompleted(object sender, RunWorkerCompletedEve
{
WorkerLoad.RunWorkerAsync("Reset");
}

private void FormSettings_FormClosed(object sender, FormClosedEventArgs e)
{
GlobalWindowManager.RemoveWindow(this);
}
}
}
1 change: 1 addition & 0 deletions KeeTrayTOTP/FormTimeCorrection.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions KeeTrayTOTP/FormTimeCorrection.cs
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using KeePass.UI;
using KeeTrayTOTP.Libraries;

namespace KeeTrayTOTP
Expand Down Expand Up @@ -48,6 +49,8 @@ internal FormTimeCorrection(KeeTrayTOTPExt plugin, string url)
/// <param name="e"></param>
private void FormTimeCorrection_Load(object sender, EventArgs e)
{
GlobalWindowManager.AddWindow(this);

Text = Localization.Strings.TimeCorrection + @" - " + Localization.Strings.TrayTOTPPlugin; //Sets the form's display text.
if (_plugin.PluginHost.MainWindow.ActiveDatabase.IsOpen)
{
Expand Down Expand Up @@ -200,5 +203,10 @@ private void ButtonCancel_Click(object sender, EventArgs e)
{
//Dialog Result = Cancel
}

private void FormTimeCorrection_FormClosed(object sender, FormClosedEventArgs e)
{
GlobalWindowManager.RemoveWindow(this);
}
}
}
1 change: 1 addition & 0 deletions KeeTrayTOTP/SetupTOTP.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions KeeTrayTOTP/SetupTOTP.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using KeePass.UI;
using KeePassLib;
using KeePassLib.Security;

Expand Down Expand Up @@ -31,6 +32,8 @@ internal SetupTOTP(KeeTrayTOTPExt plugin, PwEntry entry)

private void SetupTOTP_Load(object sender, EventArgs e)
{
GlobalWindowManager.AddWindow(this);

Text = Localization.Strings.Setup + @" - " + Localization.Strings.TrayTOTPPlugin; //Set form's name using constants.

if (_plugin.SettingsCheck(_entry) || _plugin.SeedCheck(_entry)) //Checks the the totp settings exists.
Expand Down Expand Up @@ -229,5 +232,10 @@ private void ButtonDelete_Click(object sender, EventArgs e)
Close();
}
}

private void SetupTOTP_FormClosed(object sender, FormClosedEventArgs e)
{
GlobalWindowManager.RemoveWindow(this);
}
}
}
1 change: 1 addition & 0 deletions KeeTrayTOTP/ShowQR.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions KeeTrayTOTP/ShowQR.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using KeePass.UI;
using QRCoder;

namespace KeeTrayTOTP
Expand All @@ -15,6 +16,8 @@ public ShowQR()

private void ShowQR_Load(object sender, EventArgs e)
{
GlobalWindowManager.AddWindow(this);

GenerateQRCode();
}

Expand Down Expand Up @@ -48,5 +51,10 @@ protected override bool ProcessDialogKey(Keys keyData)

return base.ProcessDialogKey(keyData);
}

private void ShowQR_FormClosed(object sender, FormClosedEventArgs e)
{
GlobalWindowManager.RemoveWindow(this);
}
}
}

0 comments on commit 75ab859

Please sign in to comment.