add some convenience to enable single-line (new xxxApplication()).Start() paradigm
This commit is contained in:
parent
c275c25d0a
commit
83051d779f
@ -95,13 +95,19 @@ namespace MBS.Framework
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Initialized { get; private set; } = false;
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerNonUserCode()]
|
[System.Diagnostics.DebuggerNonUserCode()]
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
|
if (Initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ShortName == null)
|
if (ShortName == null)
|
||||||
throw new ArgumentException("must specify a ShortName for the application");
|
throw new ArgumentException("must specify a ShortName for the application");
|
||||||
|
|
||||||
InitializeInternal();
|
InitializeInternal();
|
||||||
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual int StartInternal()
|
protected virtual int StartInternal()
|
||||||
@ -110,6 +116,11 @@ namespace MBS.Framework
|
|||||||
}
|
}
|
||||||
public int Start()
|
public int Start()
|
||||||
{
|
{
|
||||||
|
if (Application.Instance == null)
|
||||||
|
Application.Instance = this;
|
||||||
|
|
||||||
|
Initialize();
|
||||||
|
|
||||||
int exitCode = StartInternal();
|
int exitCode = StartInternal();
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user