add BeforeStartInternal event
This commit is contained in:
parent
30bde5d2cd
commit
c275c017c1
@ -1,4 +1,6 @@
|
|||||||
namespace MBS.Core;
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace MBS.Core;
|
||||||
|
|
||||||
public class Application
|
public class Application
|
||||||
{
|
{
|
||||||
@ -25,9 +27,21 @@ public class Application
|
|||||||
return e.ExitCode;
|
return e.ExitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler<CancelEventArgs> BeforeStartInternal;
|
||||||
|
protected virtual void OnBeforeStartInternal(CancelEventArgs e)
|
||||||
|
{
|
||||||
|
BeforeStartInternal?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
public int Start()
|
public int Start()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
|
CancelEventArgs e = new CancelEventArgs();
|
||||||
|
OnBeforeStartInternal(e);
|
||||||
|
if (e.Cancel)
|
||||||
|
return 2;
|
||||||
|
|
||||||
int exitCode = StartInternal();
|
int exitCode = StartInternal();
|
||||||
|
|
||||||
Instance = null;
|
Instance = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user