private void Login(HolisticWare.Auth.OAuth1 oauth1)
        {
            global::Xamarin.Auth._MobileServices.OAuth1Authenticator auth =
                new global::Xamarin.Auth._MobileServices.OAuth1Authenticator
                (
                    consumerKey: oauth1.OAuth_IdApplication_IdAPI_KeyAPI_IdClient_IdCustomer,
                    consumerSecret: oauth1.OAuth1_SecretKey_ConsumerSecret_APISecret,
                    requestTokenUrl: oauth1.OAuth1_UriRequestToken,
                    authorizeUrl: oauth1.OAuth_UriAuthorization,
                    accessTokenUrl: oauth1.OAuth1_UriAccessToken,
                    callbackUrl: oauth1.OAuth_UriCallbackAKARedirect,
                    getUsernameAsync: null
                );

            auth.Completed += auth_Completed;

            //PresentViewController (auth.GetUI (), true, null);

            Uri uri = auth.GetUI();
            var rv  = System.Windows.Application.Current.RootVisual;

            Microsoft.Phone.Controls.PhoneApplicationFrame paf = null;

            paf = rv as Microsoft.Phone.Controls.PhoneApplicationFrame;
            paf.Navigate(uri);

            return;
        }
Exemple #2
0
        private void auth_Completed(object sender, global::Xamarin.Auth.AuthenticatorCompletedEventArgs e)
        {
            if (e.IsAuthenticated)
            {
                // e.Account contains info:
                //		e.AccountProperties[""]
                //
                // use access tokenmore detailed user info from the API

                this.AccountProperties = e.Account.Properties;
            }
            else
            {
                // The user cancelled
            }

            // dismiss UI on iOS, because it was manually created
            //DismissViewController(true, null);

            // possibly do something to dismiss THIS viewcontroller,
            // or else login screen does not disappear

            Uri uri = auth.GetUI();
            var rv  = System.Windows.Application.Current.RootVisual;

            Microsoft.Phone.Controls.PhoneApplicationFrame paf = null;

            paf = rv as Microsoft.Phone.Controls.PhoneApplicationFrame;
            paf.Navigate(uri);

            return;
        }
        public InfoLinkDecal()
        {
            MetaData = new InfoLinkMetaData()
            {
                Source = "http://"
            };
            Stretch   = System.Windows.Media.Stretch.Uniform;
            Size      = 1;
            CanResize = false;
            Stretch   = System.Windows.Media.Stretch.None;
            Center    = new System.Windows.Point(1, 1);
            PinPoint  = new System.Windows.Point(1, 1);
            CanMove   = false;

            OpenUrl = new DelegateCommand(() =>
            {
                if (!MetaData.Source.StartsWith("http://"))
                {
                    MetaData.Source = "http://" + MetaData.Source;
                }
#if WINDOWS_PHONE
                Microsoft.Phone.Controls.PhoneApplicationFrame frame = Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame;
                frame.Navigate(new Uri(MetaData.Source));
#elif SILVERLIGHT
                HtmlPage.Window.Navigate(new Uri(MetaData.Source), "_blank");
#else
                Process.Start(MetaData.Source);
#endif
            }, CanOpenUrl);
        }
        private static void _instance_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName != "GameMode")
            {
                return;
            }

            Microsoft.Phone.Controls.PhoneApplicationFrame phoneApplicationFrame = (Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame);

            switch (MainViewModel.Instance.GameMode)
            {
            case GameModes.DownloadDeck:
                if (phoneApplicationFrame.Source.ToString() != "/Views/DownloadPage.xaml")
                {
                    phoneApplicationFrame.Navigate(new Uri("/Views/DownloadPage.xaml", UriKind.Relative));
                }
                break;

            case GameModes.GameSelect:
                if (phoneApplicationFrame.Source.ToString() != "/Views/SelectGamePage.xaml")
                {
                    phoneApplicationFrame.Navigate(new Uri("/Views/SelectGamePage.xaml", UriKind.Relative));
                }
                break;

            case GameModes.LearningGame:
                if (phoneApplicationFrame.Source.ToString() != "/Views/LearningPage.xaml")
                {
                    phoneApplicationFrame.Navigate(new Uri("/Views/LearningPage.xaml", UriKind.Relative));
                }
                break;

            case GameModes.MatchingGame:
                if (phoneApplicationFrame.Source.ToString() != "/Views/MatchingPage.xaml")
                {
                    phoneApplicationFrame.Navigate(new Uri("/Views/MatchingPage.xaml", UriKind.Relative));
                }
                break;

            case GameModes.MemoryGame:
                if (phoneApplicationFrame.Source.ToString() != "/Views/MatchingPage.xaml")
                {
                    phoneApplicationFrame.Navigate(new Uri("/Views/MatchingPage.xaml", UriKind.Relative));
                }
                break;
            }
        }
Exemple #5
0
        private void Login(HolisticWare.Auth.OAuth2 oauth2)
        {
            global::Xamarin.Auth.OAuth2Authenticator auth = null;

            if (
                null == oauth2.OAuth1_UriAccessToken)
            {
                try
                {
                    auth =
                        new global::Xamarin.Auth.OAuth2Authenticator(
                            clientId: oauth2.OAuth_IdApplication_IdAPI_KeyAPI_IdClient_IdCustomer,
                            scope: oauth2.OAuth2_Scope,
                            authorizeUrl: oauth2.OAuth_UriAuthorization,
                            redirectUrl: oauth2.OAuth_UriCallbackAKARedirect,
                            getUsernameAsync: null
                            );
                }
                catch (System.Exception exc)
                {
                    throw exc;
                }
            }
            else
            {
                try
                {
                    auth =
                        new global::Xamarin.Auth.OAuth2Authenticator
                        (
                            clientId: oauth2.OAuth_IdApplication_IdAPI_KeyAPI_IdClient_IdCustomer,
                            clientSecret: oauth2.OAuth1_SecretKey_ConsumerSecret_APISecret,
                            scope: oauth2.OAuth2_Scope,
                            authorizeUrl: oauth2.OAuth_UriAuthorization,
                            redirectUrl: oauth2.OAuth_UriCallbackAKARedirect,
                            accessTokenUrl: oauth2.OAuth1_UriAccessToken,
                            getUsernameAsync: null
                        );
                }
                catch (System.Exception exc)
                {
                    throw exc;
                }
            }
            auth.Completed += auth_Completed;


            Uri uri = auth.GetUI();
            var rv  = System.Windows.Application.Current.RootVisual;

            Microsoft.Phone.Controls.PhoneApplicationFrame paf = null;

            paf = rv as Microsoft.Phone.Controls.PhoneApplicationFrame;
            paf.Navigate(uri);

            return;
        }