Exemplo n.º 1
0
        /// <summary>
        /// Accepts a drop event
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (isDirectory)
            {
                BaseTreeNode parent = Parent as BaseTreeNode;
                parent.AcceptDrop(SourceNode);
            }
            else
            {
                if (SourceNode is VariableTreeNode)
                {
                    variables.AcceptDrop(SourceNode);
                }
                else if (SourceNode is ProcedureTreeNode)
                {
                    procedures.AcceptDrop(SourceNode);
                }
                else if (SourceNode is RuleTreeNode)
                {
                    rules.AcceptDrop(SourceNode);
                }
                else if (SourceNode is StructureTreeNode)
                {
                    structures.AcceptDrop(SourceNode);
                }
                else if (SourceNode is NameSpaceTreeNode)
                {
                    NameSpaceTreeNode nameSpaceTreeNode      = SourceNode as NameSpaceTreeNode;
                    DataDictionary.Types.NameSpace nameSpace = nameSpaceTreeNode.Item;

                    nameSpaceTreeNode.Delete();
                    AddNameSpace(nameSpace);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Accepts a drop event
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (_isDirectory)
            {
                BaseTreeNode parent = Parent as BaseTreeNode;
                if (parent != null)
                {
                    parent.AcceptDrop(sourceNode);
                }
            }
            else
            {
                if (sourceNode is VariableTreeNode)
                {
                    NameSpaceVariablesTreeNode node = SubNode <NameSpaceVariablesTreeNode>();
                    if (node != null)
                    {
                        node.AcceptDrop(sourceNode);
                    }
                }
                else if (sourceNode is ProcedureTreeNode)
                {
                    NameSpaceProceduresTreeNode node = SubNode <NameSpaceProceduresTreeNode>();
                    if (node != null)
                    {
                        node.AcceptDrop(sourceNode);
                    }
                }
                else if (sourceNode is RuleTreeNode)
                {
                    NameSpaceRulesTreeNode node = SubNode <NameSpaceRulesTreeNode>();
                    if (node != null)
                    {
                        node.AcceptDrop(sourceNode);
                    }
                }
                else if (sourceNode is StructureTreeNode)
                {
                    StructuresTreeNode node = SubNode <StructuresTreeNode>();
                    if (node != null)
                    {
                        node.AcceptDrop(sourceNode);
                    }
                }
                else if (sourceNode is FunctionTreeNode)
                {
                    FunctionsTreeNode node = SubNode <FunctionsTreeNode>();
                    if (node != null)
                    {
                        node.AcceptDrop(sourceNode);
                    }
                }
                else if (sourceNode is InterfaceTreeNode)
                {
                    InterfacesTreeNode node = SubNode <InterfacesTreeNode>();
                    if (node != null)
                    {
                        node.AcceptDrop(sourceNode);
                    }
                }
                else if (sourceNode is NameSpaceTreeNode)
                {
                    DialogResult result = MessageBox.Show(
                        Resources.NameSpaceTreeNode_AcceptDrop_This_will_move_the_namespace__are_you_sure___,
                        Resources.NameSpaceTreeNode_AcceptDrop_Confirm_moving_the_namespace,
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Question);
                    if (result == DialogResult.OK)
                    {
                        NameSpaceTreeNode nameSpaceTreeNode = sourceNode as NameSpaceTreeNode;
                        NameSpace         nameSpace         = nameSpaceTreeNode.Item;

                        nameSpaceTreeNode.Delete();
                        Item.appendNameSpaces(nameSpace);
                    }
                }
            }
        }