Deleted everything profile related and started semi-fresh

This commit is contained in:
2023-03-27 10:24:40 +02:00
parent 60c6982663
commit 6dd08d15b5
17 changed files with 118 additions and 687 deletions

View File

@@ -1,51 +1,22 @@
using System.ComponentModel.Design;
namespace Password_Manager
{
sealed public partial class MainForm : PasswordManagerForm
sealed public partial class MainForm : Form
{
private void OpenProfileCreator(object sender, EventArgs e)
public event DataRequest PathRequest;
public MainForm(DataRequest PathRequest)
{
NewProfileForm npf = new NewProfileForm();
npf.ReloadMainFormRequest += () => RefreshCurrentProfile();
npf.SaveRequest += this.SaveRequest;
npf.NewProfileRequest += this.NewProfileRequest;
npf.ShowDialog();
this.PathRequest = PathRequest;
InitializeComponent();
ResultList = new PasswordListBox(PathRequest);
ResultList.ReloadResults();
}
private void OpenPasswordGenerator(object sender, EventArgs e)
{
string? tmp = CurrentProfilePathRequest();
if (tmp != null)
{
GeneratePassword gp = new GeneratePassword(SearchBox.Text, tmp);
gp.ShowDialog();
}
else
{
MessageBox.Show("No path specified", "Event error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
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();
GeneratePassword gp = new GeneratePassword(SearchBox.Text, PathRequest());
gp.ShowDialog();
}
}
}