本文整理汇总了C#中IApplication.Start方法的典型用法代码示例。如果您正苦于以下问题:C# IApplication.Start方法的具体用法?C# IApplication.Start怎么用?C# IApplication.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplication
的用法示例。
在下文中一共展示了IApplication.Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartApplication
private static async Task<bool> StartApplication(IApplication application)
{
if (!await application.Start())
{
Trace.TraceError("Could not start application {0}", application.Identity);
return false;
}
Trace.TraceInformation("Successfully started application {0}", application.Identity);
return true;
}
示例2: Run
/// <summary>
/// Runs the specified application.
/// </summary>
/// <param name="app">The application.</param>
/// <param name="args">The arguments.</param>
public static void Run(IApplication app, string[] args)
{
// deployment
app.Deployment = (System.Diagnostics.Debugger.IsAttached) ? Deployment.Production : Deployment.Release;
// start
app.Start();
// set current
currentApp = app;
// stop on process exit
AppDomain.CurrentDomain.ProcessExit += delegate(object sender, EventArgs e) {
if (app.Running)
app.Stop();
};
// loop
while (true) {
string command = Console.ReadLine();
if (command == "quit" || command == "exit")
return;
else if (command == "clear")
Console.Clear();
}
}