示例#1
0
        private static string StyledSettings(DfmProperty property)
        {
            Guard.Ensure.IsTrue(property.HasValues, "StyledSettings property has no value error.");

            var sb = new StringBuilder();

            sb.Append("[");

            foreach (var value in property.Values)
            {
                sb.Append($"TStyledSetting.{value.Content}, ");
            }

            sb.Length -= 2;
            sb.Append("]");

            return(sb.ToString());
        }
示例#2
0
        public static string Adapt(DfmObject obj, DfmProperty property)
        {
            var name = property.Name.ToLowerInvariant();

            if (name == "viewport.width")
            {
                return("Width");
            }

            if (name == "viewport.height")
            {
                return("Height");
            }

            if (name == "designermasterstyle")
            {
                return(string.Empty);
            }

            return(property.Name);
        }
示例#3
0
        public static string Adapt(string name, DfmProperty property)
        {
            name = name.ToLowerInvariant();

            if (name.EndsWith("color"))
            {
                return(Color(property.Value));
            }

            if (name.EndsWith("align"))
            {
                return(Alignment(property));
            }

            if (name.EndsWith("anchors"))
            {
                return(Anchors(property));
            }

            if (name.EndsWith("dragmode"))
            {
                return(DragMode(property.Value));
            }

            if (name.EndsWith("devices"))
            {
                return(Devices(property));
            }

            if (name.EndsWith("styledsettings"))
            {
                return(StyledSettings(property));
            }

            return(property.Value);
        }
示例#4
0
 private static string Devices(DfmProperty property)
 {
     Guard.Ensure.IsTrue(property.HasValues, "Device property has no value error.");
     return($"TDeviceKinds.{property.Value}");
 }
示例#5
0
 private static string Alignment(DfmProperty property)
 {
     Guard.Ensure.IsTrue(property.HasValues, "Alignment property has no value error.");
     return($"TAlignLayout.{property.Value}");
 }