private void buttonNext_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.textBoxQID.Text) || string.IsNullOrWhiteSpace(this.textBoxQText.Text)) { Mbox.ShowSimpleMsgBoxError("Required data missing!"); return; } q = new question(); q.id = this.textBoxQID.Text; questionText qt = new questionText(); qt.Value = this.textBoxQText.Text; q.text = qt; // Responses response responses = new response(); q.response = responses; if (this.radioButtonMCYes.Checked) { // MCQ: display response form responseFixed responseFixed = new responseFixed(); responses.Item = responseFixed; FormResponses formResponses = new FormResponses(responseFixed); formResponses.ShowDialog(); // TODO - handle cancel } else { // Not MCQ responseFree responseFree = new responseFree(); responses.Item = responseFree; // Free - just text for now // later, configure type responseFree.format = responseFreeFormat.text; } // Finally, add to part //updateQuestionsPart(q); this.Close(); }
private void buttonCancel_Click(object sender, EventArgs e) { Mbox.ShowSimpleMsgBoxError("Not implemented yet!"); }
private void buttonOK_Click(object sender, EventArgs e) { if (this.dataGridView1.Rows.Count < 3) // auto last row { Mbox.ShowSimpleMsgBoxError("You must provide at least 2 choices!"); return; } int last = this.dataGridView1.Rows.Count - 1; foreach (DataGridViewRow row in this.dataGridView1.Rows) { // Last row is added automatically if (row == this.dataGridView1.Rows[last]) { continue; } DataGridViewCell c = row.Cells[0]; if (string.IsNullOrWhiteSpace((string)c.Value)) { Mbox.ShowSimpleMsgBoxError("You must enter data in each cell!"); return; } c = row.Cells[1]; if (string.IsNullOrWhiteSpace((string)c.Value)) { Mbox.ShowSimpleMsgBoxError("You must enter data in each cell!"); return; } } // OK foreach (DataGridViewRow row in this.dataGridView1.Rows) { if (row == this.dataGridView1.Rows[last]) { continue; } responseFixedItem item = new OpenDoPEModel.responseFixedItem(); item.value = (string)row.Cells[0].Value; item.label = (string)row.Cells[1].Value; responseFixed.item.Add(item); } if (this.radioButtonYes.Checked) { responseFixed.canSelectMany = true; } else { responseFixed.canSelectMany = false; } responseFixed.canSelectManySpecified = true; // have to set this! this.Close(); }