Esempio n. 1
0
        /// <summary>
        /// Changes the learning progress from the current one to the next one.
        /// </summary>
        /// <param name="progress">The word learning progress.</param>
        /// <returns></returns>
        /// <owner>Mariia Yelisieieva</owner>
        public static LearningProgress ChangeLearningProgress(LearningProgress progress)
        {
            int valuesNumber   = Enum.GetNames(typeof(LearningProgress)).Length;
            int newProgressInt = ((int)progress + 1) % valuesNumber;

            progress = (LearningProgress)newProgressInt;
            return(progress);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Word"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="chinese">The Chinese word.</param>
 /// <param name="pinyin">The pinyin - the transcription of the Chinese word.</param>
 /// <param name="english">The English word.</param>
 /// <param name="progress">The word learning progress.</param>
 /// <owner>Mariia Yelisieieva</owner>
 public Word(int id, string chinese, string pinyin, string english, LearningProgress progress = LearningProgress.NotLearned)
 {
     this.Id       = id;
     this.Chinese  = chinese;
     this.Pinyin   = pinyin;
     this.English  = english;
     this.Progress = progress;
 }
Esempio n. 3
0
        static void OnLearningProgress(LearningProgress progress)
        {
            //if (_lastEpoch != progress.Epoch)
            //{
            //    _lastEpoch = progress.Epoch;

            //    Console.WriteLine($"Epoch {_lastEpoch}");
            //}
            //if (progress.Counter % 100 == 0)
            //{
            //    //Console.WriteLine($"Epoch {progress.Epoch}, Batch {progress.BatchNumber}, Error {progress.CurrentNetworkError}");
            //    File.AppendAllText("c:/users/ben/desktop/learningRate_smallDropOut.csv", $"{progress.CurrentNetworkError}\n");
            //}
        }
        public override int GetHashCode()
        {
            int hashCode = 2146425462;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Description);

            hashCode = hashCode * -1521134295 + SetID.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <ObservableCollection <IndividualCardModel> > .Default.GetHashCode(FlashcardCollection);

            hashCode = hashCode * -1521134295 + LearningProgress.GetHashCode();
            hashCode = hashCode * -1521134295 + NumTimesReviewed.GetHashCode();
            hashCode = hashCode * -1521134295 + WhenCreated.GetHashCode();
            hashCode = hashCode * -1521134295 + WhenLastReviewedUTC.GetHashCode();
            hashCode = hashCode * -1521134295 + IsStarred.GetHashCode();
            return(hashCode);
        }
        /// <summary>
        /// Converts values from <see cref="LearningProgress" /> to <see cref="SolidColorBrush" /> to display colored progress.
        /// </summary>
        /// <owner>Mariia Yelisieieva</owner>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            LearningProgress progress = (LearningProgress)value;

            SolidColorBrush result = new SolidColorBrush(Colors.Gray);

            switch (progress)
            {
            case LearningProgress.NotLearned:
                result = new SolidColorBrush(Colors.Red);
                break;

            case LearningProgress.InProgress:
                result = new SolidColorBrush(Colors.Yellow);
                break;

            case LearningProgress.Learned:
                result = new SolidColorBrush(Colors.Green);
                break;
            }

            return(result);
        }
Esempio n. 6
0
        public void Word_ChangeProgress_LearnedSelected_ChangedToNotLearned()
        {
            LearningProgress result = Word.ChangeLearningProgress(LearningProgress.Learned);

            Assert.AreEqual(LearningProgress.NotLearned, result);
        }
Esempio n. 7
0
        public void Word_ChangeProgress_InProgressSelected_ChangedToLearned()
        {
            LearningProgress result = Word.ChangeLearningProgress(LearningProgress.InProgress);

            Assert.AreEqual(LearningProgress.Learned, result);
        }