45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using Microsoft.Owin.Hosting;
|
|
using Step.UI;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Web;
|
|
using TeamDev.SDK;
|
|
using TeamDev.SDK.MVVM;
|
|
|
|
namespace Step
|
|
{
|
|
public class Application
|
|
{
|
|
|
|
public static readonly ManualResetEvent StopRequest = new ManualResetEvent(false);
|
|
|
|
public static int MessageService { get; private set; }
|
|
|
|
public static void Main()
|
|
{
|
|
// Start self host application
|
|
var configuredUri = ConfigurationManager.AppSettings["localHostServiceURI"];
|
|
|
|
// Start WinForm
|
|
ServerControlWindow.Start();
|
|
|
|
// Register listener to "close application" messages
|
|
MessageServices.Current.Subscribe("StopServer", (a, b) =>
|
|
{
|
|
StopRequest.Set();
|
|
});
|
|
|
|
// Start server services
|
|
using (WebApp.Start<Step.App_Start.Startup>(url: configuredUri))
|
|
{
|
|
StopRequest.WaitOne();
|
|
}
|
|
// Close WinForm
|
|
ServerControlWindow.Stop();
|
|
}
|
|
}
|
|
}
|