public Widget Visit(FormStatement statement, GuiEnvironment environment) { var controls = new List <Widget>(statement.Statements.Count()); foreach (var s in statement.Statements) { var control = s.Accept(this, environment); controls.Add(control); } var form = new FormWidget(statement, environment, controls); return(form); }
public void Analyze_ShouldDetectDuplicateQuestionLabels() { var duplicateQuestionForm = new FormStatement("DuplicateQuestionForm", new List <Statement> { new QuestionStatement("duplicate", new StringValueType(), new StringLiteral("Sample")), new QuestionStatement("duplicate1", new StringValueType(), new StringLiteral("Sample")), }); var questionAnalyzer = new QuestionAnalyzer(); questionAnalyzer.Analyze(duplicateQuestionForm); Assert.NotEmpty(questionAnalyzer.Report.Warnings); Assert.Equal(1, questionAnalyzer.Report.Warnings.Count()); Assert.IsType <DuplicateQuestionLabelMessage>(questionAnalyzer.Report.Warnings.FirstOrDefault()); }
public void RunApplication(FormStatement structureNode) { var interpreter = new Interpreter(); var env = new GuiEnvironment(); var form = interpreter.Visit(structureNode, env); var window = new Window(); var view = new ListView(); foreach (var control in form.Controls) { view.Items.Add(control); } window.Content = view; var application = new Application(); application.Run(window); }
public ICheckerReport Check(FormStatement structureNode, StyleSheet styleNode) { if (structureNode == null) { throw new ArgumentNullException(nameof(structureNode)); } if (styleNode == null) { throw new ArgumentNullException(nameof(styleNode)); } var collector = new QuestionCollector(); collector.Collect(structureNode); var finalReport = new CheckerReport(); this.analyzers.ForEach(x => x.Analyze(styleNode, collector.Mappings)); finalReport.Add(this.analyzers.SelectMany(x => x.Report.AllMessages)); return(finalReport); }
public virtual TResult Visit(FormStatement statement, TEnvironment environment) { statement.Statements.ForEach(x => x.Accept(this, environment)); return(default(TResult)); }
public void Collect(FormStatement root) { this.Visit(root, new QuestionVisitorTypeEnvironment()); }
public VoidValueType Visit(FormStatement statement, ITypeEnvironment environment) { statement.Statements.ForEach(x => x.Accept(this, environment)); return(new VoidValueType()); }
public void Analyze(FormStatement root) { this.Visit(root, new VisitorTypeEnvironment()); }
public void RunApplication(FormStatement structureNode, StyleSheet styleNode) { Console.WriteLine("Not implemented."); }