示例#1
0
        public static void LoadInterface(IXmlItem xmlComponent, XmlNode rootNode, XmlDocument document)
        {
            if (xmlComponent.Interface == null)
            {
                xmlComponent.Interface = new XmlItemInterface(rootNode, document, xmlComponent);
            }
            if (rootNode == null)
            {
                return;
            }

            NowEventLoadingXmlItem = xmlComponent;                 //Action에서 각각의 type에 따라서 적절한 Condition을 가져오기 위해 사용됨..
            XmlNode xEvents = XmlGetter.Child(rootNode, "Events"); // rootNode.SelectSingleNode("Events");

            if (xEvents != null)
            {
                xmlComponent.Interface.Events.LoadXml(document, xEvents);
            }

            XmlNodeList xArguments = XmlGetter.Children(rootNode, "Arguments/Argument");

            if (xArguments != null)
            {
                foreach (XmlNode xArg in xArguments)
                {
                    String name  = XmlGetter.Attribute(xArg, "Name");
                    String value = xArg.InnerText;
                    xmlComponent.Interface.Arguments.Add(name, value);
                }
            }
        }
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, "LayoutCollection", parent);

            for (int i = 0; i < _parent.Controls.Count; i++)
            {
                IXmlItem item = _parent.Controls[i] as IXmlItem;
                item.GetXml(xDoc, root);
            }
            return(root);
        }
 public XmlItemInterface(XmlNode node, XmlDocument document, IXmlItem item)
 {
     _node     = node;
     _owner    = item;
     _document = document;
     if (item is IXmlComponent)
     {
         _itemType = XmlItemTypes.Component;
     }
     else
     {
         _itemType = XmlItemTypes.Item;
     }
 }
示例#4
0
文件: IXmlItem.cs 项目: Noggog/Loqui
    public static void WriteToXml(
        this IXmlItem item,
        Stream stream,
        ErrorMaskBuilder?errorMask         = null,
        TranslationCrystal?translationMask = null,
        string?name = null)
    {
        var node = new XElement("topnode");

        item.WriteToXml(
            name: name,
            node: node,
            errorMask: errorMask,
            translationMask: translationMask);
        node.Elements().First().Save(stream);
    }
示例#5
0
        public static void RunEvent(IXmlItem comp, String evtType)
        {
            if (comp.Interface.Events.Keys.Contains(evtType) == false)
            {
                return;
            }

            XmlEvent evt = comp.Interface.Events[evtType];


            for (int i = 0; i < evt.Actions.Count; i++)
            {
                XmlActionList actionList = evt.Actions[i];
                if (actionList.Condition.GetCondition() && (actionList.ComCondition == null || actionList.ComCondition.GetCondition())) //condition이 true일 때..
                {
                    for (int a = 0; a < actionList.Count; a++)
                    {
                        XmlAction action   = actionList[a];
                        string    funcName = action.Name;

                        if (GlobalVars.Funcs.Keys.Contains(funcName))
                        {
                            object[] args;
                            args = comp.Interface.GetRealTimeArgs(action.Args);

                            if (comp is Control)
                            {
                                Control control = comp as Control;

                                if (control.InvokeRequired)
                                {
                                    GlobalVars.Funcs[funcName](comp, args);
                                }
                                else
                                {
                                    GlobalVars.Funcs[funcName].Invoke(comp, args);
                                }
                            }
                            else
                            {
                                GlobalVars.Funcs[funcName](comp, args);
                            }
                        }
                    }
                }
            }
        }
示例#6
0
        public static void GetDefaultXmlItemAttributes(XmlNode rootNode, XmlDocument document, IXmlItem xmlItem, bool refLoad = false)
        {
            xmlItem.Interface = new XmlItemInterface(rootNode, document, xmlItem);

            if (refLoad == false)
            {
                String refPath = XmlGetter.Attribute(rootNode, "Ref");
                if (refPath.Length > 0)
                {
                    xmlItem.LoadXml(refPath, true);
                }
            }
        }
 public XmlItemCondition(IXmlItem item)
 {
     _item = item;
 }