コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 protected IEnumerable <T> GetCollection <T>(Func <IEnumerable <T> > getMethod, [CallerMemberName] string propertyName = "")
 {
     ForView.Initialize();
     return(_propertyTracker.GetCollection(getMethod, propertyName));
 }
コード例 #5
0
 protected T Get <T>(Func <T> getMethod, [CallerMemberName] string propertyName = "")
 {
     ForView.Initialize();
     return(_propertyTracker.Get(getMethod, propertyName));
 }
コード例 #6
0
 public ViewModelContainer(Action firePropertyChanged, Func <object> constructor)
 {
     _computed              = new Computed(() => _viewModel = ForView.Wrap(constructor()));
     _computed.Invalidated += () => UpdateScheduler.ScheduleUpdate(firePropertyChanged);
 }
コード例 #7
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     return(ForView.Wrap(_inner.ProvideValue(serviceProvider)));
 }