private static Func <bool> CreateOrArgument(DynamicBool firstCondition, DynamicBool secondCondition, DynamicBool[] args) { if (args.Length == 0) { return(() => firstCondition.Value && secondCondition.Value); } return(() => { if (firstCondition.Value || secondCondition.Value) { return true; } for (int index = 0; index < args.Length; index++) { if (args[index].Value) { return true; } } return false; }); }
public static DynamicBool CreateCondition( DynamicBool firstCondition, BooleanLogic logic, DynamicBool secondCondition) { return(new DynamicBool(logic, firstCondition, secondCondition)); }
public static DynamicBool CreateCondition( BooleanLogic logic, DynamicBool firstCondition, DynamicBool secondCondition, params DynamicBool[] args) { return(new DynamicBool(logic, firstCondition, secondCondition, args)); }
private static DualLayerNotifier[] CreateNotifiersList(DynamicBool first, params DynamicBool[] args) { var notifiers = new List <DualLayerNotifier>(); notifiers.Add(first.ValueNotifier); for (int index = 0; index < args.Length; index++) { notifiers.Add(args[index].ValueNotifier); } return(notifiers.ToArray()); }
internal DynamicBool( BooleanLogic logic, DynamicBool firstCondition, DynamicBool secondCondition, params DynamicBool[] args) : base( logic == BooleanLogic.And ? CreateAndArgument(firstCondition, secondCondition, args) : CreateOrArgument(firstCondition, secondCondition, args), firstCondition.ValueNotifier, CreateNotifiersList(secondCondition, args)) { }
internal DynamicNotValue( DynamicBool booleanCondition) : base(() => !booleanCondition.Value, booleanCondition.ValueNotifier) { }
internal void SetAvailabilityCondition(DynamicBool condition) { availabilityCalculation = condition; availabilityCalculation.ValueNotifier.ChangeNotificationSent += ValueNotifier_AvailabilityConditionChanged; }
protected void SetAvailabilityCalculator(DataPropertyDescriptor property, DynamicBool condition) { _availabilities[property.PropertyName].SetAvailabilityCondition(condition); }
protected void SetAvailabilityCalculator(OperationDescriptor operation, DynamicBool condition) { _availabilities[operation.Name].SetAvailabilityCondition(condition); }