예제 #1
0
        private static AttributeItem ParseAttributeFromString(string attributeString)
        {
            var delimiter = attributeString.IndexOfAny(new [] { '=' });
            var key       = attributeString.Substring(0, delimiter);
            var value     = attributeString.Substring(delimiter + 2, attributeString.Length - delimiter - 3);
            var attribute = new AttributeItem(key, value);

            return(attribute);
        }
예제 #2
0
        private void OnSaveAttributes(TreeNode selectedNode)
        {
            string endPart;

            if (selectedNode.Text.EndsWith("/>"))
            {
                endPart = " />";
            }
            else
            {
                endPart = ">";
            }
            var parts = selectedNode.Text.Split(' ');

            var attributes = new List <AttributeItem>();

            foreach (var visualAttributeItem in _visualAttributeItems)
            {
                var attribute = new AttributeItem(visualAttributeItem.KeyLabel.Text, visualAttributeItem.ValueTextBox.Text);
                attributes.Add(attribute);
            }

            selectedNode.Text = parts[0] + @" " + AttributeHandler.TransformAttributesListToString(attributes) + endPart;
        }