2023-03-27 00:19:30 +02:00
|
|
|
|
namespace Password_Manager
|
2023-03-24 13:01:49 +01:00
|
|
|
|
{
|
2023-03-27 00:19:30 +02:00
|
|
|
|
public delegate void ReloadPasswords();
|
2023-03-24 13:01:49 +01:00
|
|
|
|
public partial class NewProfileForm : Form
|
|
|
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
|
public event NewProfile? NewProfileRequest;
|
|
|
|
|
|
public event ReloadPasswords? ReloadMainFormRequest;
|
|
|
|
|
|
public event Save? SaveRequest;
|
2023-03-27 00:19:30 +02:00
|
|
|
|
|
2023-03-24 13:01:49 +01:00
|
|
|
|
public NewProfileForm()
|
|
|
|
|
|
{
|
2023-03-27 09:17:06 +02:00
|
|
|
|
//test
|
|
|
|
|
|
MessageBox.Show(this.Parent.Text, this.Parent.Text);
|
2023-03-24 13:01:49 +01:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ChooseFolder(object sender, EventArgs e)
|
2023-03-24 14:03:09 +01:00
|
|
|
|
{
|
2023-03-24 13:01:49 +01:00
|
|
|
|
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
|
|
|
|
|
if (dialog.ShowDialog() == DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
pathTextBox.Text = dialog.SelectedPath;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-03-24 14:03:09 +01:00
|
|
|
|
|
|
|
|
|
|
private void Save(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (nameTextBox.Text != "" && pathTextBox.Text != "")
|
|
|
|
|
|
{
|
2023-03-27 00:19:30 +02:00
|
|
|
|
NewProfileRequest?.Invoke(nameTextBox.Text, pathTextBox.Text);
|
2023-03-27 09:17:06 +02:00
|
|
|
|
ReloadMainFormRequest?.Invoke();
|
2023-03-24 14:03:09 +01:00
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("You must fill in all fields to continue.", "Error: Empty fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
|
}
|
2023-03-27 09:17:06 +02:00
|
|
|
|
|
|
|
|
|
|
SaveRequest?.Invoke();
|
2023-03-24 14:03:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Cancel(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
2023-03-24 13:01:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|