private void Authenticate_SpecifiedUser_Click(object sender, RoutedEventArgs e)
        {
            LogTextBox.Clear();

            try
            {
                var userName = InputBox.Show("User name:");

                Log("User name: {0}", userName);

                var dialog = new AuthenticationDialog();
                dialog.Title        = ".NET SDK Sample";
                dialog.Description  = ((Button)sender).Content.ToString();
                dialog.ParentWindow = new WindowInteropHelper(this).Handle;
                dialog.UserName     = userName;

                Log("Show dialog");

                if (dialog.ShowDialog())
                {
                    Log("OK");
                    Log("User name: {0}", dialog.UserName);
                    Log("Authenticated credentials: {0}", String.Join(", ", dialog.AuthenticatedCredentials));
                }
                else
                {
                    Log("Cancelled");
                }
            }
            catch (Exception ex)
            {
                Log("Error: {0}", ex.Message);
            }
        }
Пример #2
0
        private void CancelOrderButton_Click(object sender, RoutedEventArgs e)
        {
            var selectedOrder = OrderPaymentsDataGrid.SelectedItem as Order;

            if (selectedOrder == null)
            {
                MessageBox.Show("Please select and verify an order to continue");
            }
            else
            {
                var msgBoxResult = MessageBox.Show(
                    $"Do you  want to cancel the order [{selectedOrder.Id}][{selectedOrder.Date}]?",
                    "Confirmation",
                    MessageBoxButton.YesNo);
                if (msgBoxResult != MessageBoxResult.Yes)
                {
                    return;
                }

                var authWindow = new AuthenticationDialog();
                authWindow.ShowDialog();
                if (authWindow.DialogResult != true)
                {
                    return;
                }
                _orderHandler.UpdateOrder(selectedOrder, isCancelled: true);
                MessageBox.Show("Successfully Cancelled the order :" + selectedOrder.Id);
                ReloadOrderPayments();
            }
        }
Пример #3
0
        public string PromptForLogin(string uri)
        {
            // first look in password cache
            string login = TeamFoundationSettings.Current.Get(uri);

            if (!String.IsNullOrEmpty(login))
            {
                return(login);
            }

            // now prompt
            AuthenticationDialog dialog = new AuthenticationDialog(uri);

            dialog.ShowAll();
            int rc = dialog.Run();

            login = dialog.Login;
            dialog.Destroy();

            if (rc != Convert.ToInt32(ResponseType.Ok))
            {
                return(String.Empty);
            }
            return(login);
        }
        private void Authenticate_CheckSecretExistsSpecifiedUser_Click(object sender, RoutedEventArgs e)
        {
            LogTextBox.Clear();

            try
            {
                var userName   = InputBox.Show("User name:");
                var secretName = InputBox.Show("Secret name:");

                Log("User name: {0}", userName);
                Log("Secret name: {0}", secretName);

                var dialog = new AuthenticationDialog();
                dialog.Title        = ".NET SDK Sample";
                dialog.Description  = ((Button)sender).Content.ToString();
                dialog.ParentWindow = new WindowInteropHelper(this).Handle;
                dialog.UserName     = userName;

                var sercetExists = dialog.SecretExists(secretName);

                Log("Secret exists: {0}", sercetExists);
            }
            catch (Exception ex)
            {
                Log("Error: {0}", ex.Message);
            }
        }
        private void Authenticate_CusmonPolicy_Click(object sender, RoutedEventArgs e)
        {
            LogTextBox.Clear();

            try
            {
                var policy = new ulong[] { 1 | 2, 4 }; // password+fingerprints or smartcards

                Log("Custom policy: {0}", String.Join(", ", policy));

                var dialog = new AuthenticationDialog();
                dialog.Title                = ".NET SDK Sample";
                dialog.Description          = ((Button)sender).Content.ToString();
                dialog.ParentWindow         = new WindowInteropHelper(this).Handle;
                dialog.AuthenticationPolicy = policy;

                Log("Show dialog");

                if (dialog.ShowDialog())
                {
                    Log("OK");
                    Log("User name: {0}", dialog.UserName);
                    Log("Authenticated credentials: {0}", String.Join(", ", dialog.AuthenticatedCredentials));
                }
                else
                {
                    Log("Cancelled");
                }
            }
            catch (Exception ex)
            {
                Log("Error: {0}", ex.Message);
            }
        }
        private void OnClickBtnUploadAuthCtl(object sender, RoutedEventArgs e)
        {
            //this.container.Children.Clear();
            //this.container.Children.Add();

            var authDialog = new AuthenticationDialog();

            authDialog.ShowDialog();
        }
