private void newBrainsFileToolStripMenuItem_Click(object sender, EventArgs e) { if (isFileLoaded) { CloseData(); } SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Conversational Brains DB (*.db3)|*.db3"; sfd.FilterIndex = 1; DialogResult sfdResult = sfd.ShowDialog(); if (sfdResult == DialogResult.OK) { if (Conversational.CreateNewBrainFile(sfd.FileName)) { Conversational.Initialize(new FileInfo(sfd.FileName)); LoadData(); } else { MessageBox.Show("Unable to create new brain file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void CloseData() { if (MessageBox.Show("Are you sure you wish to close these brains?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Conversational.Destroy(); isFileLoaded = false; Text = "Conversational Config 1.0"; doInterfaceEnables(false); } }
private void loadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog loadFile = new OpenFileDialog(); loadFile.Filter = "Conversational Brains DB (*.db3)|*.db3"; loadFile.FilterIndex = 1; DialogResult result = loadFile.ShowDialog(); if (result == DialogResult.OK) { try { Conversational.Initialize(new FileInfo(loadFile.FileName)); } catch (ApplicationException) { MessageBox.Show("This is not a conversational brains file.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } LoadData(); } }