Ejemplo n.º 1
0
 /// <summary>
 /// Function called when this frame is navigated to.
 /// Checks to see if Microsoft Passport is available and if an account was passed in.
 /// If an account was passed in set the "_isExistingAccount" flag to true and set the _account
 /// </summary>
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     // Check Microsoft Passport is setup and available on this machine
     if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
     {
         //how the f**k wont e.Parameter be null
         if (e.Parameter != null)
         {
             _AmIForeign = true;
             // Set the account to the existing account being passed in
             _account             = (Account)e.Parameter;
             UsernameTextBox.Text = _account.Username;
             SignInPassport();
         }
         //end up doing nothing
     }
     else
     {
         // Microsoft Passport is not setup so inform the user
         PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207));
         PassportStatusText.Text   = "Microsoft Passport is not setup!\n" +
                                     "Please go to Windows Settings and set up a PIN to use it.";
         PassportSignInButton.IsEnabled = false;
     }
 }
        private async void SignInPassport()
        {
            if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
            {
                if (await MicrosoftPassportHelper.CreatePassportKeyAsync(thisuser.UserName))
                {
                    var _account = AccountHelper.AddAccount(thisuser.UserName);

                    var dialog = new ContentDialog
                    {
                        Title   = "Notice",
                        Content = "You have successfully added this list",
                        IsPrimaryButtonEnabled = true,
                        PrimaryButtonText      = "OK",
                    };
                    await dialog.ShowAsync();
                }
            }
            else
            {
                var dialog = new ContentDialog
                {
                    Title   = "Notice",
                    Content = "Microsoft Passport is not setup!\n" +
                              "Please go to Windows Settings and set up a PIN to use it.",
                    IsPrimaryButtonEnabled = true,
                    PrimaryButtonText      = "OK",
                };
                await dialog.ShowAsync();
            }
        }
Ejemplo n.º 3
0
        public MainViewModel()
        {
            PassportSignInCommand = new RelayCommand(() =>
            {
                ErrorMessageText = "";
                SignInPassport();
            });

            NavigatedToCommand = new RelayCommand(async() =>
            {
                // Check Microsoft Passport is setup and available on this machine
                if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
                {
                }
                else
                {
                    // Microsoft Passport is not setup so inform the user
                    PassportStatusBackground = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207));
                    PassportStatusText       = "Microsoft Passport is not setup!\n" +
                                               "Please go to Windows Settings and set up a PIN to use it.";
                    IsPassportSignInEnabled = false;
                }
            });

            RegisterPointerPressedCommand = new RelayCommand <object>((param) =>
            {
                ErrorMessageText = "";
            });
        }
Ejemplo n.º 4
0
 protected override async void OnContentRendered(EventArgs e)
 {
     // Check Microsoft Passport is setup and available on this machine
     if (_useWindowsHello && await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
     {
         PasswordTextBox.Visibility = System.Windows.Visibility.Collapsed;
     }
 }
Ejemplo n.º 5
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     // Check Microsoft Passport is setup and available on this machine
     if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
     {
     }
     else
     {
         // Microsoft Passport is not setup so inform the user
         PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207));
         PassportStatusText.Text   = "Microsoft Passport is not setup!\n" +
                                     "Please go to Windows Settings and set up a PIN to use it.";
         PassportSignInButton.IsEnabled = false;
     }
 }
Ejemplo n.º 6
0
        //protected override async void OnNavigatedTo(NavigationEventArgs e)
        //{
        ////    Check Microsoft Passport is setup and available on this machine
        //    if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
        //    {
        //        if (e.Parameter != null)
        //        {
        //            _isExistingAccount = true;
        //            Set the account to the existing account being passed in
        //            _account = (Account)e.Parameter;
        //            UsernameTextBox.Text = _account.Username;
        //            SignInPassport();
        //        }

        //    }
        //    else
        //    {
        ////        Microsoft Passport is not setup so inform the user
        //        PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207));
        //        PassportStatusText.Text = "Microsoft Passport is not setup!\n" +
        //            "Por favor vaya a la configuración de Windows y y establezca un PIN.\n" +
        //            "Please go to Windows Settings and set up a PIN to use it.";
        //        PassportSignInButton.IsEnabled = false;
        //    }
        //}


        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            //Check Microsoft Passport is setup and available on this machine
            if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
            {
                if (e.Parameter != null)
                {
                    _isExistingAccount = true;
                    //Set the account to the existing account being passed in
                    _account             = (UserAccount)e.Parameter;
                    UsernameTextBox.Text = _account.Username;
                    //SignInPassport();
                    SignInPassportAsync();
                }
            }
        }
Ejemplo n.º 7
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
     {
         if (e.Parameter != null)
         {
             _isExistingLocalAccount = true;
             ///_account = (Account)e.Parameter;
             _account             = (UserAccount)e.Parameter;
             UsernameTextBox.Text = _account.Username;
             SignInPassportAsync();
         }
     }
     else
     {
         PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207));
         PassportStatusText.Text   = "Microsoft Passport is not setup!\n" +
                                     "Please go to Windows Settings and set up a PIN to use it.";
         PassportSignInButton.IsEnabled = false;
     }
 }
Ejemplo n.º 8
0
        private async void DeviceLoginButton_Click(object sender, RoutedEventArgs e)
        {
            // Check Microsoft Passport is setup and available on this machine
            if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
            {
                if (await MicrosoftPassportHelper.CreatePassportKeyAsync("yao"))
                {
                    Frame.Navigate(typeof(ServicePage), new userItem("firends"));
                }
            }
            else
            {
                var dialog = new ContentDialog
                {
                    Title   = "Notice",
                    Content = "Microsoft Passport is not setup!\n" +
                              "Please go to Windows Settings and set up a PIN to use it.",
                    IsPrimaryButtonEnabled = true,
                    PrimaryButtonText      = "OK",
                };

                await dialog.ShowAsync();
            }
        }
Ejemplo n.º 9
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync())
     {
     }
 }