private void Reject_Click(object sender, RoutedEventArgs e) { Button senderButton = sender as Button; IdentityResult result; AppUser user; if (senderButton.DataContext is AppUser) { user = (AppUser)senderButton.DataContext; result = helper.RejectRegisterRequest(user); if (result.AreSameWith(IdentityResult.Success())) { MessageBox.Show("拒绝用户审批成功!"); approvallist.Remove(user); approval_list.ItemsSource = null; approval_list.ItemsSource = approvallist; } else { MessageBox.Show(string.Join(",", result.Errors)); } } else { result = IdentityResult.Error("待审批的用户不存在."); MessageBox.Show("错误:待审批的用户不存在."); } }