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(); }
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); }
public MainViewModel() { //Example data bind OnPlanChanged(VMS.GetValue(sc => sc.PlanSetup)); //Handle plan changes VMS.Execute(sc => { sc.PlanSetupChanged += OnPlanChanged; }); }
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; } }
public T GetValue <T>(Func <StandAloneContext, T> func) { return(_thread.GetValue(func)); }