Code refactoring
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
using Common;
|
||||
|
||||
namespace GUI;
|
||||
|
||||
sealed public partial class MainForm : Form
|
||||
{
|
||||
public event DataRequest PathRequest;
|
||||
public event DataRequest? RecipientRequest;
|
||||
public event DataRequest? RecipientRequest;
|
||||
|
||||
public MainForm(DataRequest PathRequest, DataRequest? RecipientRequest = null)
|
||||
{
|
||||
@@ -29,15 +28,15 @@ sealed public partial class MainForm : Form
|
||||
|
||||
private void OpenPasswordGenerator(object sender, EventArgs e)
|
||||
{
|
||||
if (RecipientRequest != null)
|
||||
{
|
||||
GeneratePassword gp = new GeneratePassword(PathRequest(), RecipientRequest(), ReloadResults, SearchBox.Text);
|
||||
gp.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("You cannot use the OpenPasswordGenerator method if you instantiated this form without a RecipientRequest event handler.");
|
||||
}
|
||||
if (RecipientRequest != null)
|
||||
{
|
||||
GeneratePassword gp = new GeneratePassword(PathRequest(), RecipientRequest(), ReloadResults, SearchBox.Text);
|
||||
gp.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("You cannot use the OpenPasswordGenerator method if you instantiated this form without a RecipientRequest event handler.");
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelPressed(object sender, EventArgs e)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user