private void ClearBsaLists() { InitBsaLists(); Type0.Clear(); Type1.Clear(); Type2.Clear(); Type3.Clear(); Type4.Clear(); Type6.Clear(); Type7.Clear(); Type8.Clear(); }
public void SaveIBsaTypes() { ClearBsaLists(); foreach (var bsaEntry in IBsaTypes) { if (bsaEntry is BSA_Type0 type) { Type0.Add(type); } else if (bsaEntry is BSA_Type1 type1) { Type1.Add(type1); } else if (bsaEntry is BSA_Type2 type2) { Type2.Add(type2); } else if (bsaEntry is BSA_Type3 type3) { Type3.Add(type3); } else if (bsaEntry is BSA_Type4 type4) { Type4.Add(type4); } else if (bsaEntry is BSA_Type6 type6) { Type6.Add(type6); } else if (bsaEntry is BSA_Type7 type7) { Type7.Add(type7); } else if (bsaEntry is BSA_Type8 type8) { Type8.Add(type8); } } }
private void cbQuestionList_SelectedIndexChanged(object sender, EventArgs e) { try { if (cbQuestionList.SelectedIndex > 0) { btnSubmit.Text = "Zapisz"; btnDelete.Enabled = true; short id = Convert.ToInt16(cbQuestionList.SelectedItem); Repository r = new Repository(connStr); DbQuestion q = r.GetQuestion(id); if (q.QType == 2) { cbQuestionType.SelectedIndex = 1; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox2.SizeMode = PictureBoxSizeMode.Zoom; // ciągniemy obrazki z bazy Image[] images = r.loadImages(q.ID); q.Image = images[0]; q.ImageAlt = images[1]; pictureBox1.Image = q.Image; pictureBox2.Image = q.ImageAlt; } else { cbQuestionType.SelectedIndex = 0; } cbAnswerType.SelectedIndex = (int)q.Type >= 6? (int)q.Type - 2: (int)q.Type - 1; richTextBox1.Text = q.question.Replace(replace2, replace1); richTextBox1.Text = richTextBox1.Text.ReplaceApostropheToSymbol(); type1.Dispose(); type2.Dispose(); type3.Dispose(); type4.Dispose(); type5.Dispose(); type6.Dispose(); Point point = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); AnchorStyles anchor = AnchorStyles.Bottom | AnchorStyles.Left; switch (cbAnswerType.SelectedIndex) { case 0: type1 = new Type1(); type1.q = q; Controls.Add(type1); type1.Location = point; type1.Anchor = anchor; break; case 1: type2 = new Type2(); type2.q = q; Controls.Add(type2); type2.Location = point; type2.Anchor = anchor; break; case 2: type3 = new Type3(); type3.q = q; Controls.Add(type3); type3.Location = point; type3.Anchor = anchor; break; case 3: type4 = new Type4(); type4.q = q; Controls.Add(type4); type4.Location = point; type4.Anchor = anchor; break; case 4: type5 = new Type5(); type5.q = q; Controls.Add(type5); type5.Location = point; type5.Anchor = anchor; break; case 5: type6 = new Type6(); type6.q = q; Controls.Add(type6); type6.Location = point; type6.Anchor = anchor; break; default: break; } } else { cbQuestionType.SelectedIndex = 0; pictureBox1.Image = null; pictureBox2.Image = null; cbAnswerType_SelectedIndexChanged(sender, null); btnSubmit.Text = "Dodaj"; btnDelete.Enabled = false; richTextBox1.Text = ""; cbAnswerType.SelectedIndex = 1; //Domyslny typ2 przy wprowadzaniu nowego. (Jednego) } } catch (Exception ex) { reCounter++; if (reCounter == 5) { throw; } //Ponowna próba rekursywnie. cbQuestionList_SelectedIndexChanged(sender, e); } }
private void cbAnswerType_SelectedIndexChanged(object sender, EventArgs e) { try { type1.Dispose(); type2.Dispose(); type3.Dispose(); type4.Dispose(); type5.Dispose(); type6.Dispose(); Point point = new Point(250, richTextBox1.Size.Height + lower); AnchorStyles anchor = AnchorStyles.Bottom | AnchorStyles.Left; setRtbLocation(); switch (cbAnswerType.SelectedIndex) { case 0: type1 = new Type1(); Controls.Add(type1); type1.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type1.Anchor = anchor; break; case 1: type2 = new Type2(); Controls.Add(type2); type2.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type2.Anchor = anchor; break; case 2: type3 = new Type3(); Controls.Add(type3); type3.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type3.Anchor = anchor; break; case 3: type4 = new Type4(); Controls.Add(type4); type4.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type4.Anchor = anchor; break; case 4: type5 = new Type5(); Controls.Add(type5); type5.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type5.Anchor = anchor; break; case 5: type6 = new Type6(); Controls.Add(type6); type6.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type6.Anchor = anchor; break; default: break; } } catch { // Druga próba rekursywnie. cbAnswerType_SelectedIndexChanged(sender, e); } }
private class Requires8 { public Requires8(Type1 p1, Type2 p2, Type3 p3, Type4 p4, Type5 p5, Type6 p6, Type7 p7, Type8 p8) { }
private class Requires7 { public Requires7(Type1 p1, Type2 p2, Type3 p3, Type4 p4, Type5 p5, Type6 p6, Type7 p7) { }
private class Requires6 { public Requires6(Type1 p1, Type2 p2, Type3 p3, Type4 p4, Type5 p5, Type6 p6) { }
static Type5() { Type6 a = new Type6(); }