This repository has been archived on 2025-09-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Password-Manager-Legacy/Password Manager/MainForm.cs

43 lines
1.8 KiB
C#
Raw Normal View History

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
public override event ProfileDataRequest CurrentProfilePathRequest;
public override event ProfileDataRequest CurrentProfileNameRequest;
public override event ProfileList CurrentProfileListRequest;
public override event ProfileChange CurrentProfileChanged;
public override event Save SaveRequest;
public override event NewProfile NewProfileRequest;
public MainForm(ProfileDataRequest CurrentProfileNameRequest, ProfileDataRequest CurrentProfilePathRequest, ProfileList CurrentProfileListRequest, ProfileChange CurrentProfileChanged, Save SaveRequest, NewProfile NewProfileRequest)
: base(CurrentProfileNameRequest, CurrentProfilePathRequest, CurrentProfileListRequest, CurrentProfileChanged, SaveRequest, NewProfileRequest)
2023-03-24 10:17:54 +01:00
{
InitializeComponent();
2023-03-27 09:17:06 +02:00
RefreshCurrentProfile();
SaveRequest();
2023-03-27 00:19:30 +02: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-24 10:17:54 +01:00
}
}