Ejemplo n.º 1
0
        private void PropertyTreeContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            TreeNode root = PropertyContextMenuTreeView.SelectedNode;

            if (root == null)
            {
                foreach (ToolStripItem item in PropertyTreeContextMenuStrip.Items)
                {
                    item.Enabled = false;
                }
            }
            else
            {
                foreach (ToolStripItem item in PropertyTreeContextMenuStrip.Items)
                {
                    item.Enabled = true;
                }

                PropertyProperty propertyNode = root.Tag as PropertyProperty;
                if (propertyNode != null)
                {
                    addPropertyToolStripMenuItem.Enabled = false;
                }
            }
        }
Ejemplo n.º 2
0
 private void PropertyPropertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
 {
     // Check if the 'MenuText' just changed?
     if (e.ChangedItem.Label == "MenuText")
     {
         // Check if this is a property?
         PropertyProperty prop = PropertyPropertyGrid.SelectedObject as PropertyProperty;
         if (prop != null)
         {
             // Make sure this is a valid unique name
             string validName = GenerateUniqueName(prop.MenuText, prop.node.TreeView);
             // Update the tree node
             prop.MenuText  = validName;
             prop.node.Text = validName;
             prop.node.Name = validName;
         }
         else
         {
             // Check if this is a menu?
             PropertyMenu menu = PropertyPropertyGrid.SelectedObject as PropertyMenu;
             if (menu != null)
             {
                 // Make sure this is a valid unique name
                 string validName = GenerateUniqueName(menu.MenuText, menu.node.TreeView);
                 // Update the tree node
                 menu.MenuText  = validName;
                 menu.node.Text = validName;
                 menu.node.Name = validName;
             }
         }
     }
 }
Ejemplo n.º 3
0
        private TreeNode CreatePropertyNode(TreeNode root, string menuName, string category, string subcategory, string variable, string value)
        {
            PropertyProperty property = new PropertyProperty(menuName, category, subcategory, variable, value);
            TreeNode         node     = new TreeNode(property.MenuText);

            property.node           = node;
            node.ImageIndex         = (int)TreeImages.PROPERTY_IMAGE;
            node.SelectedImageIndex = (int)TreeImages.PROPERTY_IMAGE;
            node.Name = property.MenuText;
            node.Tag  = property;

            AddNode(root, node);
            return(node);
        }
Ejemplo n.º 4
0
        private void SaveOutMenus(MOG_PropertiesIni ripMenu, TreeNodeCollection nodes)
        {
            foreach (TreeNode node in nodes)
            {
                PropertyProperty property = node.Tag as PropertyProperty;
                if (property != null)
                {
                    if (node.Parent.Text == "Root")
                    {
                        ripMenu.PutString("Property.Menu", "{MenuItem}" + property.MenuText, "[" + property.PropertyCategory + "]" + "{" + property.PropertySubCategory + "}" + property.PropertyName + "=" + property.PropertyValue);
                    }
                    else
                    {
                        ripMenu.PutString(node.Parent.Text, "{MenuItem}" + property.MenuText, "[" + property.PropertyCategory + "]" + "{" + property.PropertySubCategory + "}" + property.PropertyName + "=" + property.PropertyValue);
                    }
                }
                else
                {
                    PropertyMenu menu = node.Tag as PropertyMenu;
                    if (menu != null)
                    {
                        if (node.Parent.Text == "Root")
                        {
                            ripMenu.PutString("Property.Menu", "{MenuItem}" + menu.MenuText, menu.MenuText);
                        }
                        else
                        {
                            ripMenu.PutString(node.Parent.Text, "{MenuItem}" + menu.MenuText, menu.MenuText);
                        }

                        // Menus ALWAYS require a section...even if it is blank!
                        ripMenu.PutSection(menu.MenuText);
                    }
                }

                if (node.Nodes.Count > 0)
                {
                    SaveOutMenus(ripMenu, node.Nodes);
                }
            }
        }