Пример #1
0
        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)
            {
            }
            ;
        }
Пример #2
0
        /// <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>();
                    }
                }
            });
        }