Esempio n. 1
0
            public override void ExitObject([NotNull] DfmGrammarParser.ObjectContext context)
            {
                var objectType = context.type()?.GetText();

                if (objectType == null)
                {
                    return;
                }

                if (objectType.EndsWith("WizardStep"))
                {
                    if (this.wizard != null && this.step != null)
                    {
                        this.wizard.Steps.Add(this.step);
                    }
                    this.step = null;
                }
                else if (objectType == "TSBWizardAction")
                {
                    if (this.step != null && !string.IsNullOrEmpty(this.action?.CalculationText))
                    {
                        this.step.Actions.Add(this.action);
                    }
                    this.action = null;
                }
            }
Esempio n. 2
0
            public override void EnterObject([NotNull] DfmGrammarParser.ObjectContext context)
            {
                var objectType = context.type()?.GetText();

                if (objectType == null)
                {
                    return;
                }

                if (objectType.Equals("TSBWizard", StringComparison.OrdinalIgnoreCase))
                {
                    this.wizard = new Wizard();

                    var nameProp = GetPropertyByName(context, "Code");
                    if (nameProp != null)
                    {
                        this.wizard.Name = DfmParseUtils.GetTextPropValue(nameProp) ?? string.Empty;
                    }
                    else
                    {
                        this.wizard.Name = string.Empty;
                    }

                    var titleProp = GetPropertyByName(context, "Title");
                    if (titleProp != null)
                    {
                        this.wizard.Title = DfmParseUtils.GetTextPropValue(titleProp) ?? string.Empty;
                    }
                    else
                    {
                        this.wizard.Title = string.Empty;
                    }
                }
                else if (objectType.EndsWith("WizardStep", StringComparison.OrdinalIgnoreCase))
                {
                    this.step = new WizardStep();

                    var nameProp = GetPropertyByName(context, "StepName");
                    if (nameProp != null)
                    {
                        this.step.Name = DfmParseUtils.GetTextPropValue(nameProp) ?? string.Empty;
                    }
                    else
                    {
                        this.step.Name = string.Empty;
                    }

                    var titleProp = GetPropertyByName(context, "Title");
                    if (titleProp != null)
                    {
                        this.step.Title = DfmParseUtils.GetTextPropValue(titleProp) ?? string.Empty;
                    }
                    else
                    {
                        this.step.Title = string.Empty;
                    }
                }
                else if (objectType.Equals("TSBWizardAction", StringComparison.OrdinalIgnoreCase))
                {
                    this.action = new WizardStepAction();

                    var nameProp = GetPropertyByName(context, "ActionName");
                    if (nameProp != null)
                    {
                        this.action.Name = DfmParseUtils.GetTextPropValue(nameProp) ?? string.Empty;
                    }
                    else
                    {
                        this.action.Name = string.Empty;
                    }

                    var titleProp = GetPropertyByName(context, "Title");
                    if (titleProp != null)
                    {
                        this.action.Title = DfmParseUtils.GetTextPropValue(titleProp) ?? string.Empty;
                    }
                    else
                    {
                        this.action.Title = string.Empty;
                    }
                }
            }