51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Password_Manager
|
|
{
|
|
public partial class NewProfileForm : Form
|
|
{
|
|
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 != "")
|
|
{
|
|
Profile profile = new Profile(nameTextBox.Text, pathTextBox.Text);
|
|
ProfileHandler.ListOfProfiles.Add(profile);
|
|
ProfileHandler.CurrentProfile = profile;
|
|
Program.mainForm.resultList.ReloadResults();
|
|
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();
|
|
}
|
|
}
|
|
}
|