Пример #7
0
        private async void AuthenticateExtension(ExtensionObject Extension)
        {
            try
            {
                Boolean Authenticated = await AuthenticationDialog.ShowDialogAsync(Extension.Extension);

                Extension.Update(Extension.Extension, LoadIcon: false);
            }
            catch { }
            finally { }
        }
Пример #8
0
        /// <summary>
        /// Authenticates the user with the specified user name and password.
        /// </summary>
        /// <param name="userName">The user name.</param>
        /// <param name="password">The password.</param>
        public static void Authenticate(string userName, string password)
        {
            AuthenticationDialog winTemp2 = new AuthenticationDialog();

            if (winTemp2.UIUseAnotherAccountText.Exists)
            {
                Mouse.Click(winTemp2.UIUseAnotherAccountText);
            }
            winTemp2.UIUsernameEdit.Text = userName;
            winTemp2.UIPasswordEdit.Text = password;
            Mouse.Click(winTemp2.UIOKButton);
        }
Пример #9
0
        private void tokenToolStripMenuItemClick(object sender, EventArgs e)
        {
            using (AuthenticationDialog dialog = new AuthenticationDialog {
                AuthenticationCode = Settings.Default.Token
            })
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    Settings.Default.Token = dialog.AuthenticationCode;
                }
            }

            Settings.Default.Save();
        }
Пример #10
0
        private async void Window_ContentRendered(object sender, EventArgs e)
        {
            var view = new AuthenticationDialog {
            };

            await DialogHost.Show(view, "RootDialog");

            if (view.authDone)
            {
                MainNavFrame.Navigate(null);
                // MainNavFrame.Navigate(new DragDropAnalysisPage());
                MainNavFrame.Navigate(new HomePage());
            }
        }
Пример #11
0
    public string PromptForLogin(string serverUrl)
    {
        Application.Init();
        AuthenticationDialog dialog = new AuthenticationDialog(serverUrl);

        dialog.ShowAll();
        int rc = dialog.Run();

        string login = dialog.Login;

        dialog.Destroy();

        if (rc != Convert.ToInt32(ResponseType.Ok))
        {
            return(String.Empty);
        }
        return(login);
    }
        private void Authenticate_CusmonUserNameType_Click(object sender, RoutedEventArgs e)
        {
            LogTextBox.Clear();

            try
            {
                var userName = InputBox.Show("User name:");

                var userNameTypeValues = new Dictionary <string, int>();
                userNameTypeValues["SAM (domain\\user_name)"] = 3;
                userNameTypeValues["DpAccount (user_name)"]   = 9;
                var userNameType = ChooseBox.Show <int>("User name type:", userNameTypeValues);

                Log("User name: {0}", userName);
                Log("User name: {0}", userNameType);

                var dialog = new AuthenticationDialog();
                dialog.Title        = ".NET SDK Sample";
                dialog.Description  = ((Button)sender).Content.ToString();
                dialog.ParentWindow = new WindowInteropHelper(this).Handle;
                dialog.UserName     = userName;
                dialog.UserNameType = userNameType;

                Log("Show dialog");

                if (dialog.ShowDialog())
                {
                    Log("OK");
                    Log("User name: {0}", dialog.UserName);
                    Log("Authenticated credentials: {0}", String.Join(", ", dialog.AuthenticatedCredentials));
                }
                else
                {
                    Log("Cancel");
                }
            }
            catch (Exception ex)
            {
                Log("Error: {0}", ex.Message);
            }
        }
        private void Authenticate_CusmonPolicyModified_Click(object sender, RoutedEventArgs e)
        {
            LogTextBox.Clear();

            try
            {
                var dialog = new AuthenticationDialog();
                dialog.Title        = ".NET SDK Sample";
                dialog.Description  = ((Button)sender).Content.ToString();
                dialog.ParentWindow = new WindowInteropHelper(this).Handle;
                dialog.UserName     = Environment.UserDomainName + "\\" + Environment.UserName;

                var policy = dialog.ReadAuthPolicy();
                Log("Original policy: {0}", String.Join(", ", policy));

                policy = policy.Where(p => (p & 1) != p).ToArray(); // remove password
                Log("Modified policy: {0}", String.Join(", ", policy));

                dialog.AuthenticationPolicy = policy;

                Log("Show dialog");

                if (dialog.ShowDialog())
                {
                    Log("OK");
                    Log("User name: {0}", dialog.UserName);
                    Log("Authenticated credentials: {0}", String.Join(", ", dialog.AuthenticatedCredentials));
                }
                else
                {
                    Log("Cancel");
                }
            }
            catch (Exception ex)
            {
                Log("Error: {0}", ex.Message);
            }
        }
 public static NetworkCredential GetUsernameAndPassword(bool forceNew)
 {
     return(AuthenticationDialog.GetCredential(ApplicationCredentialId, Strings.AuthenticationCaption, Strings.AuthenticationMessage, forceNew));
 }