Making ProcessBuilder non-static
This commit is contained in:
@@ -5,12 +5,12 @@ namespace Password_Manager
|
|||||||
{
|
{
|
||||||
public delegate void ProcessSuccess();
|
public delegate void ProcessSuccess();
|
||||||
public delegate void ProcessFailure(Exception e);
|
public delegate void ProcessFailure(Exception e);
|
||||||
static class ProcessBuilder
|
sealed class ProcessBuilder
|
||||||
{
|
{
|
||||||
public event ProcessSuccess? ProcessFinished;
|
public event ProcessSuccess? ProcessFinished;
|
||||||
public event ProcessFailure? ProcessFailed;
|
public event ProcessFailure? ProcessFailed;
|
||||||
|
|
||||||
public static void Run(string procName, string args)
|
public void Run(string procName, string args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -25,12 +25,7 @@ namespace Password_Manager
|
|||||||
ClearDelegate()
|
ClearDelegate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearDelegate()
|
public string? GetOutput(string procName, string args)
|
||||||
{
|
|
||||||
//clear delegate because static
|
|
||||||
if (ProcessFinished != null)
|
|
||||||
{
|
|
||||||
foreach (ProcessSuccess p in ProcessFinished)
|
|
||||||
{
|
{
|
||||||
ProcessFinished -= p;
|
ProcessFinished -= p;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user