private void btnAdd_Click(object sender, EventArgs e) { MessageBox.Show(this, "You will now add items", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); SectionPrecedence tmp; if (numericUpDown1.Value > 0) { tmp = new SectionPrecedence(); tmp.SectionType = sectionTypes.TrueFalse; tmp.SectionCount = (int)numericUpDown1.Value; Sections.Add(tmp); } if (numericUpDown2.Value > 0) { tmp = new SectionPrecedence(); tmp.SectionType = sectionTypes.Identification; tmp.SectionCount = (int)numericUpDown2.Value; Sections.Add(tmp); } if (numericUpDown3.Value > 0) { tmp = new SectionPrecedence(); tmp.SectionType = sectionTypes.MultipleChoice; tmp.SectionCount = (int)numericUpDown3.Value; Sections.Add(tmp); } if (numericUpDown4.Value > 0) { tmp = new SectionPrecedence(); tmp.SectionType = sectionTypes.MatchingType; tmp.SectionCount = (int)numericUpDown4.Value; Sections.Add(tmp); } if (numericUpDown5.Value > 0) { tmp = new SectionPrecedence(); tmp.SectionType = sectionTypes.Enumeration; tmp.SectionCount = (int)numericUpDown5.Value; Sections.Add(tmp); } if (numericUpDown6.Value > 0) { tmp = new SectionPrecedence(); tmp.SectionType = sectionTypes.Essay; tmp.SectionCount = (int)numericUpDown6.Value; Sections.Add(tmp); } ready.Invoke(); }
private void secondStep() { lblMessage.Text = "How many " + typeList[0] + " questions you will be adding?"; //-------------------------- SectionPrecedence tmp = new SectionPrecedence(); // tsanggala male dat kinuha ko sa database imbis na i parse -_-" switch (typeList[0]) { case "True or False": tmp.SectionType = sectionTypes.TrueFalse; break; case "Identification": tmp.SectionType = sectionTypes.Identification; break; case "Multiple Choice": tmp.SectionType = sectionTypes.MultipleChoice; break; case "Matching Type": tmp.SectionType = sectionTypes.MatchingType; break; case "Enumeraion": tmp.SectionType = sectionTypes.Enumeration; break; case "Essay": tmp.SectionType = sectionTypes.Essay; break; default: tmp.SectionType = sectionTypes.none; break; } tmp.SectionCount = (int)numItems.Value; //-------------------------------------------- Sections.Add(tmp); typeList.RemoveAt(0); //-------------------------- numItems.Value = 0; }
private void btnOk_Click(object sender, EventArgs e) { foreach (ListViewItem item in lstv2.Items) { SectionPrecedence tmp = new SectionPrecedence(); // tsanggala male dat kinuha ko sa database imbis na i parse -_-" switch (item.Text) { case "True or False": tmp.SectionType = sectionTypes.TrueFalse; break; case "Identification": tmp.SectionType = sectionTypes.Identification; break; case "Multiple Choice": tmp.SectionType = sectionTypes.MultipleChoice; break; case "Matching Type": tmp.SectionType = sectionTypes.MatchingType; break; case "Enumeraion": tmp.SectionType = sectionTypes.Enumeration; break; case "Essay": tmp.SectionType = sectionTypes.Essay; break; default: tmp.SectionType = sectionTypes.none; break; } tmp.SectionCount = int.Parse(item.SubItems[1].Text); Sections.Add(tmp); } ready.Invoke();// raise only if really ready and not a cancel //this.Close(); }
public void InitializeRoutine(ref int TestNumber, FlowLayoutPanel parent, SectionPrecedence item, int target) { //Debug.Print("Temporary, also get type as parameter"); switch (item.SectionType) { case sectionTypes.none: MessageBox.Show("This shouldnt show"); //SectionForm = new frmAddTestSection(); break; case sectionTypes.TrueFalse: //startTrueOrFalse(item.SectionCount); frmTrueFalse TrueFalseForm = new frmTrueFalse(); TrueFalseForm._Section = new htmlBuilderClass.examSection(); TrueFalseForm._Section.testNumber = TestNumber; TrueFalseForm._target = item.SectionCount; _testNumber = TestNumber; TrueFalseForm.isEdit = false; if (TrueFalseForm.ShowDialog() == DialogResult.Cancel) { canceled = true; this.Dispose(); return; } else { TestNumber++; this.Parent = parent; return; } //break; case sectionTypes.Identification: frmIdentification IdentificationForm = new frmIdentification(); IdentificationForm._Section = new htmlBuilderClass.examSection(); IdentificationForm._Section.testNumber = TestNumber; IdentificationForm._target = item.SectionCount; _testNumber = TestNumber; IdentificationForm.isEdit = false; if (IdentificationForm.ShowDialog() == DialogResult.Cancel) { canceled = true; this.Dispose(); return; } else { TestNumber++; this.Parent = parent; return; } //break; case sectionTypes.MultipleChoice: frmMultipleChoice MultipleChoiceForm = new frmMultipleChoice(); MultipleChoiceForm._Section = new htmlBuilderClass.examSection(); MultipleChoiceForm._Section.testNumber = TestNumber; MultipleChoiceForm._target = item.SectionCount; _testNumber = TestNumber; MultipleChoiceForm.isEdit = false; if (MultipleChoiceForm.ShowDialog() == DialogResult.Cancel) { canceled = true; this.Dispose(); return; } else { TestNumber++; this.Parent = parent; return; } case sectionTypes.MatchingType: //MessageBox.Show("Matching not yet ready"); frmMatchingType MatchingTypeForm = new frmMatchingType(); MatchingTypeForm._Section = new htmlBuilderClass.examSection(); MatchingTypeForm._Section.testNumber = TestNumber; MatchingTypeForm._target = item.SectionCount; _testNumber = TestNumber; MatchingTypeForm.isEdit = false; if (MatchingTypeForm.ShowDialog() == DialogResult.Cancel) { canceled = true; this.Dispose(); return; } else { TestNumber++; this.Parent = parent; return; } case sectionTypes.Enumeration: frmEnumeration EnumerationForm = new frmEnumeration(); EnumerationForm._Section = new htmlBuilderClass.examSection(); EnumerationForm._Section.testNumber = TestNumber; EnumerationForm._target = item.SectionCount; _testNumber = TestNumber; EnumerationForm.isEdit = false; if (EnumerationForm.ShowDialog() == DialogResult.Cancel) { canceled = true; this.Dispose(); return; } else { TestNumber++; this.Parent = parent; return; } case sectionTypes.Essay: frmEssay EssayForm = new frmEssay(); EssayForm._Section = new htmlBuilderClass.examSection(); EssayForm._Section.testNumber = TestNumber; EssayForm._target = item.SectionCount; _testNumber = TestNumber; EssayForm.isEdit = false; if (EssayForm.ShowDialog() == DialogResult.Cancel) { canceled = true; this.Dispose(); return; } else { TestNumber++; this.Parent = parent; return; } default: MessageBox.Show("An error occured"); break; } }