Пример #1
0
        bool Put_ChildIsTextCommand(XmlNode xmlNode, TreeViewItem tvNode)
        {
            if (XmlNodeChildIsValExpUnit(xmlNode))
            {
                if (xmlNode.FirstChild.FirstChild == null)
                {
                    //TODO: These are presets(need to check that is only presets)
                    //I think need to set the same as setting a normal value?
                    return(true);
                }

                TextValuePutCommand command = new TextValuePutCommand();
                command.Value = xmlNode.FirstChild.FirstChild.Value;
                xmlNode.FirstChild.FirstChild.Value = "{0}";
                command.CommandString = xmlNode.OwnerDocument.OuterXml;

                CreateOrModifyControlBuilder(tvNode).AddTextValuePutCommand(command);

                return(true);
            }

            else if (xmlNode.HasChildNodes && xmlNode.ChildNodes.Count == 1 && xmlNode.ChildNodes[0].NodeType == XmlNodeType.Text)
            {
                if (xmlNode.FirstChild.Value.All(c => c == '@'))
                {
                    VariableTextPutCommand command = new VariableTextPutCommand();

                    command.MaxLength        = xmlNode.FirstChild.Value.Length;
                    xmlNode.FirstChild.Value = "{0}";
                    command.CommandString    = xmlNode.OwnerDocument.OuterXml;

                    CreateOrModifyControlBuilder(tvNode).AddVariableTextPutCommand(command);

                    return(true);
                }
                else
                {
                    TextValuePutCommand command = new TextValuePutCommand();
                    command.Value            = xmlNode.FirstChild.Value;
                    xmlNode.FirstChild.Value = "{0}";
                    command.CommandString    = xmlNode.OwnerDocument.OuterXml;

                    CreateOrModifyControlBuilder(tvNode).AddTextValuePutCommand(command);

                    return(true);
                }
            }

            return(false);
        }
 public void AddVariableTextPutCommand(VariableTextPutCommand command)
 {
     variableTextPutCommand = command;
     putCommand             = variableTextPutCommand.CommandString;
 }