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); }
public EditCollectionPageVM(OneCollection userCollection, NavigateManager navigateManager) : base(navigateManager) { _userCollection = userCollection; _title = _userCollection.Title; _description = _userCollection.Description; WordPairs = CopyWordPairs(_userCollection.WordPair); }
static public OneWordPair GetWordPair(OneCollection collection) { int amountWords = collection.AmountWords; int randomWordPairIndex = GetRandomNumber(0, (amountWords - 1)); return(collection.WordPair[randomWordPairIndex]); }