예제 #1
0
        public MainViewModel()
        {
            EvaluateCommand = new DelegateCommand(() =>
            {
                foreach (var pc in Constraints)
                {
                    var result = VMS.GetValue(sc =>
                    {
                        //Check if we can constrain first
                        var canConstrain = pc.Constraint.CanConstrain(sc.PlanSetup);
                        //If not..report why
                        if (!canConstrain.IsSuccess)
                        {
                            return(canConstrain);
                        }
                        else
                        {
                            //Can constrain - so do it
                            return(pc.Constraint.Constrain(sc.PlanSetup));
                        }
                    });
                    //Update UI
                    pc.Result = result;
                }
            });

            CreateConstraints();
        }
예제 #2
0
 public MainViewModel()
 {
     //Initialize with first loaded plan if any
     OnPlanChanged(VMS.GetValue(sac => sac.PlanSetup));
     //Handle plan changes (in standalone mode)
     VMS.Execute(sac => sac.PlanSetupChanged += OnPlanChanged);
 }
        public MainViewModel()
        {
            CreateConstraints();

            EvaluateCommand = new DelegateCommand(() =>
            {
                foreach (var pc in Constraints)
                {
                    var result = VMS.GetValue(sc =>
                    {
                        var canConstrain = pc.Constraint.CanConstrain(sc.PlanSetup);
                        if (!canConstrain.IsSuccess)
                        {
                            return(canConstrain);
                        }
                        else
                        {
                            return(pc.Constraint.Constrain(sc.PlanSetup));
                        }
                    });

                    pc.Result = result;
                }
            });

            //OnPlanChanged(VMS.GetValue(sac => sac.PlanSetup));

            //VMS.Execute(sac => sac.PlanSetupChanged += OnPlanChanged);
        }
예제 #4
0
 public MainViewModel()
 {
     //Example data bind
     OnPlanChanged(VMS.GetValue(sc => sc.PlanSetup));
     //Handle plan changes
     VMS.Execute(sc =>
     {
         sc.PlanSetupChanged += OnPlanChanged;
     });
 }
예제 #5
0
 private void Evaluate()
 {
     foreach (var pc in Constraints)
     {
         var result = VMS.GetValue(sc =>
         {
             //Check if we can constrain first
             var canConstrain = pc.Constraint.CanConstrain(sc.PlanSetup);
             //If not..report why
             if (!canConstrain.IsSuccess)
             {
                 return(canConstrain);
             }
             else
             {
                 //Can constrain - so do it
                 return(pc.Constraint.Constrain(sc.PlanSetup));
             }
         });
         //Update UI
         pc.Result = result;
     }
 }
예제 #6
0
 public T GetValue <T>(Func <StandAloneContext, T> func)
 {
     return(_thread.GetValue(func));
 }