Example #1
0
        /// <summary>
        /// Create a new expression constraint.
        /// </summary>
        private void AddAllDifferentConstraintAction()
        {
            var allDifferentConstraintEditorViewModel = new AllDifferentConstraintEditorViewModel(Workspace.WorkspaceModel.Model);
            var result = this.windowManager.ShowDialog(allDifferentConstraintEditorViewModel);

            if (!result.GetValueOrDefault())
            {
                return;
            }
            Workspace.AddAllDifferentConstraint(new AllDifferentConstraintBuilder().WithName(allDifferentConstraintEditorViewModel.ConstraintName)
                                                .WithExpression(allDifferentConstraintEditorViewModel.SelectedVariable)
                                                .Inside(Workspace.WorkspaceModel.Model)
                                                .Build());
        }
        public override void Edit()
        {
            var allDifferentConstraintEditor = new AllDifferentConstraintEditorViewModel(AllDifferentConstraint.Parent);

            allDifferentConstraintEditor.ConstraintName   = AllDifferentConstraint.Name;
            allDifferentConstraintEditor.SelectedVariable = AllDifferentConstraint.Expression.Text;
            var result = _windowManager.ShowDialog(allDifferentConstraintEditor);

            if (!result.HasValue)
            {
                return;
            }
            DisplayName    = AllDifferentConstraint.Name.Text = allDifferentConstraintEditor.ConstraintName;
            ExpressionText = AllDifferentConstraint.Expression.Text = allDifferentConstraintEditor.SelectedVariable;
        }