private void OnPlayerStateUpdate(object sender, PlayerStateChangedEventArgs eventArgs) { NotifyPropertyChanged("MultimediaName"); NotifyPropertyChanged("MultimediaLength"); NotifyPropertyChanged("Playing"); NotifyPropertyChanged("PlaybackPosition"); NotifyPropertyChanged("PlaybackTime"); MultimediaItem multimedia = eventArgs.Multimedia; if (eventArgs.Multimedia != null) { this.millisLength = (long)multimedia.Length * 1000; long millisEstimatedLength = millisLength - (eventArgs.PlaybackPosition * 1000); int millisStep = 1000 / 60; if (playbackUpdater != null) { playbackUpdater.Cancel(); } playbackUpdater = new CountDownTimer(new DispatcherMessageQueue(), millisEstimatedLength, millisStep); playbackUpdater.Tick += OnUpdaterTick; playbackUpdater.Finish += OnUpdaterFinish; playbackUpdater.Start(); } }
private void SendVerificationCode() { auth = SessionManager.GetFirebaseAuth(); PhoneAuthProvider.GetInstance(auth) .VerifyPhoneNumber(phone, 30, TimeUnit.Seconds, Activity, new PhoneVerificationCallbacks( onVerificationCompleted: (cred) => { var code = cred.SmsCode; if (string.IsNullOrEmpty(code)) { return; } otpView.Value = code; VerifyCode(code); }, onVerificationFailed: (e) => { try { resendBtn.Enabled = false; cdTimer.Cancel(); throw e; } catch (FirebaseNetworkException) { OnboardingActivity.ShowNoNetDialog(false); } catch (FirebaseTooManyRequestsException ftmre) { OnboardingActivity.ShowError(ftmre.Source, ftmre.Message); } catch (FirebaseAuthInvalidCredentialsException faice) { OnboardingActivity.ShowError(faice.Source, faice.Message); } catch (FirebaseAuthInvalidUserException fiue) { OnboardingActivity.ShowError(fiue.Source, fiue.Message); } catch (Exception ex) { OnboardingActivity.ShowError(ex.Source, ex.Message); } }, onCodeSent: (code, token) => { verificationId = code; })); }
private void stopAlarm() { if (!wasStopped) { wasStopped = true; if (speechEngine != null && speechEngine.IsSpeaking) { this.speechEngine.Stop(); } if (timer != null) { timer.Cancel(); } if (currentMessenger != null) { currentMessenger.Stop(); } ApplicationState.GetInstance(this).SyncNextAlarm(); } }