Beispiel #1
0
        public void RemoveValDesc()
        {
            var selectedNode = treeView.SelectedNode;

            if (selectedNode != null && selectedNode.Tag is VdfValueDesc valDesc)
            {
                if (MessageBox.Show("请确认是否需要移除值描述[" + valDesc.Name + "]?", "移除值描述确认",
                                    MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return;
                }

                try
                {
                    vdfDocument.RemoveValueDescription(valDesc.Name);
                    selectedNode.Parent.Nodes.Remove(selectedNode);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Remove Value Description " + valDesc.Name + " Failed",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }