public void SetSettings(Vocab vocab, int Q, bool swap) { QSelectType = Q; wordList = new List <WordItem>(); if (QSelectType == 0 | QSelectType == 1) { wordList = vocab.CloneWordList(); } else if (QSelectType == 2 | QSelectType == 3) { List <WordItem> templist = vocab.CloneWordList(); int max = templist.Count; Random rnd = new Random(); for (int i = 0; i < max; i++) { int index = rnd.Next(templist.Count); wordList.Add(templist[index]); templist.RemoveAt(index); templist.Reverse(); } } if (swap) { foreach (WordItem w in wordList) { string temp = w.word; w.word = w.trans; w.trans = temp; } } }
public Vocab Clone() { Vocab clone = new Vocab(); foreach (WordItem w in WordList) { clone.WordList.Add(w.Clone()); } return(clone); }
private void CreateNewVocab(string name) { if (name == "") { return; } Vocab v = new Vocab(); v.name = name; VocabList.Add(v); }