示例#1
0
        private void OnDeleteClick(object o, EventArgs e)
        {
            if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK)
            {
                ServerNode sn       = (ServerNode)this.SelectedNode;
                ServerInfo dbServer = new ServerInfo();
                dbServer = sn.Server;
                if (dbServer != null)
                {
                    string ret = ConfigCtrl.DeleteServer(dbServer);
                    if (ret != CGConstants.STATUS_SUCCESS)
                    {
                        MessageBox.Show(ret, CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    BaseNode bn = (BaseNode)sn.Parent;
                    bn.Nodes.Remove(sn);
                }
            }
        }