コード例 #1
0
        private async void ModifyPassword()
        {
            if (_SelectedPasswordIndex == -1)
            {
                MessageBox.Show(_View, "No selected password", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            PasswordWrapper entry = _Passwords[_SelectedPasswordIndex];

            NewPasswordView passwordView = new NewPasswordView(entry.WrappedItem)
            {
                Owner = _View
            };

            if (passwordView.ShowDialog() == true)
            {
                var response = await _Client.ModifyPasswordAsync(entry.WrappedItem);

                if (response.Success)
                {
                    MessageBox.Show(_View, "Modified password successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show(_View, "Problem modifying the password", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show(_View, "Modification Cancelled", "Cancelled", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
コード例 #2
0
 public NewPasswordViewModel(NewPasswordView view, Pswmgr.PasswordEntry entry = null)
 {
     _ExistingEntry = entry != null;
     _View          = view;
     _Model         = entry ?? new Pswmgr.PasswordEntry();
     _OKCommand     = new DelegateCommand(OnOk, DataCompleted);
 }
コード例 #3
0
        protected override void Execute()
        {
            NewPasswordView passwordView = new NewPasswordView()
            {
                Owner = _View
            };

            if (passwordView.ShowDialog() == true)
            {
                AddPassword(passwordView.ViewModel.Model);
            }
        }