/// <summary>
        /// This function is called when the user drops a node in the menu
        /// </summary>
        /// <param name="node">the node instance you want to add to the current group</param>
        public void DropNode(NodeViewManager node)
        {
            if (!this.nodeGroupList.ContainsKey(node))
            {
                node.Node.IsDisposable = false;

                ObjectGroupListItem item = new ObjectGroupListItem();
                node.Node.GUIDataChanged += delegate(object sender, EventArgs args)
                {
                    item.objectTitle.Text = node.Node.Title;
                };

                item.objectTitle.Text = node.Node.Title;
                this.nodeGroupList.Add(node, item);

                item.suppressButtonImage.MouseLeftButtonUp +=
                    delegate(object sender, MouseButtonEventArgs args)
                {
                    this.nodeGroupList.Remove(node);
                    node.Node.IsDisposable = true;
                    this.UpdateFromGroupList();
                };

                this.UpdateFromGroupList();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// this function sets a visual component to the node in argument
        /// the visual content depend of the node style reference and the current style configuration.
        /// </summary>
        /// <param name="node">the node model</param>
        public void SetViewToNode(model.Node node)
        {
            bool exist = false;
            foreach (NodeViewManager item in this.nodeViewList)
            {
                exist |= item.Node == node;
            }

            if (exist)
            {
                // if the node already have a view manager, then return>
                return;
            }

            // create the class
            NodeViewManager nodeViewManager = new NodeViewManager(node, this);
            nodeViewManager.DragedAndMove += new MouseEventHandler(this.NodeViewManager_DragedAndMove);
            this.nodeViewList.Add(nodeViewManager);
        }