public AccordanceVariantEditControl(AccordanceQuestionAnswer accordanceQuestionAnswer) : this() { for (var i = 0; i < accordanceQuestionAnswer.Variants.Count; i++) { buttonAddVariant_Click(this, new EventArgs()); Accordance1Text[i].Text = accordanceQuestionAnswer.Variants[i]; Accordance2Text[i].Text = accordanceQuestionAnswer.Accordances[i]; } }
public AccordanceVariantPassControl(AccordanceQuestionAnswer accordanceQuestionAnswer, bool isPreviewState) { InitializeComponent(); answer = accordanceQuestionAnswer; //Добавление вариантов в случайном порядке var added_variants_indexes = new HashSet <int>(); var added_accordanses_indexes = new HashSet <int>(); var rnd = new Random(); for (var i = 0; i < answer.Accordances.Count; i++) { int index; do { index = rnd.Next(0, answer.Accordances.Count); }while (added_variants_indexes.Contains(index)); added_variants_indexes.Add(index); listBoxAcc1.Items.Add(answer.Variants[index]); do { index = rnd.Next(0, answer.Accordances.Count); }while (added_accordanses_indexes.Contains(index)); added_accordanses_indexes.Add(index); listBoxAcc2.Items.Add(answer.Accordances[index]); } if (!isPreviewState) { listBoxAcc1.AllowDrop = true; listBoxAcc1.DragEnter += listBox_DragEnter; listBoxAcc1.DragDrop += listBox_DragDrop; listBoxAcc1.MouseMove += listBox_MouseMove; listBoxAcc2.AllowDrop = true; listBoxAcc2.DragEnter += listBox_DragEnter; listBoxAcc2.DragDrop += listBox_DragDrop; listBoxAcc2.MouseMove += listBox_MouseMove; } }
public AccordanceQuestionAnswer(AccordanceQuestionAnswer answerToClone) { Variants = new List <string>(answerToClone.Variants); Accordances = new List <string>(answerToClone.Accordances); }