コード例 #1
0
        internal static MemberSlot Create(ViewProxy proxy, MemberMeta member)
        {
            if (member.IsCollection)
            {
                if (member.IsObservableCollection)
                {
                    return(new PassThroughSlot(proxy, member));
                }
                else if (member.IsList)
                {
                    return(new ListSlot(proxy, member));
                }
                else
                {
#if NETFRAMEWORK
                    if (BindingListSlot.AppliesTo(member))
                    {
                        return(new BindingListSlot(proxy, member));
                    }
                    else
                    {
                        return(new CollectionSlot(proxy, member));
                    }
#else
                    return(new CollectionSlot(proxy, member));
#endif
                }
            }
            else
            {
                return(new AtomSlot(proxy, member));
            }
        }
コード例 #2
0
ファイル: MemberSlot.cs プロジェクト: hispafox/Assisticant
 internal static MemberSlot Create(ViewProxy proxy, MemberMeta member)
 {
     if (member.IsCollection)
     {
         return(new CollectionSlot(proxy, member));
     }
     else
     {
         return(new AtomSlot(proxy, member));
     }
 }
コード例 #3
0
        public BindingListSlot(ViewProxy proxy, MemberMeta member)
            : base(proxy, member)
        {
            _newItemMethod    = GetNewItemMethod(member);
            _deleteItemMethod = GetDeleteItemMethod(member);

            _bindingList.AllowNew     = true;
            _bindingList.AllowEdit    = true;
            _bindingList.AllowRemove  = true;
            _bindingList.AddingNew   += BindingList_AddingNew;
            _bindingList.ListChanged += BindingList_ListChanged;
        }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
        public ListSlot(ViewProxy proxy, MemberMeta member)
            : base(proxy, member)
        {
            _collectionChangedFromUIEventHandler = new NotifyCollectionChangedEventHandler((s, e) =>
            {
                if (!_publishingChanges)
                {
                    switch (e.Action)
                    {
                    case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                        foreach (var item in e.NewItems)
                        {
                            _sourceCollection.Add(UnwrapValue(item));
                        }
                        _computed.MakeDependentsOutOfDate();
                        break;

                    case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                        foreach (var item in e.OldItems)
                        {
                            _sourceCollection.Remove(UnwrapValue(item));
                        }
                        _computed.MakeDependentsOutOfDate();
                        break;

                    case NotifyCollectionChangedAction.Reset:
                        _sourceCollection.Clear();
                        _computed.MakeDependentsOutOfDate();
                        break;

                    default:
                        break;
                    }

                    if (Proxy.IsNotifying)
                    {
                        // The view is modifying the list in response to another update.
                        // After it stops, notify it of other changes so that it can get the correct list.
                        Proxy.WasModified(this);
                    }
                }
            });
        }
コード例 #6
0
 internal AtomSlot(ViewProxy proxy, MemberMeta member)
     : base(proxy, member)
 {
 }
コード例 #7
0
 public PassThroughSlot(ViewProxy proxy, MemberMeta member) : base(proxy, member)
 {
 }
コード例 #8
0
 public CollectionSlot(ViewProxy proxy, MemberMeta member)
     : base(proxy, member)
 {
 }