示例#1
0
        protected async override void OnStart()
        {
            // Handle when your app starts
            var userInfo = await AuthenticationService.GetCachedSignInToken();

            if (userInfo != null)
            {
                Secured.Title = "Logged In";
                var authView = new AuthRequiredView();
                await authView.InitializeDisplay(userInfo);

                Secured.Content = authView;
            }
            else
            {
                Secured.Title   = "Not Logged In";
                Secured.Content = new LoginView();
            }
        }
        async void Handle_Clicked(object sender, System.EventArgs e)
        {
            UserInfo userInfo = null;

            userInfo = await AuthenticationService.GetSignInUpToken();

            if (userInfo != null)
            {
                var authReqView = new AuthRequiredView();
                await authReqView.InitializeDisplay(userInfo);

                App.Secured.Content = authReqView;
                App.Secured.Title   = "Logged In";
                return;
            }

            await Application.Current.MainPage
            .DisplayAlert("Login Error", "An error occurred while logging in", "OK");
        }