Beispiel #1
0
        public async Task UpdateKnowledge()
        {
            //ASK ADVICE
            var questionArgs =
                new Common.QuestionArgs(StudyResources.AdvisorQuestionWhatIsPhrasePercentKnown, _Target.Phrase);
            var result = await DefaultPhrasePercentKnownAdvisor.Ton.AskAdviceAsync(questionArgs);

            //INTERPRET ADVICE
            _CachedPercentKnownValue = (double)result.Object;
            _PercentKnownIsUpToDate  = true;
            if (_CachedPercentKnownValue >= KnowledgeThreshold)
            {
                MarkPhraseKnown(_Target.Phrase.Text);
            }
            else
            {
                MarkPhraseUnknown(_Target.Phrase.Text);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Calculates the PercentKnown of this line.
        /// </summary>
        /// <returns></returns>
        public async Task <double> GetPercentKnownAsync()
        {
            if (_Target == null)
            {
                return(0);// await new Task<double>(() => { return 0; });
            }
            if (_PercentKnownIsUpToDate)
            {
                return(_CachedPercentKnownValue);
            }

            var questionArgs =
                new Common.QuestionArgs(StudyResources.AdvisorQuestionWhatIsPhrasePercentKnown,
                                        _Target.Phrase);

            var result = await DefaultPhrasePercentKnownAdvisor.Ton.AskAdviceAsync(questionArgs);

            _PercentKnownTaskVariable = (double)result.Object;

            _CachedPercentKnownValue = _PercentKnownTaskVariable;
            _PercentKnownIsUpToDate  = true;
            return(_PercentKnownTaskVariable);
        }