protected void SetValueClick(object sender, EventArgs e) { TreeIter iter; QuestionEditArea.Selection.GetSelected(out iter); var question = testQuestions.GetValue(iter, 0) as TestQuestion; // If no selection - do nothing if (question == null) { return; } var dlgSetValue = new OneStringValueAskDlg("Укажите новую стоимость вопроса", null, "Стоимость в баллах (>0)"); dlgSetValue.Modal = true; dlgSetValue.Value = question.Value; if (dlgSetValue.Run() == (int)ResponseType.Ok) { var value = dlgSetValue.Value; if (value != question.Value) { question.Value = value; } } dlgSetValue.Destroy(); }
protected void SetTestTimeClick(object sender, EventArgs e) { var dlgSetTime = new OneStringValueAskDlg("Время прохождения теста", null, "Время, сек (0 -> inf)", 9999); dlgSetTime.Value = test.Time; if (dlgSetTime.Run() == (int)ResponseType.Ok) { test.Time = (int)dlgSetTime.Value; lblTestTime.LabelProp = string.Format("Время теста: {0}", test.Time > 0 ? test.Time.ToString() + " сек" : "inf"); setTestTime.Label = test.Time > 0 ? test.Time.ToString() + " сек" : "inf"; setTestTime.ShortLabel = test.Time > 0 ? test.Time.ToString() + " сек" : "inf"; } dlgSetTime.Destroy(); }
protected void AddQuestionClick(object sender, EventArgs e) { var dlgQuestionAdd = new OneStringValueAskDlg("Новый вопрос", "Текст вопроса", "Стоимость в баллах (>0)"); dlgQuestionAdd.Modal = true; if (dlgQuestionAdd.Run() == (int)ResponseType.Ok) { var text = dlgQuestionAdd.Text; if (text.Length > 0) { var value = dlgQuestionAdd.Value; var question = new TestQuestion(dlgQuestionAdd.Text, dlgQuestionAdd.Value); test.Questions.Add(question); testQuestions.AppendValues(question); } } dlgQuestionAdd.Destroy(); }