private void EditStats(object sender, ExecutedRoutedEventArgs e) { SaveStats(true); List <string> files = statsmanager.GetStatisticFiles(false); FilePickerDialog d = new FilePickerDialog(files, "Pick a file for editing", "Please pick a file from the list to be edited:"); if (!((bool)d.ShowDialog())) { return; } else { try { if (!statsmanager.LaunchEditor(d.SelectedFile)) { MessageBox.Show("RubikStatEditor.exe file seems to be missing. Try reinstalling the program.", "Editor failed to launch", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { MessageBox.Show("Editor failed to launch due to following exception: " + ex.Message, "Launch failure", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void OpenFile(object sender, ExecutedRoutedEventArgs e) { List <string> files = statsmanager.GetStatisticFiles(false); if (statsmanager.StatFileLoaded) { files.Remove(statsmanager.CurrentFileName); } files = new List <string>(files); if (files.Count > 0) { FilePickerDialog d = new FilePickerDialog(files, "Pick another statistic file", "Please pick a file from the list to select it as the current statistic file:"); if (!((bool)d.ShowDialog())) { return; } else { try { statsmanager.ChangeCurrentFile(d.SelectedFile); MessageBox.Show("Succesfully changed current statistic file to " + d.SelectedFile + statsmanager.extension, "Statistic File swap succesful", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show("Changing the Statistic file failed due to following Exception: " + ex.Message, "Statistic File swap Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } else if (statsmanager.StatFileLoaded) { MessageBox.Show("There isn't any other Statistic file to be changed to, please select Create new statistic file (Ctrl + N) to create one.", "No Statistic file to swap to", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("There is no Statistic file to be changed to, please select Create new statistic file (Ctrl + N) to create one.", "No Statistic file to swap to", MessageBoxButton.OK, MessageBoxImage.Warning); } UpdateInfo(); }