Пример #1
0
        public override XmlElement SaveConfigItem(XmlDocument Owner)
        {
            XmlElement base_xml = base.SaveConfigItem(Owner);

            base_xml.SetAttribute("item_type", "flow");
            base_xml.SetAttribute("condition", Express);

            XmlElement shape_xml = Owner.CreateElement("shape");

            shape_xml.SetAttribute("type", Show_item.ToString());
            shape_xml.SetAttribute("source", Start.name);
            shape_xml.SetAttribute("dest", End.name);

            base_xml.AppendChild(shape_xml);

            return(base_xml);
        }
Пример #2
0
        public override XmlElement SaveConfigItem(XmlDocument Owner)
        {
            //base
            XmlElement base_xml = base.SaveConfigItem(Owner);

            base_xml.SetAttribute("item_type", "event");
            base_xml.SetAttribute("event_type", eventType);
            base_xml.SetAttribute("authority", authority);

            //shape
            XmlElement shape_xml = Owner.CreateElement("shape");

            shape_xml.SetAttribute("type", Show_item.ToString());
            shape_xml.SetAttribute("margin", Show_item.Margin.ToString());
            base_xml.AppendChild(shape_xml);

            //actions
            XmlElement actions_xml = Owner.CreateElement("actions");
            //beforeaction
            XmlElement ba = Owner.CreateElement("beforeaction");

            ba.SetAttribute("url", BeforeAction.url);
            XmlElement ba_pars = Owner.CreateElement("action_params");

            foreach (var pa in BeforeAction.action_params)
            {
                XmlElement xpa = Owner.CreateElement("param");
                xpa.SetAttribute("name", pa.Key);
                xpa.InnerText = pa.Value;
                ba_pars.AppendChild(xpa);
            }
            ba.AppendChild(ba_pars);
            actions_xml.AppendChild(ba);
            //afteraction
            XmlElement aa = Owner.CreateElement("afteraction");

            aa.SetAttribute("url", AfterAction.url);
            XmlElement aa_pars = Owner.CreateElement("action_params");

            foreach (var pa in AfterAction.action_params)
            {
                XmlElement xpa = Owner.CreateElement("param");
                xpa.SetAttribute("name", pa.Key);
                xpa.InnerText = pa.Value;
                aa_pars.AppendChild(xpa);
            }
            aa.AppendChild(aa_pars);
            actions_xml.AppendChild(aa);

            //currentaction
            actions_xml.SetAttribute("currentaction", CurrentAction);
            base_xml.AppendChild(actions_xml);

            //link_params
            XmlElement pas_xml = Owner.CreateElement("link_params");

            foreach (var pa in _LinkParams)
            {
                XmlElement pa_xml = Owner.CreateElement("param");
                pa_xml.SetAttribute("name", pa.Key);
                pa_xml.SetAttribute("app_reserve", pa.Value);
                pas_xml.AppendChild(pa_xml);
            }
            base_xml.AppendChild(pas_xml);

            //TimeOut
            XmlElement time_xml   = Owner.CreateElement("time_out");
            XmlElement time_start = Owner.CreateElement("start");

            if (_TimeOut.ContainsKey("start") == false || _TimeOut["start"] == null)
            {
                time_start.InnerText = "";
            }
            else
            {
                time_start.InnerText = (_TimeOut["start"] as string);
            }
            time_xml.AppendChild(time_start);

            XmlElement time_offset = Owner.CreateElement("offset");

            if (_TimeOut.ContainsKey("offset") == false || _TimeOut["offset"] == null)
            {
                time_offset.InnerText = "";
            }
            else
            {
                TimeSpan?ts = (_TimeOut["offset"] as TimeSpan?);
                time_offset.AppendChild(Owner.CreateCDataSection(ts.Value.ToString()));
            }
            time_xml.AppendChild(time_offset);

            XmlElement time_exact = Owner.CreateElement("exact");

            if (_TimeOut.ContainsKey("exact") == false || _TimeOut["exact"] == null)
            {
                time_exact.InnerText = "";
            }
            else
            {
                time_exact.AppendChild(Owner.CreateCDataSection((_TimeOut["exact"] as DateTime?).Value.ToString()));
            }
            time_xml.AppendChild(time_exact);

            XmlElement time_action = Owner.CreateElement("action");

            if (_TimeOut.ContainsKey("action") == false || _TimeOut["action"] == null)
            {
                time_action.InnerText = "";
            }
            else
            {
                time_action.InnerText = (_TimeOut["action"] as string);
            }
            time_xml.AppendChild(time_action);

            XmlElement time_callback = Owner.CreateElement("callback");

            if (_TimeOut.ContainsKey("callback") == false || _TimeOut["callback"] == null)
            {
                time_callback.InnerText = "";
            }
            else
            {
                time_callback.AppendChild(Owner.CreateCDataSection(_TimeOut["callback"] as string));
            }
            time_xml.AppendChild(time_callback);

            base_xml.AppendChild(time_xml);

            return(base_xml);
        }