public SequenceVariantPassControl(SequenceQuestionAnswer sequenceQuestionAnswer, bool isPreviewState) { InitializeComponent(); answer = sequenceQuestionAnswer; var added_indexes = new HashSet <int>(); var rnd = new Random(); //Добавление вариантов в случайном порядке for (var i = 0; i < sequenceQuestionAnswer.Variants.Count; i++) { int index; do { index = rnd.Next(0, sequenceQuestionAnswer.Variants.Count); }while (added_indexes.Contains(index)); added_indexes.Add(index); listBoxSequence.Items.Add(sequenceQuestionAnswer.Variants[index]); } if (!isPreviewState) { listBoxSequence.AllowDrop = true; listBoxSequence.DragEnter += listBox_DragEnter; listBoxSequence.DragDrop += listBox_DragDrop; listBoxSequence.MouseMove += listBox_MouseMove; } }
public SequenceVariantEditControl(SequenceQuestionAnswer sequenceQuestionAnswer) : this() { for (var i = 0; i < sequenceQuestionAnswer.Variants.Count; i++) { AddVariant(); SequenceText[i].Text = sequenceQuestionAnswer.Variants[i]; } }
public SequenceQuestionAnswer(SequenceQuestionAnswer answerToClone) { Variants = new List <string>(answerToClone.Variants); }