Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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();
            }
        }