void StopProgress () { if (progress != null) { progress.StopAnimating (); NavigationItem.TitleView = null; progress = null; } }
void HandleSubmit () { if (progress == null) { progress = new ProgressLabel (NSBundle.MainBundle.LocalizedString ("Verifying", "Verifying status message when adding accounts")); NavigationItem.TitleView = progress; progress.StartAnimating (); } cancelSource = new CancellationTokenSource (); authenticator.SignInAsync (cancelSource.Token).ContinueWith (task => { StopProgress (); if (task.IsFaulted) { this.ShowError ("Error Signing In", task.Exception); } else { authenticator.OnSucceeded (task.Result); } }, TaskScheduler.FromCurrentSynchronizationContext ()); }
void HandleBrowsingCompleted (object sender, EventArgs e) { if (!webViewVisible) return; if (authenticatingView == null) { authenticatingView = new UIView (View.Bounds) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, BackgroundColor = UIColor.FromRGB (0x33, 0x33, 0x33), }; progress = new ProgressLabel ("Authenticating..."); var f = progress.Frame; var b = authenticatingView.Bounds; f.X = (b.Width - f.Width) / 2; f.Y = (b.Height - f.Height) / 2; progress.Frame = f; authenticatingView.Add (progress); } else { authenticatingView.Frame = View.Bounds; } webViewVisible = false; progress.StartAnimating (); UIView.Transition ( fromView: webView, toView: authenticatingView, duration: TransitionTime, options: UIViewAnimationOptions.TransitionCrossDissolve, completion: null); }