512a2200c6
* Added default Api unhandled exceptions * Fixed config file
58 lines
1.5 KiB
C#
58 lines
1.5 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;
|
|
using Step.Config;
|
|
using static Step.Config.StartupConfig;
|
|
using static Step.Utils.StepLogger;
|
|
using static Step.Utils.Constants;
|
|
using Step.Database;
|
|
using Step.Utils;
|
|
|
|
namespace Step
|
|
{
|
|
public class Application
|
|
{
|
|
|
|
public static readonly ManualResetEvent StopRequest = new ManualResetEvent(false);
|
|
|
|
public static int MessageService { get; private set; }
|
|
|
|
public static void Main()
|
|
{
|
|
LogInfo("Application started");
|
|
StartupConfigController.ReadStartupConfig();
|
|
|
|
DatabaseContext.TestDatabaseConnection();
|
|
|
|
// Start self host application
|
|
string configuredUri = "http://localhost:" + ServerConfig.ServerPort.ToString();
|
|
|
|
// Start WinForm
|
|
ServerControlWindow.Start();
|
|
|
|
// Register listener to "close application" messages
|
|
MessageServices.Current.Subscribe(STOP_SERVER, (a, b) =>
|
|
{
|
|
StopRequest.Set();
|
|
});
|
|
|
|
// Start server services
|
|
using (WebApp.Start<Step.App_Start.Startup>(url: configuredUri))
|
|
{
|
|
StopRequest.WaitOne();
|
|
LogInfo("Application closed");
|
|
}
|
|
|
|
// Close WinForm
|
|
ServerControlWindow.Stop();
|
|
}
|
|
}
|
|
}
|