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 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); } }