Exemplo n.º 1
0
        async Task tick333ms()
        {
            if (_swMain.Elapsed.TotalMinutes == 0)
            {
                return;
            }

            //autoPause();

            CrntCpm  = PupilInput.Length / _swMain.Elapsed.TotalMinutes; //CurInfo = $" Typed {(PupilInput.Length),3:N0}\t Elapsed {_sw.Elapsed:mm\\:ss}\t Speed {CrntCpm:N0}";
            IsRecord = CrntCpm > _recordCpm;

            var now = DateTime.Now;

            if (_swMain.IsRunning && PupilInput.Length > 0 && now > _nextMeasureTime)
            {
                var dLen = PupilInput.Length - _prevCharLen;
                var dMin = _swMain.Elapsed.TotalMinutes - _prevMinutes;
                if (dMin > 0)
                {
                    PrgsChart.Add(new VeloMeasure {
                        SppedCpm = (int)(dLen / dMin), PrevRcrd = _recordCpm
                    });
                }

                _prevMinutes     = _swMain.Elapsed.TotalMinutes;
                _prevCharLen     = PupilInput.Length;
                _nextMeasureTime = now.Add(_measurePeriod);
            }

            await Task.Yield();
        }
Exemplo n.º 2
0
        async void sessionLoad_Start_lazy() // timing will start on the first keystroke.
        {
            LessonText = LessonHelper.GetLesson(LesnTyp, SubLesnId);
            LessonLen  = LesnTyp == LessonType.PhrasesRandm ? LessonText.Length - LessonHelper.PaddingLen : LessonText.Length;

            PupilInput = "";
            _swMain.Reset();
            /*updateUserLessonLst(false)*/
            ;
            PrgsChart.Clear();
            IsInSsn = IsCorrect = true;

            IsFocusedSB = false; await Task.Delay(9); refreshUiSynch(); await refreshUi();

            IsFocusedPI = false; await Task.Delay(9); refreshUiSynch(); await refreshUi();

            IsFocusedPI = true; await Task.Delay(99); refreshUiSynch(); await refreshUi(); //this acrobatics seems to bring focus to the textbox.
        }