using System.ComponentModel.Design; namespace Password_Manager { sealed public partial class MainForm : PasswordManagerForm { private void OpenProfileCreator(object sender, EventArgs e) { NewProfileForm npf = new NewProfileForm(); npf.ReloadMainFormRequest += () => RefreshCurrentProfile(); npf.SaveRequest += this.SaveRequest; npf.NewProfileRequest += this.NewProfileRequest; npf.ShowDialog(); } 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(); } } }