Beispiel #1
0
        private void OnDeleteGroupClick(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确认要删除么?此组下的所有账号都会被删除。", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    GroupNode gn = this.SelectedNode as GroupNode;
                    if (gn != null)
                    {
                        string ret = ConfigCtrl.DeleteGroup(gn.GroupName);
                        if (ret != Constants.STATUS_SUCCESS)
                        {
                            MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        BaseNode bn = (BaseNode)gn.Parent;
                        bn.Nodes.Remove(gn);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ShowMessageBox(TreeConstants.EXCEPTION_MODULE, ex);
            }
        }