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

48 lines
1.4 KiB
C#

namespace Password_Manager
{
public delegate void ReloadPasswords();
public partial class NewProfileForm : Form
{
public event NewProfile? NewProfileRequest;
public event ReloadPasswords? ReloadMainFormRequest;
public event Save? SaveRequest;
public NewProfileForm()
{
//test
MessageBox.Show(this.Parent.Text, this.Parent.Text);
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);
ReloadMainFormRequest?.Invoke();
this.Close();
}
else
{
MessageBox.Show("You must fill in all fields to continue.", "Error: Empty fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
SaveRequest?.Invoke();
}
private void Cancel(object sender, EventArgs e)
{
this.Close();
}
}
}