private void btnCreateGame_Click(object sender, RoutedEventArgs e) { this.StartData.Airline = (Airline)cbAirline.SelectedItem; this.StartData.Airport = (Airport)cbAirport.SelectedItem; this.StartData.CEO = (string)txtCEO.Text; this.StartData.HomeCountry = (Country)cbCountry.SelectedItem; this.StartData.TimeZone = (GameTimeZone)cbTimeZone.SelectedItem; this.StartData.LocalCurrency = cbLocalCurrency.IsChecked.Value && this.StartData.HomeCountry.HasLocalCurrency; if (!this.StartData.RandomOpponents) { PageNavigator.NavigateTo(new PageSelectOpponents(this.StartData)); } else { SplashControl scCreating = UIHelpers.FindChild <SplashControl>(this, "scCreating"); scCreating.Visibility = System.Windows.Visibility.Visible; BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += (y, x) => { GameObjectHelpers.CreateGame(this.StartData); }; bgWorker.RunWorkerCompleted += (y, x) => { scCreating.Visibility = System.Windows.Visibility.Collapsed; PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline)); PageNavigator.ClearNavigator(); }; bgWorker.RunWorkerAsync(); } }
private void btnSaveGame_Click(object sender, RoutedEventArgs e) { Boolean gameworkerPaused = GameObjectWorker.GetInstance().isPaused(); GameObjectWorker.GetInstance().cancel(); string name = txtName.Text.Trim(); Boolean doSave = true; if (SerializedLoadSaveHelpers.SaveGameExists(name)) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "1007"), Translator.GetInstance().GetString("MessageBox", "1007", "message"), WPFMessageBoxButtons.YesNo); doSave = result == WPFMessageBoxResult.Yes; if (doSave) { SerializedLoadSaveHelpers.DeleteSavedGame(name); } } if (doSave) { SplashControl scSaving = UIHelpers.FindChild <SplashControl>(this, "scSaving"); scSaving.Visibility = System.Windows.Visibility.Visible; BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += (s, x) => { GameObject.GetInstance().Name = name; SerializedLoadSaveHelpers.SaveGame(name); }; bgWorker.RunWorkerCompleted += (s, x) => { if (!gameworkerPaused) { GameObjectWorker.GetInstance().start(); } scSaving.Visibility = System.Windows.Visibility.Collapsed; }; bgWorker.RunWorkerAsync(); } }
private void lanunchCore(IActivatedEventArgs e, bool prelaunchActivated) { #if !DEBUG if (!AppCenter.Configured) { var region = new Windows.Globalization.GeographicRegion(); AppCenter.SetCountryCode(region.CodeTwoLetter); AppCenter.Start(Telemetry.AppCenterKey, typeof(Analytics), typeof(Crashes)); } #endif if (Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView().Handlers.Count == 0) { Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView().Handlers.Add(new Services.ContentDialogNotification()); Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView().Handlers.Add(new Services.InAppToastNotification()); } var currentWindow = Window.Current; var currentContent = currentWindow.Content; if (currentContent is null) { var view = ApplicationView.GetForCurrentView(); view.SetPreferredMinSize(new Size(320, 500)); CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; if (JumpList.IsSupported()) { Task.Run(async() => { var jl = await JumpList.LoadCurrentAsync(); jl.SystemGroupKind = JumpListSystemGroupKind.None; await jl.SaveAsync(); }); } currentContent = new SplashControl(e.SplashScreen); currentWindow.Content = currentContent; } if (currentContent is SplashControl sc) { if (!prelaunchActivated) { sc.EnableGoToContent(); } } else { currentWindow.Activate(); } ((Opportunity.UWP.Converters.Typed.StringToBooleanConverter) this.Resources["EmptyStringToFalseConverter"]).ValuesForFalse.Add(""); }
private void btnLoadGame_Click(object sender, RoutedEventArgs e) { GameObjectWorker.GetInstance().cancel(); while (GameObjectWorker.GetInstance().isBusy()) { } string file = (string)lbSaves.SelectedItem; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "1002"), Translator.GetInstance().GetString("MessageBox", "1002", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { if (file != null) { SplashControl scLoading = UIHelpers.FindChild <SplashControl>(this, "scLoading"); scLoading.Visibility = System.Windows.Visibility.Visible; BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += (s, x) => { SerializedLoadSaveHelpers.LoadGame(file); }; bgWorker.RunWorkerCompleted += (s, x) => { scLoading.Visibility = System.Windows.Visibility.Collapsed; HolidayYear.Clear(); GeneralHelpers.CreateHolidays(GameObject.GetInstance().GameTime.Year); Setup.SetupMergers(); GameObjectWorker.GetInstance().pause(); PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline)); }; bgWorker.RunWorkerAsync(); } } }
private async void lanunchCore(IActivatedEventArgs e, bool prelaunchActivated) { #if !DEBUG if (!AppCenter.Configured) { var region = new Windows.Globalization.GeographicRegion(); AppCenter.SetCountryCode(region.CodeTwoLetter); AppCenter.Start("4b9c5e4f-ebf5-46ed-9ee8-72e5de8e0236", typeof(Analytics), typeof(Crashes)); } #endif if (!Opportunity.MvvmUniverse.DispatcherHelper.Initialized) { Opportunity.MvvmUniverse.DispatcherHelper.Initialize(); Opportunity.MvvmUniverse.DispatcherHelper.UseForNotification = true; } var currentWindow = Window.Current; var currentContent = currentWindow.Content; if (currentContent == null) { var view = ApplicationView.GetForCurrentView(); view.SetPreferredMinSize(new Size(320, 500)); CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; currentContent = new SplashControl(e.SplashScreen); currentWindow.Content = currentContent; } if (currentContent is SplashControl sc) { if (!prelaunchActivated) { sc.EnableGoToContent(); } } else { currentWindow.Activate(); } await JYAnalyticsUniversal.JYAnalytics.StartTrackAsync("fcf0a9351ea5917ec80d8c1b58b56ff1"); ((Opportunity.Converters.Typed.StringToBooleanConverter) this.Resources["EmptyStringToFalseConverter"]).ValuesForFalse.Add(""); }