Esempio n. 1
0
        private void OnDeleteClick(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确认要删除么?", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    AccountNode un      = this.SelectedNode as AccountNode;
                    AccountInfo account = null;
                    if (un != null)
                    {
                        account = un.Account;
                    }
                    if (account != null)
                    {
                        GroupNode gn  = (GroupNode)un.Parent;
                        string    ret = ConfigCtrl.DeleteAccount(gn.GroupName, account);
                        if (ret != Constants.STATUS_SUCCESS)
                        {
                            MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        gn.Nodes.Remove(un);
                        gn.Text = gn.GroupName + "(" + gn.Nodes.Count + ")";
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ShowMessageBox(TreeConstants.EXCEPTION_MODULE, ex);
            }
        }