コード例 #1
0
 private void promptToDeleteIfNeeded()
 {
     if (lvUsers.SelectedItems.Count > 0)
     {
         if (DialogResult.Yes == MessageBox.Show(this, getDisplayMember("promptToDeleteIfNeeded{start_body}", "Are you sure you want to delete the selected user(s)?"),
                                                 getDisplayMember("promptToDeleteIfNeeded{start_title}", "Delete User(s)?"), MessageBoxButtons.YesNo, MessageBoxIcon.Question))
         {
             using (new AutoCursor(this)) {
                 var count = 0;
                 foreach (ListViewItem lvi in lvUsers.SelectedItems)
                 {
                     try {
                         AdminProxy.DeleteUser(Toolkit.ToInt32(lvi.Tag, -1));
                         count++;
                     } catch (Exception ex) {
                         MessageBox.Show(this, ex.Message, getDisplayMember("promptToDeleteIfNeeded{failed}", "Error Deleting User"));
                     }
                 }
                 MainFormRefreshData();
                 MainFormUpdateStatus(getDisplayMember("promptToDeleteIfNeeded{done}", "Deleted {0} user(s)", count.ToString("###,##0")), true);
             }
         }
     }
 }