示例#1
0
        /// <summary>
        /// Updates the properties of this row
        /// </summary>
        private void UpdateProperties()
        {
            this.ModifiedOn = this.Thing.ModifiedOn;
            var parametricConstraintDialog = this.TopContainerViewModel as ParametricConstraintDialogViewModel;
            var term = this.GetUpdatedTerm(this.Thing.Term, parametricConstraintDialog);

            this.ContainedRows.Clear();
            switch (term.ClassKind)
            {
            case ClassKind.NotExpression:
                var notExpressionRow = new NotExpressionRowViewModel((NotExpression)term, this.Session, this);
                this.ContainedRows.Add(notExpressionRow);
                break;

            case ClassKind.AndExpression:
                var andExpressionRow = new AndExpressionRowViewModel((AndExpression)term, this.Session, this);
                this.ContainedRows.Add(andExpressionRow);
                break;

            case ClassKind.OrExpression:
                var orExpressionRow = new OrExpressionRowViewModel((OrExpression)term, this.Session, this);
                this.ContainedRows.Add(orExpressionRow);
                break;

            case ClassKind.ExclusiveOrExpression:
                var exclusiveOrExpressionRow = new ExclusiveOrExpressionRowViewModel((ExclusiveOrExpression)term, this.Session, this);
                this.ContainedRows.Add(exclusiveOrExpressionRow);
                break;

            case ClassKind.RelationalExpression:
                var relationalExpressionRow = new RelationalExpressionRowViewModel((RelationalExpression)term, this.Session, this);
                this.ContainedRows.Add(relationalExpressionRow);
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Updates the properties of this row
        /// </summary>
        private void UpdateProperties()
        {
            this.ModifiedOn    = this.Thing.ModifiedOn;
            this.TopExpression = this.Thing.Expression.SingleOrDefault(e => e.Iid == this.Thing.TopExpression.Iid);
            this.ContainedRows.Clear();
            if (this.TopExpression == null)
            {
                this.StringTopExpression = string.Empty;
                return;
            }

            var expression = this.TopExpression;

            switch (expression.ClassKind)
            {
            case ClassKind.NotExpression:
                var notExpressionRow = new NotExpressionRowViewModel((NotExpression)expression, this.Session, this);
                this.ContainedRows.Add(notExpressionRow);
                break;

            case ClassKind.AndExpression:
                var andExpressionRow = new AndExpressionRowViewModel((AndExpression)expression, this.Session, this);
                this.ContainedRows.Add(andExpressionRow);
                break;

            case ClassKind.OrExpression:
                var orExpressionRow = new OrExpressionRowViewModel((OrExpression)expression, this.Session, this);
                this.ContainedRows.Add(orExpressionRow);
                break;

            case ClassKind.ExclusiveOrExpression:
                var exclusiveOrExpressionRow = new ExclusiveOrExpressionRowViewModel((ExclusiveOrExpression)expression, this.Session, this);
                this.ContainedRows.Add(exclusiveOrExpressionRow);
                break;

            case ClassKind.RelationalExpression:
                var relationalExpressionRow = new RelationalExpressionRowViewModel((RelationalExpression)expression, this.Session, this);
                this.ContainedRows.Add(relationalExpressionRow);
                break;
            }

            if (this.ContainedRows.Count != 1)
            {
                return;
            }
            this.StringTopExpression = string.Empty;
            this.BuildStringExpression(this.ContainedRows.Single() as IRowViewModelBase <BooleanExpression>);

            this.UpdateIsDeprecatedDerivedFromContainerRequirementRowViewModelModel();
        }
        /// <summary>
        /// Recreates the visual tree that contains the collection of <see cref="BooleanExpression"/>s in this <see cref="ParametricConstraint"/>
        /// </summary>
        private void RefreshExpressionTree()
        {
            this.Expression.Clear();

            foreach (var booleanExpression in this.BooleanExpression.GetTopLevelExpressions().OrderBy(e => e.ClassKind))
            {
                switch (booleanExpression.ClassKind)
                {
                case ClassKind.NotExpression:
                    var notExpressionRow = new NotExpressionRowViewModel((NotExpression)booleanExpression, this.Session, this);
                    this.Expression.Add(notExpressionRow);

                    break;

                case ClassKind.AndExpression:
                    var andExpressionRow = new AndExpressionRowViewModel((AndExpression)booleanExpression, this.Session, this);
                    this.Expression.Add(andExpressionRow);

                    break;

                case ClassKind.OrExpression:
                    var orExpressionRow = new OrExpressionRowViewModel((OrExpression)booleanExpression, this.Session, this);
                    this.Expression.Add(orExpressionRow);

                    break;

                case ClassKind.ExclusiveOrExpression:
                    var exclusiveOrExpressionRow = new ExclusiveOrExpressionRowViewModel((ExclusiveOrExpression)booleanExpression, this.Session, this);
                    this.Expression.Add(exclusiveOrExpressionRow);

                    break;

                case ClassKind.RelationalExpression:
                    var relationalExpressionRow = new RelationalExpressionRowViewModel((RelationalExpression)booleanExpression, this.Session, this);
                    this.Expression.Add(relationalExpressionRow);

                    break;
                }
            }

            if (this.Expression.Count == 1)
            {
                this.SelectedTopExpression = this.Expression.Single().Thing;
            }
        }