async void updateGuiOn1secTimerTick() { var tnow = DateTime.Now; var idle = ((tnow - App.StartedAt) + TimeSpan.FromSeconds(App.ScrSvrTimeoutSec)); var left = App.StartedAt.AddMinutes(AppSettings.Instance.Min2Sleep) - tnow; tbOutOffL.Text = (idle.TotalMinutes < 60 ? $"{idle:m\\:ss}" : $"{idle:h\\:mm} "); if (AppSettings.Instance.AutoSleep) { tbOutOffR.Text = (left.TotalMinutes < 60 ? $"{left:m\\:ss}" : $"{left:h\\:mm} "); pbOutOff.Maximum = (idle + left).TotalMinutes; pbOutOff.Value = idle.TotalMinutes; pbOutOff.Opacity = pbOutOff.Maximum > 0 ? pbOutOff.Value / pbOutOff.Maximum : 0; } else { tbOutOffR.Text = ""; } if (!_isTalking && idle.TotalSeconds % 60 <= (_timerePeriodSec + _gracePeriodSec)) { try { _isTalking = true; _timer.Stop(); g1.Background = _red; if (AppSettings.Instance.IsSayMinOn || AppSettings.Instance.IsChimesOn || AppSettings.Instance.IsRepeatOn) { await ChimerAlt.WakeAudio(); // wake up monitor's audio. if (AppSettings.Instance.IsSayMinOn) { await App.SpeakAsync($"{idle.Minutes}"); } if (AppSettings.Instance.IsChimesOn) { await ChimerAlt.Chime(idle.Minutes); //nogo: .ConfigureAwait(false); } if (AppSettings.Instance.IsRepeatOn) { App.SpeakFaF($"{idle.Minutes} minutes, that is."); } g1.Background = _rng; } await Task.Delay((int)(_gracePeriodSec * 1000)); // lest repeat the same on the next tick (2020-12-02) g1.Background = _trn; } catch (Exception ex) { ex.Log(); } finally { _isTalking = false; _timer.Start(); } } }
async void onFreqWalk(object s, RoutedEventArgs e) => await ChimerAlt.FreqWalkUpDn();