Esempio n. 1
0
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    if (frame != null)
                    {
                        frame.NavigationFailed  -= Frame_NavigationFailed;
                        frame.Navigated         -= Frame_Navigated;
                        frame.Navigating        -= Frame_Navigating;
                        frame.NavigationStopped -= Frame_NavigationStopped;
                        frame = null;
                    }

                    if (authenticator != null)
                    {
                        authenticator.Completed -= Authenticator_Completed;
                        authenticator.Error     -= Authenticator_Error;
                        authenticator            = null;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Xamarin.Auth.AuthException("UWP Dispose");
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        public FacebookService AuthenticateUser()
        {
            Xamarin.Auth.Authenticator;


            if (mFacebook != null)
            {
                Xamarin.Auth.Authenticator auth = mFacebook.GetAuthenticateUI();
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);

            // this is a ViewGroup - so should be able to load an AXML file and FindView<>
            global::Android.App.Activity activity = this.Context as global::Android.App.Activity;


            authenticator_page = (AuthenticatorPage)base.Element;

            Authenticator            = authenticator_page.Authenticator;
            Authenticator.Completed += Authentication_Completed;
            Authenticator.Error     += Authentication_Error;

            global::Android.Content.Intent ui_object = Authenticator.GetUI(activity);

            activity.StartActivity(ui_object);

            return;
        }
Esempio n. 4
0
        protected override async void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Page> e)
        {
            try
            {
                base.OnElementChanged(e);

                authenticator = ((AuthenticatorPage)base.Element).Authenticator;

                System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer.OnElementChanged");

                if (e == null)
                {
                    System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: e = {null}");
                }
                else
                {
                    if (e.NewElement == null)
                    {
                        System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: e.NewElement = {null}");
                    }
                    if (e.OldElement == null)
                    {
                        System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: e.OldElement = {null}");
                    }
                }

                if (Element == null)
                {
                    System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Element is {null}");
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Element is " + Element);
                }

                if (Control == null)
                {
                    System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Control is {null}");
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Control is " + Control);
                }

                if (Control == null)
                {
                    WindowsPage windowsPage = new WindowsPage();

                    frame = windowsPage.Frame;
                    if (frame == null)
                    {
                        frame = new Windows.UI.Xaml.Controls.Frame
                        {
                            Language = global::Windows.Globalization.ApplicationLanguages.Languages[0]
                        };

                        frame.NavigationFailed  += Frame_NavigationFailed;
                        frame.Navigated         += Frame_Navigated;
                        frame.Navigating        += Frame_Navigating;
                        frame.NavigationStopped += Frame_NavigationStopped;

                        windowsPage.Content = frame;
                        SetNativeControl(windowsPage);
                    }

                    authenticator.Completed -= Authenticator_Completed;
                    authenticator.Completed += Authenticator_Completed;
                    authenticator.Error     -= Authenticator_Error;
                    authenticator.Error     += Authenticator_Error;

                    Type pageType = authenticator.GetUI();
                    frame.Navigate(pageType, authenticator);
                    Windows.UI.Xaml.Window.Current.Activate();
                }
            }
            catch (Exception ex)
            {
                throw new Xamarin.Auth.AuthException("UWP OnElementChanged");
            }

            return;
        }
 public AuthenticatorPage(Xamarin.Auth.Authenticator a)
 {
 }
Esempio n. 6
0
        public static void PresentUILoginScreen
        (
            this Page page,
            Xamarin.Auth.Authenticator authenticator
        )
        {
            if (Settings.IsFormsImplementationRenderers)
            {
                // Renderers Implementaion

                Xamarin.Auth.XamarinForms.AuthenticatorPage ap;
                ap = new Xamarin.Auth.XamarinForms.AuthenticatorPage()
                {
                    Authenticator = authenticator,
                };

                NavigationPage np = new NavigationPage(ap);

                if (Settings.IsFormsNavigationPushModal)
                {
                    System.Diagnostics.Debug.WriteLine("Presenting");
                    System.Diagnostics.Debug.WriteLine("        PushModal");
                    System.Diagnostics.Debug.WriteLine("        Custom Renderers");

                    page.Navigation.PushModalAsync(np);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Presenting");
                    System.Diagnostics.Debug.WriteLine("        Push");
                    System.Diagnostics.Debug.WriteLine("        Custom Renderers");

                    page.Navigation.PushAsync(np);
                }
            }
            else
            {
                // Presenters Implementation

                if (Settings.IsFormsNavigationPushModal)
                {
                    System.Diagnostics.Debug.WriteLine("Presenting");
                    System.Diagnostics.Debug.WriteLine("        PushModal");
                    System.Diagnostics.Debug.WriteLine("        Presenters");

                    Xamarin.Auth.Presenters.OAuthLoginPresenter presenter = null;
                    presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
                    presenter.Login(authenticator);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Presenting");
                    System.Diagnostics.Debug.WriteLine("        Push");
                    System.Diagnostics.Debug.WriteLine("        Presenters");

                    Xamarin.Auth.Presenters.OAuthLoginPresenter presenter = null;
                    presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
                    presenter.Login(authenticator);
                }
            }

            return;
        }