Example #1
0
        private void Command_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            RoutedUICommand r = e.Command as RoutedUICommand;

            if (r == null)
            {
                return;
            }
            MainWindow mainWindow = Owner as MainWindow;

            if (mainWindow == null)
            {
                return;
            }
            switch (r.Name)
            {
            case "CopyLogin":
                mainWindow.CopyToClipboard(textBoxLogin.Text, false);
                break;

            case "CopyPassword":
                bool pwdcheck = false;
                var  pwd      = passwordBox.SecurePassword;
                if (!pwdChanged && Password != null)
                {
                    pwd      = Password.SecurePassword;
                    pwdcheck = true;
                }
                mainWindow.CopyToClipboard(pwd.GetAsString(), pwdcheck);
                break;

            case "OpenURL":
                mainWindow.OpenURL(textBoxUrl.Text);
                break;

            case "GeneratePassword":
                mainWindow.GeneratePassword();
                break;

            default:
                break;
            }
        }
Example #2
0
        private void Command_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            RoutedUICommand r = e.Command as RoutedUICommand;

            if (r == null)
            {
                return;
            }
            MainWindow mainWindow = Owner as MainWindow;

            if (mainWindow == null)
            {
                return;
            }
            switch (r.Name)
            {
            case "GeneratePassword":
                mainWindow.GeneratePassword();
                break;

            default:
                break;
            }
        }