protected override void SetPlatformUI(AuthenticateUIType controller)
        {
            var view = new WebAuthenticatorView(this, controller);

            view.Frame = controller.View.Bounds;

            controller.View.AddSubview(view);
        }
Beispiel #2
0
        public WebAuthenticatorController(WebAuthenticator authenticator, UIView loadingView = null)
        {
            this.authenticator = authenticator;

            Title = authenticator.Title;

            if (authenticator.AllowCancel)
            {
                NavigationItem.LeftBarButtonItem = new UIBarButtonItem(
                    UIBarButtonSystemItem.Cancel,
                    delegate {
                    view.Cancel();
                });
            }

            if (loadingView == null)
            {
                loadingView = new UIView(View.Bounds);
                loadingView.BackgroundColor = UIColor.White;

                float labelHeight = 22;
                float labelWidth  = loadingView.Frame.Width - 20;

                // derive the center x and y
                float centerX = loadingView.Frame.Width / 2;
                float centerY = loadingView.Frame.Height / 2;

                var activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

                activitySpinner.Frame = new RectangleF(
                    centerX - (activitySpinner.Frame.Width / 2),
                    centerY - activitySpinner.Frame.Height - 20,
                    activitySpinner.Frame.Width,
                    activitySpinner.Frame.Height);
                activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
                loadingView.AddSubview(activitySpinner);
                activitySpinner.StartAnimating();

                var loadingLabel = new UILabel(new RectangleF(
                                                   centerX - (labelWidth / 2),
                                                   centerY + 20,
                                                   labelWidth,
                                                   labelHeight
                                                   ));
                loadingLabel.BackgroundColor  = UIColor.Clear;
                loadingLabel.TextColor        = UIColor.Black;
                loadingLabel.Text             = "Logging in...";
                loadingLabel.TextAlignment    = UITextAlignment.Center;
                loadingLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;

                loadingView.AddSubview(loadingLabel);
            }
            view = new WebAuthenticatorView(authenticator, this, loadingView);

            view.Frame = View.Bounds;

            View.Add(view);
        }
 public WebViewDelegate(WebAuthenticatorView view)
 {
     this.view = view;
 }