Example #1
0
        public static void WriteTranslatedEquality(this StringBuilder builder, string viewName, string propertyName, string value, ICodeRenderService codeRenderService, bool instanciate = false, bool textCondition = true)
        {
            bool   needQuotes;
            string result;

            if (textCondition && !string.IsNullOrEmpty(value))
            {
                if (codeRenderService.Options != null && codeRenderService.Options.TranslateLabels)
                {
                    result     = codeRenderService.GetTranslatedText(value);
                    needQuotes = false;
                }
                else
                {
                    result     = value;
                    needQuotes = true;
                }
            }
            else
            {
                result     = string.Empty;
                needQuotes = true;
            }
            builder.AppendLine(CodeGenerationHelpers.GetPropertyEquality(viewName, propertyName, result, inQuotes: needQuotes, instanciate: instanciate));
        }
        public override string ConvertToCode(string propertyName, FigmaCodeNode currentNode, FigmaCodeNode parentNode, FigmaCodeRendererService rendererService)
        {
            if (propertyName == CodeProperties.AddChild)
            {
                if (parentNode != null)
                {
                    return(CodeGenerationHelpers.GetMethod(parentNode.Name, nameof(AppKit.NSView.AddSubview), currentNode.Name));
                }
            }
            if (propertyName == CodeProperties.Constraints)
            {
            }

            if (propertyName == CodeProperties.Frame)
            {
            }

            return(base.ConvertToCode(propertyName, currentNode, parentNode, rendererService));
        }
Example #3
0
 public static string GetConstructor(this Services.CodeNode sender, string typeFullName, bool includesVar = true)
 {
     return(CodeGenerationHelpers.GetConstructor(sender.Name, typeFullName, includesVar));
 }
Example #4
0
 public static string GetMethod(this Type type, string methodName, string parameters, bool inQuotes = false, bool includesSemicolon = true)
 {
     return(CodeGenerationHelpers.GetMethod(type.FullName, methodName, parameters, inQuotes, includesSemicolon));
 }
Example #5
0
 public static void WriteMethod(this StringBuilder builder, string viewName, string methodName, string parameters, bool inQuotes = false)
 {
     builder.AppendLine(CodeGenerationHelpers.GetMethod(viewName, methodName, parameters, inQuotes));
 }
Example #6
0
 public static void WritePropertyEquality(this StringBuilder builder, string viewName, string propertyName, string value, bool inQuotes = false, bool instanciate = false)
 {
     builder.AppendLine(CodeGenerationHelpers.GetPropertyEquality(viewName, propertyName, value, inQuotes, instanciate));
 }
Example #7
0
 public static void WriteConstructor(this StringBuilder builder, string viewName, string typeFullName, bool includesVar = true)
 {
     builder.AppendLine(CodeGenerationHelpers.GetConstructor(viewName, typeFullName, includesVar));
 }
Example #8
0
 public static string GetMethod(this Services.CodeNode sender, string methodName, string parameters, bool inQuotes = false)
 {
     return(CodeGenerationHelpers.GetMethod(sender.Name, methodName, parameters, inQuotes));
 }
Example #9
0
 public static string GetMethod(this Services.CodeNode sender, string methodName, bool parameter)
 {
     return(CodeGenerationHelpers.GetMethod(sender.Name, methodName, parameter));
 }
Example #10
0
 public static string GetPropertyEquality(this Services.CodeNode sender, string propertyName, string value, bool inQuotes = false)
 {
     return(CodeGenerationHelpers.GetPropertyEquality(sender.Name, propertyName, value, inQuotes));
 }