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

46 lines
1.3 KiB
C#
Raw Normal View History

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()
{
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
}
}