public DependentCollection(Func <IEnumerable <T> > getMethod) { _getMethod = getMethod; _depCollection = new Dependent(OnUpdateCollection); _depCollection.Invalidated += () => UpdateScheduler.ScheduleUpdate(this); _depCollection.Touch(); }
public ObjectPropertyAtom(IObjectInstance objectInstance, ClassProperty classProperty) : base(objectInstance, classProperty) { if (ClassProperty.CanRead) { // When the property is out of date, update it from the wrapped object. _depProperty = new Dependent(delegate { object value = ClassProperty.GetObjectValue(ObjectInstance.WrappedObject); value = TranslateOutgoingValue(value); if (!Object.Equals(_value, value)) { _value = value; } if (_firePropertyChanged) { ObjectInstance.FirePropertyChanged(ClassProperty.Name); } _firePropertyChanged = true; }); // When the property becomes out of date, trigger an update. // The update should have lower priority than user input & drawing, // to ensure that the app doesn't lock up in case a large model is // being updated outside the UI (e.g. via timers or the network). _depProperty.Invalidated += () => UpdateScheduler.ScheduleUpdate(this); } }
private void Invalidated() { // When the "can execute" flag is invalidated, we need to queue // up a call to update it. This will cause the UI thread to // call TriggerUpdate (below) when everything settles down. UpdateScheduler.ScheduleUpdate(this); }
public ComputedCollection(Func <IEnumerable <T> > getMethod) { _getMethod = getMethod; _depCollection = new Computed(OnUpdateCollection); _depCollection.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); _depCollection.Touch(); }
private void Computed_Invalidated() { UpdateScheduler.ScheduleUpdate(delegate() { _priorState = _update(_priorState); }); }
public Tree() { _depNodes = new Dependent(delegate { _root.UpdateNodes(); }); _depNodes.Invalidated += () => UpdateScheduler.ScheduleUpdate(this); }
public Tree() { _depNodes = new Computed(delegate { _root.UpdateNodes(); }); _depNodes.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); }
public MethodCommand(object instance, CommandMeta meta) { Instance = instance; Meta = meta; if (meta.Condition != null) { _computedCan = new Computed <bool>(() => (bool)meta.Condition.GetValue(Instance)); _computedCan.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); } }
public static Dependent WhenNecessary(Action updateMethod) { var dependent = new Dependent(updateMethod); Update update = new Update(dependent); dependent.Invalidated += delegate { UpdateScheduler.ScheduleUpdate(update); }; dependent.OnGet(); return(dependent); }
public ObjectPropertyAtom(IObjectInstance objectInstance, ClassMember classProperty) : base(objectInstance, classProperty) { if (ClassProperty.CanRead) { // When the property is out of date, update it from the wrapped object. _depProperty = new Dependent(() => BindingInterceptor.Current.UpdateValue(this)); // When the property becomes out of date, trigger an update. // The update should have lower priority than user input & drawing, // to ensure that the app doesn't lock up in case a large model is // being updated outside the UI (e.g. via timers or the network). _depProperty.Invalidated += () => UpdateScheduler.ScheduleUpdate(this); } }
protected MemberSlot(ViewProxy proxy, MemberMeta member) { Proxy = proxy; Member = member; if (member.CanRead) { // When the property is out of date, update it from the wrapped object. _computed = new Computed(() => BindingInterceptor.Current.UpdateValue(this)); // When the property becomes out of date, trigger an update. // The update should have lower priority than user input & drawing, // to ensure that the app doesn't lock up in case a large model is // being updated outside the UI (e.g. via timers or the network). _computed.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); } }
public ObjectPropertyAtom(IObjectInstance objectInstance, ClassProperty classProperty) : base(objectInstance, classProperty) { if (ClassProperty.CanRead) { // When the property is out of date, update it from the wrapped object. _depProperty = new Computed(delegate { object value = ClassProperty.GetObjectValue(ObjectInstance.WrappedObject); value = TranslateOutgoingValue(value); if (!Object.Equals(_value, value)) { _value = value; } if (_firePropertyChanged) { ObjectInstance.FirePropertyChanged(ClassProperty.Name); } _firePropertyChanged = true; }); // When the property becomes out of date, trigger an update. _depProperty.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); } }
public ComputedAtom(Action firePropertyChanged, Func <T> getMethod) { _firePropertyChanged = firePropertyChanged; _depValue = new Computed(() => _value = getMethod()); _depValue.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); }
public ViewModelContainer(Action firePropertyChanged, Func <object> constructor) { _firePropertyChanged = firePropertyChanged; _computed = new Computed(() => _viewModel = ForView.Wrap(constructor())); _computed.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow); }
public DependentAtom(Action firePropertyChanged, Func <T> getMethod) { _firePropertyChanged = firePropertyChanged; _depValue = new Dependent(() => _value = getMethod()); _depValue.Invalidated += () => UpdateScheduler.ScheduleUpdate(this); }
private void Computed_Invalidated() { UpdateScheduler.ScheduleUpdate(_update); }
private void ValueInvalidated() { UpdateScheduler.ScheduleUpdate(this); }
public ViewModelContainer(Action firePropertyChanged, Func <object> constructor) { _firePropertyChanged = firePropertyChanged; _dependent = new Dependent(() => _viewModel = ForView.Wrap(constructor())); _dependent.Invalidated += () => UpdateScheduler.ScheduleUpdate(this); }