コード例 #1
0
        internal void Update(RoslynExpressionEditor etb)
        {
            this.EditingContext = etb.OwnerActivity.GetEditingContext();

            //setup ParserContext
            this.ParserContext = new ParserContext(etb.OwnerActivity)
            {
                //callee is a ExpressionTextBox
                Instance = etb,
                //pass property descriptor belonging to epression's model property (if one exists)
                //TODO: etb should have expressionModelProperty and the propertyDescriptor should be used here instead of passing null
                PropertyDescriptor = null,
            };

            if (etb.ExpressionType != null)
            {
                this.ExpressionType = etb.ExpressionType;
            }

            this.ValidatedExpressionText = this.ExpressionText;
            if (etb.ExpressionEditorInstance != null)
            {
                this.ExpressionText = etb.ExpressionEditorInstance.Text;
            }
            else if (etb.EditingTextBox != null)
            {
                this.ExpressionText = etb.EditingTextBox.Text;
            }
            else
            {
                this.ExpressionText = etb.Text;
            }
            this.UseLocationExpression = etb.UseLocationExpression;
        }
        private static void ValidateExpression(RoslynExpressionEditor etb)
        {
            string errorMessage;

            if (etb.DoValidation(new ExpressionValidationContext(etb), out errorMessage))
            {
                etb.UpdateValidationError(errorMessage);
            }
        }
コード例 #3
0
 public ExpressionValidationContext(RoslynExpressionEditor etb)
 {
     this.etb = etb;
 }