private void FinishButton_Click(object sender, EventArgs e) { SaveCurrentTextBoxes(); JObject json_object = new JObject(); json_object.Add("exam_name", ExamNameTextBox.Text); var questions_array = new JArray(); foreach (var i in question_list) { var obj = new JObject(); obj.Add("q", i.Question); obj.Add("a", i.Answer); questions_array.Add(obj); } json_object.Add("data", questions_array); var dialog = new SaveFileDialog(); dialog.Filter = "json 파일 (*.json) | *json; | 모든 파일 (*.*) | *.*"; var result = dialog.ShowDialog(); if (result == DialogResult.OK) { var writer = new StreamWriter(dialog.FileName); writer.Write(json_object.ToString()); writer.Close(); var yes_no = MessageBox.Show("바로 시험을 시작하시겠습니까?", "궱둟셙렪", MessageBoxButtons.YesNo); if (yes_no == DialogResult.Yes) { var choice_form = new ChoiceExamForm(); choice_form.SetFilenameTextBox(dialog.FileName); choice_form.Show(); } this.Close(); } else { return; } }
private void OpenExamButton_Click(object sender, EventArgs e) { var form = new ChoiceExamForm(); form.Show(); }