Example #1
0
        public ScriptLineView CreateLineView(string scriptLineText, int lineIndex, bool @default = false)
        {
            var lineType = Script.ResolveLineType(scriptLineText);
            var lineView = default(ScriptLineView);

            switch (lineType.Name)
            {
            case nameof(CommentScriptLine):
                var commentScriptLine = new CommentScriptLine(null, lineIndex, scriptLineText, null, true);
                lineView = new CommentLineView(commentScriptLine, linesContainer);
                break;

            case nameof(LabelScriptLine):
                var labelScriptLine = new LabelScriptLine(null, lineIndex, scriptLineText, null, true);
                lineView = new LabelLineView(labelScriptLine, linesContainer);
                break;

            case nameof(DefineScriptLine):
                var defineScriptLine = new DefineScriptLine(null, lineIndex, scriptLineText, null, true);
                lineView = new DefineLineView(defineScriptLine, linesContainer);
                break;

            case nameof(CommandScriptLine):
                var commandScriptLine = new CommandScriptLine(null, lineIndex, scriptLineText, null, true);
                lineView = CommandLineView.CreateOrError(commandScriptLine, linesContainer, config.HideUnusedParameters, @default);
                break;

            case nameof(GenericTextScriptLine):
                var genericTextScriptLine = new GenericTextScriptLine(null, lineIndex, scriptLineText, null, true);
                lineView = new GenericTextLineView(genericTextScriptLine, linesContainer);
                break;
            }
            return(lineView);
        }
Example #2
0
 public DefineLineView(DefineScriptLine scriptLine, VisualElement container)
     : base(scriptLine, container)
 {
     valueField = new LineTextField("Define", scriptLine.DefineValue);
     keyField   = new LineTextField("as", scriptLine.DefineKey);
     Content.Add(valueField);
     Content.Add(keyField);
 }