public void Run(IBackgroundTaskInstance taskInstance) { logModel.AppendLog(Log.CreateLog("Local Webserver starting...", Log.LogType.System)); webServer = new WebServerEngine(); webServer.Run().Wait(); logModel.AppendLog(Log.CreateLog("Local Webserver initialized", Log.LogType.System)); logModel.AppendLog(Log.CreateLog("Database starting...", Log.LogType.System)); using (var db = new LocalDataContext()) { db.Database.Migrate(); LocalDataContextExtension.EnsureSeedData(db); } logModel.AppendLog(Log.CreateLog("Database initialized", Log.LogType.System)); logModel.AppendLog(Log.CreateLog("User Settings Init", Log.LogType.System)); var taskUserFile = Task.Run(async() => { await UserSettingsModel.GetInstance.InitFileFolder(); }); taskUserFile.Wait(); logModel.AppendLog(Log.CreateLog("Background Service Init", Log.LogType.System)); var mesureBackgroundTask = MeasureBackgroundTask.GetInstance; mesureBackgroundTask.Run(); while (true) { } ; }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( Microsoft.ApplicationInsights.WindowsCollectors.Metadata | Microsoft.ApplicationInsights.WindowsCollectors.Session); this.InitializeComponent(); this.Suspending += OnSuspending; logModel.AppendLog(Log.CreateLog("Local Webserver starting...", Log.LogType.System)); webServer = new WebServerEngine(); webServer.Run().Wait(); logModel.AppendLog(Log.CreateLog("Local Webserver initialized", Log.LogType.System)); Messenger.Default.Register <RefreshDashboardMessage>(this, (mess) => { var frame = Window.Current.Content as Frame; if (frame != null) { Type currentPage = frame.SourcePageType; if (currentPage == typeof(MainPage)) { App.TryShowNewWindow <MainPage>(); } } }); }