protected IEnumerable <T> GetCollection <T>(Func <IEnumerable <T> > getMethod, [CallerMemberName] string propertyName = "") { ForView.Initialize(); ComputedPropertyBase property; if (!_computedPropertyByName.TryGetValue(propertyName, out property)) { property = new ComputedCollection <T>(getMethod); _computedPropertyByName.Add(propertyName, property); } return((IEnumerable <T>)property.Value); }
protected T Get <T>(Func <T> getMethod, [CallerMemberName] string propertyName = "") { ForView.Initialize(); ComputedPropertyBase property; if (!_computedPropertyByName.TryGetValue(propertyName, out property)) { property = new ComputedAtom <T>(() => FirePropertyChanged(propertyName), getMethod); _computedPropertyByName.Add(propertyName, property); } return((T)property.Value); }
public object ViewModel(Func <object> constructor, [CallerMemberName] string propertyName = "") { if (DesignMode) { return(constructor()); } ForView.Initialize(); ViewModelContainer container; if (!_containerByName.TryGetValue(propertyName, out container)) { container = new ViewModelContainer(() => FirePropertyChanged(propertyName), constructor); _containerByName.Add(propertyName, container); } return(container.ViewModel); }
protected IEnumerable <T> GetCollection <T>(Func <IEnumerable <T> > getMethod, [CallerMemberName] string propertyName = "") { ForView.Initialize(); return(_propertyTracker.GetCollection(getMethod, propertyName)); }
protected T Get <T>(Func <T> getMethod, [CallerMemberName] string propertyName = "") { ForView.Initialize(); return(_propertyTracker.Get(getMethod, propertyName)); }
public ViewModelContainer(Action firePropertyChanged, Func <object> constructor) { _computed = new Computed(() => _viewModel = ForView.Wrap(constructor())); _computed.Invalidated += () => UpdateScheduler.ScheduleUpdate(firePropertyChanged); }
public override object ProvideValue(IServiceProvider serviceProvider) { return(ForView.Wrap(_inner.ProvideValue(serviceProvider))); }