async private void Page_Loaded(object sender, RoutedEventArgs e) { // Only allow for one instance of this application to be run on a given machine. bool isSemaphoneCreated = false; _semaphore = new System.Threading.Semaphore(1, 1, typeof(App).ToString(), out isSemaphoneCreated); if (!isSemaphoneCreated) { await _dialogService.ShowMessage( Globals.ResourceLoader.GetString("DuplicateApplicationMessage/Text"), Globals.ResourceLoader.GetString("DuplicateInstance/Text"), Globals.ResourceLoader.GetString("CloseApplication/Content"), () => { }); Application.Current.Exit(); return; } // Set the actual size of the page based on the resolution of the phyical device we are on. this.MainPageInnerGrid.Width = Globals.ScreenSize.Width; this.MainPageInnerGrid.Height = Globals.ScreenSize.Height; await App.BuildDBTables.Build(); await this.Reset(); XMLParser xmlParser = new XMLParser("ms-appx:///MockNMEA/Simple.xml"); Task.Run(async() => { await xmlParser.BeginParse(Globals.ScreenSize); }).Wait(); await this.LoadPages(); //SendEmail.FromEmailAddress = App.VesselSettings.FromEmailAddress; //SendEmail.FromEmailPassword = App.VesselSettings.FromEmailPassword; //SendEmail.SMTPEncryptionMethod = App.VesselSettings.SMTPEncryptionMethod; //SendEmail.SMTPPort = App.VesselSettings.SMTPPort; //SendEmail.SMTPServerName = App.VesselSettings.SMTPServerName; //SendEmail.Send(App.VesselSettings.ToEmailAddress, // App.VesselSettings.VesselName, // "Test Email", // "This is a test", // ""); //this.BuildDemoGaugePages(); await this.PopulateDemoSensorCollection(); if (App.VesselSettings.IsNightMode) { this.Night_Click(this, null); } else { if (App.VesselSettings.ThemeForegroundColor == Colors.White) { this.Dark_Click(this, null); } else { this.Light_Click(this, null); } } await App.VideoCameraCollection.Start(); }