Ejemplo n.º 1
0
        private async void OnPrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            try
            {
                DisableInput();
                VerifyInput();
                if (isValidInput)
                {
                    ShowProgressBar();
                    var server  = new RemoteServer(null);
                    var hostKey = await server.HostKey(userName, passWord);

                    if (hostKey != null)
                    {
                        var vault = new Windows.Security.Credentials.PasswordVault();
                        vault.Add(new Windows.Security.Credentials.PasswordCredential(VAULT_RESOURCE, VAULT_USERNAME, hostKey));
                        isLoginSuccess = true;
                        Close();
                    }
                }
            }
            catch (Exception ex)
            {
                isLoginSuccess = false;
                Close();
                await UIHelper.ShowMessageDialog(ex.Message);
            }
        }