private void btnDelete_Click(object sender, RoutedEventArgs e) { LoadSaveHelpers.DeleteGame(lbSaves.SelectedItem as string); showSaves(); btnLoad.IsEnabled = false;; btnDelete.IsEnabled = false; }
//shows the list of saved files private void showSaves() { lbSaves.Items.Clear(); foreach (string savedFile in LoadSaveHelpers.GetSavedGames()) { lbSaves.Items.Add(savedFile); } }
public PageSaveGame() { this.Saves = new ObservableCollection <string>(); InitializeComponent(); foreach (string savedFile in LoadSaveHelpers.GetSavedGames()) { this.Saves.Add(savedFile); } }
private void lnkLoadGame_Click(object sender, RoutedEventArgs e) { Popup popUpSplash = new Popup(); popUpSplash.Child = createSplashWindow("Loading....."); popUpSplash.Placement = PlacementMode.Center; popUpSplash.PlacementTarget = PageNavigator.MainWindow; popUpSplash.IsOpen = false; GameObjectWorker.GetInstance().cancel(); while (GameObjectWorker.GetInstance().isBusy()) { } WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "1002"), Translator.GetInstance().GetString("MessageBox", "1002", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { String file = (String)PopUpLoad.ShowPopUp(); if (file != null) { popUpSplash.IsOpen = true; DoEvents(); LoadSaveHelpers.LoadGame(file); PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline)); HolidayYear.Clear(); GeneralHelpers.CreateHolidays(GameObject.GetInstance().GameTime.Year); Setup.SetupMergers(); popUpSplash.IsOpen = false; } } GameObjectWorker.GetInstance().start(); }
public PopUpSave() { InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpSave", this.Uid); this.Width = 400; this.Height = 500; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); ListBox lbSaves = new ListBox(); lbSaves.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbSaves.Height = 375; //lbSaves.DisplayMemberPath = "Key"; lbSaves.SelectionChanged += new SelectionChangedEventHandler(lbSaves_SelectionChanged); foreach (string savedFile in LoadSaveHelpers.GetSavedGames()) { lbSaves.Items.Add(savedFile); } mainPanel.Children.Add(lbSaves); txtName = new TextBox(); txtName.Margin = new Thickness(0, 10, 0, 0); txtName.Background = Brushes.Transparent; txtName.TextChanged += new TextChangedEventHandler(txtName_TextChanged); mainPanel.Children.Add(txtName); WrapPanel panelButtons = new WrapPanel(); panelButtons.Margin = new Thickness(0, 10, 0, 0); mainPanel.Children.Add(panelButtons); btnSave = new Button(); btnSave.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnSave.Height = Double.NaN; btnSave.Width = Double.NaN; btnSave.Content = "Save"; btnSave.Click += new RoutedEventHandler(btnSave_Click); btnSave.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnSave.IsEnabled = false; panelButtons.Children.Add(btnSave); Button btnCancel = new Button(); btnCancel.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnCancel.Height = Double.NaN; btnCancel.Width = Double.NaN; btnCancel.Content = "Cancel"; btnCancel.Click += new RoutedEventHandler(btnCancel_Click); btnCancel.Margin = new Thickness(5, 0, 0, 0); btnCancel.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); panelButtons.Children.Add(btnCancel); this.Content = mainPanel; }