Esempio n. 1
0
        public virtual void createObjectInstance(CustomContextMenuTag clickedItemTag)
        {
            CustomTreeView myTree = (CustomTreeView)this.TreeView;

            // bring up a form for input
            //InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), clickedItemTag.GetNode().NodeType); // create the dialog
            InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), "CreateEvent"); // create the dialog
            tempInput.StartPosition = FormStartPosition.Manual;
            int x = Cursor.Position.X;
            int y = Cursor.Position.Y;
            tempInput.Location = new Point(x, y);

            DialogResult result = tempInput.ShowDialog(myTree);

            if (result == DialogResult.OK)
            {
                // create a resource
                String name = tempInput.TopInputFieldValue;

                if (NodeType.ToLowerInvariant() != name.ToLowerInvariant())
                {
                    try
                    {
                        int addID;
                        if (NodeID >= 0) // fake nodes are -1
                        {
                            addID = NodeID;
                        }
                        else
                        {
                            addID = myTree.GetCustomTreeRootId(this.LinkType);
                        }
                        //int added = myTree.Controller.AddComponent(myTree.GetCustomTreeRootId(this.LinkType), addID, NodeType, tempInput.TopInputFieldValue, this.LinkType, tempInput.BottomInputFieldValue);
                        //myTree.OnItemAdd(clickedItemTag.GetFunctionValue(), added, NodeType, tempInput.TopInputFieldValue);
                        //int ceId = myTree.Controller.CreateComponent("CreateEvent", tempInput.TopInputFieldValue, tempInput.BottomInputFieldValue);

                        myTree.Controller.TurnViewUpdateOff(); // because add and connect will both send out component udpates and update the whole screen
                        
                        ComponentAndLinkID added = myTree.Controller.AddComponent(myTree.GetCustomTreeRootId(this.LinkType), myTree.GetCustomTreeRootId(this.LinkType), "CreateEvent", tempInput.TopInputFieldValue, this.LinkType, tempInput.BottomInputFieldValue);
                        int ceLinkId = myTree.Controller.Connect(myTree.GetCustomTreeRootId(this.LinkType), added.ComponentID, clickedItemTag.GetNode().NodeID, this.LinkType);
                        myTree.OnItemAdd(clickedItemTag.GetFunctionValue(), added.ComponentID, ceLinkId, "CreateEvent", tempInput.TopInputFieldValue, this.LinkType);

                        myTree.Controller.TurnViewUpdateOn(false, false); // update should be locale to this tree, so

                        myTree.UpdateViewComponent(); // update manually
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Unable to add item", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Cannot enter item with same name as parent type");
                }
            }
        }
Esempio n. 2
0
        public virtual void AddClass(CustomContextMenuTag clickedItemTag)
        {
            CustomTreeView myTree = (CustomTreeView)this.TreeView;
 
            // bring up a form for input
            InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), clickedItemTag.GetNode().myType); // create the dialog
            tempInput.StartPosition = FormStartPosition.Manual;
            int x = Cursor.Position.X;
            int y = Cursor.Position.Y;
            tempInput.Location = new Point(x, y);
            DialogResult result = tempInput.ShowDialog(myTree);

            if (result == DialogResult.OK)
            {
                // create a resource
                String name = tempInput.TopInputFieldValue;

                if (NodeType.ToLowerInvariant() != name.ToLowerInvariant())
                {
                    try
                    {
                        int addID;
                        if (NodeID >= 0) // fake nodes are -1
                        {
                            addID = NodeID;
                        }
                        else
                        {
                            addID = myTree.GetCustomTreeRootId(LinkType);// myTree.RootID;
                        }
                        //myTree.RootID
                        ComponentAndLinkID added = myTree.Controller.AddComponentClass(myTree.GetCustomTreeRootId(LinkType), addID, NodeType, tempInput.TopInputFieldValue, LinkType, tempInput.BottomInputFieldValue);
                        myTree.OnItemAdd(clickedItemTag.GetFunctionValue(), added.ComponentID, added.LinkID, NodeType, tempInput.TopInputFieldValue, LinkType);
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Unable to add item", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Cannot enter item with same name as parent type");
                }
            }
        }
Esempio n. 3
0
        public virtual void CreateComponent(CustomContextMenuTag clickedItemTag)
        {
            // bring up a form for input
            String type = clickedItemTag.GetNode().myType;
            InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), type); // create the dialog
            tempInput.StartPosition = FormStartPosition.Manual;
            int x = Cursor.Position.X;
            int y = Cursor.Position.Y;
            tempInput.Location = new Point(x, y);

            if (!useDescription)
            {
                tempInput.HideDescriptionField();
            }

            CommonCreate(tempInput, clickedItemTag, type);
        }
Esempio n. 4
0
        public virtual void CreateComponent(CustomContextMenuTag clickedItemTag, Object[] args)
        {
            String type = clickedItemTag.GetNode().myType;

            if (args.Length == 1)
            {
                String var = args[0].ToString();
                Boolean useDesc = Boolean.Parse(var);
                this.useDescription = useDesc;
                this.CreateComponent(clickedItemTag);
                this.useDescription = true; // reset
            }
            else if (args.Length >= 2)
            {
                if (args.Length == 3)
                {
                    type = (String)args[2];
                }

                // bring up a form for input
                InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), type); // create the dialog
                tempInput.StartPosition = FormStartPosition.Manual;
                int x = Cursor.Position.X;
                int y = Cursor.Position.Y;
                tempInput.Location = new Point(x, y);

                if (args.Length >= 1)
                {
                    tempInput.AlphaNumericTop = Boolean.Parse((String)args[0]);
                }

                if (args.Length >= 2)
                {
                    tempInput.AlphaNumericBottom = Boolean.Parse((String)args[0]);
                }

                if (!useDescription)
                {
                    tempInput.HideDescriptionField();
                }

                CommonCreate(tempInput, clickedItemTag, type);
            }
        }
Esempio n. 5
0
        public virtual void RenameComponent(CustomContextMenuTag clickedItemTag)
        {
            // bring up a form for input
            InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), clickedItemTag.GetNode().myType); // create the dialog
            tempInput.StartPosition = FormStartPosition.Manual;
            tempInput.ButtonAddText = "OK";
            int x = Cursor.Position.X;
            int y = Cursor.Position.Y;
            tempInput.Location = new Point(x, y);

            CommonRename(tempInput, clickedItemTag);
        }
Esempio n. 6
0
        public virtual void RenameComponent(CustomContextMenuTag clickedItemTag, Object[] args)
        {
            InputForm tempInput = new InputForm(clickedItemTag.GetFunctionName(), clickedItemTag.GetNode().myType);
            tempInput.StartPosition = FormStartPosition.Manual;
            tempInput.ButtonAddText = "OK";
            int x = Cursor.Position.X;
            int y = Cursor.Position.Y;
            tempInput.Location = new Point(x, y);

            if (args.Length >= 1)
            {
                tempInput.AlphaNumericTop = Boolean.Parse((String)args[0]);
            }

            if (args.Length >= 2)
            {
                tempInput.AlphaNumericBottom = Boolean.Parse((String)args[0]);
            }

            CommonRename(tempInput, clickedItemTag);
        }