Code refactoring
This commit is contained in:
@@ -1,16 +1,15 @@
|
|||||||
using Common;
|
using Common;
|
||||||
|
|
||||||
namespace GUI;
|
namespace GUI;
|
||||||
|
|
||||||
sealed public partial class MainForm : Form
|
sealed public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
public event DataRequest PathRequest;
|
public event DataRequest PathRequest;
|
||||||
public event DataRequest? RecipientRequest;
|
public event DataRequest? RecipientRequest;
|
||||||
|
|
||||||
public MainForm(DataRequest PathRequest, DataRequest? RecipientRequest = null)
|
public MainForm(DataRequest PathRequest, DataRequest? RecipientRequest = null)
|
||||||
{
|
{
|
||||||
this.PathRequest = PathRequest;
|
this.PathRequest = PathRequest;
|
||||||
this.RecipientRequest = RecipientRequest;
|
this.RecipientRequest = RecipientRequest;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
ResultList.SearchQueryRequest += () => SearchBox.Text;
|
ResultList.SearchQueryRequest += () => SearchBox.Text;
|
||||||
@@ -29,15 +28,15 @@ sealed public partial class MainForm : Form
|
|||||||
|
|
||||||
private void OpenPasswordGenerator(object sender, EventArgs e)
|
private void OpenPasswordGenerator(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (RecipientRequest != null)
|
if (RecipientRequest != null)
|
||||||
{
|
{
|
||||||
GeneratePassword gp = new GeneratePassword(PathRequest(), RecipientRequest(), ReloadResults, SearchBox.Text);
|
GeneratePassword gp = new GeneratePassword(PathRequest(), RecipientRequest(), ReloadResults, SearchBox.Text);
|
||||||
gp.ShowDialog();
|
gp.ShowDialog();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("You cannot use the OpenPasswordGenerator method if you instantiated this form without a RecipientRequest event handler.");
|
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)
|
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