コード例 #1
0
ファイル: Test.cs プロジェクト: karpov-dev/English
        static public List <OneWordPair> GetWordPairs(int amount, OneCollection collection)
        {
            List <OneWordPair> listOfWords = new List <OneWordPair>();

            for (int i = 0; i < amount; i++)
            {
                bool        checkRepetition = false;
                OneWordPair wordPair;
                do
                {
                    checkRepetition = false;
                    wordPair        = GetWordPair(collection);
                    for (int j = 0; j < listOfWords.Count; j++)
                    {
                        if ((wordPair.Translation == listOfWords[j].Translation) && (wordPair.Word == listOfWords[j].Word))
                        {
                            checkRepetition = true;
                            break;
                        }
                    }
                } while (checkRepetition);
                listOfWords.Add(wordPair);
            }
            return(listOfWords);
        }
コード例 #2
0
 public EditCollectionPageVM(OneCollection userCollection, NavigateManager navigateManager) : base(navigateManager)
 {
     _userCollection = userCollection;
     _title          = _userCollection.Title;
     _description    = _userCollection.Description;
     WordPairs       = CopyWordPairs(_userCollection.WordPair);
 }
コード例 #3
0
ファイル: Test.cs プロジェクト: karpov-dev/English
        static public OneWordPair GetWordPair(OneCollection collection)
        {
            int amountWords         = collection.AmountWords;
            int randomWordPairIndex = GetRandomNumber(0, (amountWords - 1));

            return(collection.WordPair[randomWordPairIndex]);
        }