2023-03-27 09:30:41 +02:00
|
|
|
using System.ComponentModel.Design;
|
|
|
|
|
|
2023-03-24 10:17:54 +01:00
|
|
|
namespace Password_Manager
|
|
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
sealed public partial class MainForm : PasswordManagerForm
|
2023-03-24 10:17:54 +01:00
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
private void OpenProfileCreator(object sender, EventArgs e)
|
2023-03-27 00:19:30 +02:00
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
NewProfileForm npf = new NewProfileForm();
|
|
|
|
|
npf.ReloadMainFormRequest += () => RefreshCurrentProfile();
|
|
|
|
|
npf.SaveRequest += this.SaveRequest;
|
|
|
|
|
npf.NewProfileRequest += this.NewProfileRequest;
|
|
|
|
|
npf.ShowDialog();
|
2023-03-24 10:17:54 +01:00
|
|
|
}
|
2023-03-24 11:14:49 +01:00
|
|
|
|
2023-03-27 09:17:06 +02:00
|
|
|
private void OpenPasswordGenerator(object sender, EventArgs e)
|
2023-03-24 11:14:49 +01:00
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
string? tmp = CurrentProfilePathRequest();
|
|
|
|
|
if (tmp != null)
|
2023-03-27 00:19:30 +02:00
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
GeneratePassword gp = new GeneratePassword(SearchBox.Text, tmp);
|
|
|
|
|
gp.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("No path specified", "Event error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2023-03-27 00:19:30 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-03-27 09:30:41 +02:00
|
|
|
|
|
|
|
|
protected override void ChangeProfile(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CurrentProfileChanged(ProfileSelection.Text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void RefreshCurrentProfile()
|
|
|
|
|
{
|
|
|
|
|
ProfileSelection.SelectedIndex = -1;
|
|
|
|
|
string[] items = CurrentProfileListRequest();
|
|
|
|
|
for (int i = 0; i < items.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
ProfileSelection.Items.Add(items[i]);
|
|
|
|
|
if (items[i] == CurrentProfileNameRequest())
|
|
|
|
|
{
|
|
|
|
|
ProfileSelection.SelectedIndex = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.Text = CurrentProfileNameRequest();
|
|
|
|
|
ResultList.ReloadResults();
|
|
|
|
|
}
|
2023-03-24 10:17:54 +01:00
|
|
|
}
|
|
|
|
|
}
|