示例#1
0
        public override void Write(XmlTextWriter output, bool isCopy)
        {
            Assert.ArgumentNotNull(output, nameof(output));

            output.WriteStartElement(@"p");

            output.WriteAttributeStringNotEmpty(@"key", Id);
            output.WriteAttributeStringNotEmpty(@"uid", UniqueId);
            output.WriteAttributeStringNotEmpty(@"md", MetaDataItemId);

            if (isCopy)
            {
                output.WriteAttributeStringNotEmpty(@"ic", Icon.IconPath);
            }

            output.WriteEndElement();
        }
        private void SaveLayout([NotNull] XmlTextWriter output, bool isCopy, [NotNull] string deviceId)
        {
            Debug.ArgumentNotNull(output, nameof(output));
            Debug.ArgumentNotNull(deviceId, nameof(deviceId));

            if (string.IsNullOrEmpty(DeviceId))
            {
                return;
            }

            if (items.Count == 0 && LayoutUri == ItemUri.Empty)
            {
                return;
            }

            output.WriteStartElement(@"d");
            output.WriteAttributeStringNotEmpty(@"id", isCopy ? deviceId : DeviceId);

            if (LayoutUri != ItemUri.Empty)
            {
                output.WriteAttributeStringNotEmpty(@"l", LayoutUri.ItemId.ToString());
            }
            else
            {
                output.WriteAttributeStringNotEmpty(@"l", string.Empty);
            }

            if (isCopy)
            {
                output.WriteAttributeStringNotEmpty(@"ln", LayoutName);
                output.WriteAttributeStringNotEmpty(@"lp", LayoutPath);
            }

            foreach (var item in items)
            {
                var listItem = item;

                if (listItem != null)
                {
                    listItem.Write(output, isCopy);
                }
            }

            output.WriteEndElement();
        }
示例#3
0
        public void Save([NotNull] XmlTextWriter output, bool isCopy)
        {
            Assert.ArgumentNotNull(output, nameof(output));

            output.WriteStartElement(@"d");
            output.WriteAttributeStringNotEmpty(@"id", DeviceId.ToString());
            output.WriteAttributeStringNotEmpty(@"l", LayoutId);

            foreach (var item in Renderings)
            {
                var listItem = item as LayoutDesignerItem;

                if (listItem != null)
                {
                    listItem.Commit();
                    listItem.Write(output, isCopy);
                }
            }

            output.WriteEndElement();
        }
示例#4
0
        public override void Write(XmlTextWriter output, bool isCopy)
        {
            Assert.ArgumentNotNull(output, nameof(output));

            output.WriteStartElement(@"r");

            output.WriteAttributeStringNotEmpty(@"cac", Cacheable ? @"1" : string.Empty);
            output.WriteAttributeStringNotEmpty(@"cnd", Conditions);
            output.WriteAttributeStringNotEmpty(@"ds", DataSource);
            output.WriteAttributeStringNotEmpty(@"id", ItemId);
            output.WriteAttributeStringNotEmpty(@"mvt", MultiVariateTests);
            output.WriteAttributeStringNotEmpty(@"par", Parameters);
            output.WriteAttributeStringNotEmpty(@"ph", PlaceholderKey.Key);
            output.WriteAttributeStringNotEmpty(@"uid", UniqueId);
            output.WriteAttributeStringNotEmpty(@"vbd", VaryByData ? @"1" : string.Empty);
            output.WriteAttributeStringNotEmpty(@"vbdev", VaryByDevice ? @"1" : string.Empty);
            output.WriteAttributeStringNotEmpty(@"vbl", VaryByLogin ? @"1" : string.Empty);
            output.WriteAttributeStringNotEmpty(@"vbp", VaryByParameters ? @"1" : string.Empty);
            output.WriteAttributeStringNotEmpty(@"vbqs", VaryByQueryString ? @"1" : string.Empty);
            output.WriteAttributeStringNotEmpty(@"vbu", VaryByUser ? @"1" : string.Empty);

            if (isCopy)
            {
                output.WriteAttributeStringNotEmpty(@"name", Name);
                output.WriteAttributeStringNotEmpty(@"placeholders", PlaceHolders);
                output.WriteAttributeStringNotEmpty(@"dsl", DataSourceLocation);
                output.WriteAttributeStringNotEmpty(@"dst", DataSourceTemplate);
                output.WriteAttributeStringNotEmpty(@"path", FilePath);
                output.WriteAttributeStringNotEmpty(@"templateid", ParameterTemplateId);
                output.WriteAttributeStringNotEmpty(@"ic", Icon.IconPath);

                output.WriteStartElement("template");

                foreach (var property in DynamicProperties)
                {
                    output.WriteStartElement("field");

                    output.WriteAttributeString("name", property.Name);
                    output.WriteAttributeString("displayname", property.DisplayName);
                    output.WriteAttributeString("category", property.Category);
                    output.WriteAttributeString("type", property.TypeName);
                    output.WriteAttributeString("description", property.Description);
                    output.WriteAttributeString("bindmode", property.Attributes["bindmode"] != null ? property.Attributes["bindmode"].ToString() : string.Empty);

                    var dataBindingConverter = property.Converter as DataBindingConverter;
                    if (dataBindingConverter != null && dataBindingConverter.Values != null)
                    {
                        output.WriteStartElement("values");

                        foreach (var value in dataBindingConverter.Values)
                        {
                            output.WriteStartElement("value");
                            output.WriteAttributeString("displayname", value.Item1);
                            output.WriteValue(value.Item2);
                            output.WriteEndElement();
                        }

                        output.WriteEndElement();
                    }

                    var dropDownValueConverter = property.Converter as DropDownValueConverter;
                    if (dropDownValueConverter != null)
                    {
                        output.WriteStartElement("values");

                        foreach (var value in dropDownValueConverter.Values)
                        {
                            output.WriteStartElement("value");
                            output.WriteAttributeString("displayname", value.Item1);
                            output.WriteValue(value.Item2);
                            output.WriteEndElement();
                        }

                        output.WriteEndElement();
                    }

                    output.WriteEndElement();
                }

                output.WriteEndElement();
            }

            if (!string.IsNullOrEmpty(Ruleset))
            {
                output.WriteRaw("<rls>" + Ruleset + "</rls>");
            }

            output.WriteEndElement();
        }