示例#1
0
        void propertyGridUserOption_UserOptionNameChanged(object sender, TextChangedEventArgs e)
        {
            UserOption option = propertyGridUserOption.UserOption;
            if (!userOptionNodes.ContainsKey(option)) return;

            Node node = userOptionNodes[option];
            node.Name = node.Text = option.VariableName;
        }
示例#2
0
        void propertyGridUserOption_UserOptionNameChanged(object sender, TextChangedEventArgs e)
        {
            UserOption option = formUserOptionDetails.UserOption;
            if (!virtualPropertyNodes.ContainsKey(option)) return;

            Node node = virtualPropertyNodes[option];
            node.Name = node.Text = option.VariableName;
        }
示例#3
0
        private void propertyGridUserOption_UserOptionCategoryChanged(object sender, TextChangedEventArgs e)
        {
            IgnoreSelectionChanged = true;

            UserOption option = propertyGridUserOption.UserOption;

            if (!userOptionCategoryNodes.ContainsKey(e.OldText)) return;
            if (!userOptionNodes.ContainsKey(option)) return;

            Node optionNode = userOptionNodes[option];

            Node currentCatNode = userOptionCategoryNodes[e.OldText];

            if (currentCatNode.Nodes.Count == 1)
            {
                if (userOptionCategoryNodes.ContainsKey(option.Category))
                {
                    currentCatNode.Nodes.Remove(optionNode);
                    currentCatNode.Remove();
                    userOptionCategoryNodes.Remove(e.OldText);

                    Node newCatNode = FindOrCreateCategoryNode(option.Category);
                    newCatNode.Nodes.Add(optionNode);
                }
                else
                {
                    userOptionCategoryNodes.Remove(e.OldText);

                    currentCatNode.Name = option.Category;
                    currentCatNode.Text = FormatCategoryName(option.Category);

                    userOptionCategoryNodes.Add(option.Category, currentCatNode);
                }
            }
            else
            {
                // Shift the option node to its new category node.
                Node newCatNode = FindOrCreateCategoryNode(option.Category);
                currentCatNode.Nodes.Remove(optionNode);
                newCatNode.Nodes.Add(optionNode);
            }

            Project.Instance.IsDirty = true;

            optionNode.EnsureVisible();
            treeOptions.SelectedNode = optionNode;
            IgnoreSelectionChanged = false;
        }