/// <summary> /// Открыть БД - кнопка меню /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = Constants.FILE_FILTER; if (open.ShowDialog() == DialogResult.OK) { database = new TrueFalse(open.FileName); database.Load(); sbQuestionNum.Minimum = 1; sbQuestionNum.Maximum = database.Count; sbQuestionNum.Value = 1; ShowQuestionNumber(); sbQuestionNum_Scroll(sender, null); EnabledControls(true); } }
/// <summary> /// Создать БД - кнопка меню /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void createToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = Constants.FILE_FILTER; if (saveFileDialog.ShowDialog() == DialogResult.OK) { database = new TrueFalse(saveFileDialog.FileName); database.Add("Пробный вопрос", true); database.Save(); sbQuestionNum.Minimum = 1; sbQuestionNum.Maximum = 1; sbQuestionNum.Value = 1; ShowQuestionNumber(); sbQuestionNum_Scroll(sender, null); EnabledControls(true); } }