Exemplo n.º 1
0
 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;
         }
     }
 }
Exemplo n.º 2
0
        public Vocab Clone()
        {
            Vocab clone = new Vocab();

            foreach (WordItem w in WordList)
            {
                clone.WordList.Add(w.Clone());
            }
            return(clone);
        }
Exemplo n.º 3
0
        private void CreateNewVocab(string name)
        {
            if (name == "")
            {
                return;
            }
            Vocab v = new Vocab();

            v.name = name;
            VocabList.Add(v);
        }