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/NewProfileForm.cs
2023-03-27 00:19:30 +02:00

44 lines
1.3 KiB
C#

namespace Password_Manager
{
public delegate void NewProfile(string profileName, string profilePath);
public delegate void ReloadPasswords();
public partial class NewProfileForm : Form
{
public event NewProfile NewProfileRequest;
public event ReloadPasswords ReloadPasswordsRequest;
public NewProfileForm()
{
InitializeComponent();
}
private void ChooseFolder(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
pathTextBox.Text = dialog.SelectedPath;
}
}
private void Save(object sender, EventArgs e)
{
if (nameTextBox.Text != "" && pathTextBox.Text != "")
{
NewProfileRequest?.Invoke(nameTextBox.Text, pathTextBox.Text);
ReloadPasswordsRequest?.Invoke();
this.Close();
}
else
{
MessageBox.Show("You must fill in all fields to continue.", "Error: Empty fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Cancel(object sender, EventArgs e)
{
this.Close();
}
}
}