private void MenBtnSettings_Click(object sender, EventArgs e) { //Display the settings form to the user. this.Enabled = false; using (FrmSettings settingsWindow = new FrmSettings()) { settingsWindow.ShowDialog(); } LoadPaths(); MnuStpMain.Select(); this.Enabled = true; }
private void MenBtnFromCurrentSave_Click(object sender, EventArgs e) { //Display the add new form to the user, with the current //game GameSave file loaded. this.Enabled = false; using (FrmAddNew addNewWindow = new FrmAddNew(saveGameFilePath)) { addNewWindow.ShowDialog(); } LoadSaves(); MnuStpMain.Select(); this.Enabled = true; }
private void FrmMain_Load(object sender, EventArgs e) { //Load data from files. try { saves = Global.ReadSaves(); LoadSaves(); LoadPaths(); MnuStpMain.Select(); } catch (Exception ex) { MessageBox.Show("There was an error while loading app data. Please contact the dev with " + "details of the error shown below:\n\n" + ex.Message + "\n\n\nThe app will now close", "App data missing or corrupt", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void MenBtnNewFromFile_Click(object sender, EventArgs e) { //Let the user select a file to make a save from. try { string filePath = ""; using (OpenFileDialog fileBrowser = new OpenFileDialog()) { fileBrowser.Filter = "SaveGame files|*.txt"; if (fileBrowser.ShowDialog() == DialogResult.OK) { filePath = fileBrowser.FileName; //Display the add new form to the user, with the selected //GameSave file loaded. this.Enabled = false; using (FrmAddNew addNewWindow = new FrmAddNew(filePath)) { addNewWindow.ShowDialog(); } } } LoadSaves(); MnuStpMain.Select(); this.Enabled = true; } catch { MessageBox.Show("There was an error while opening the selected file.", "File open error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }