Esempio n. 1
0
        public void Update(object obj)
        {
            Debug.Assert(obj != null, "obj为null");

            if (obj == null)
            {
                return;
            }

            if (_currentCodon == null)
            {
                return;
            }

            IBindingListEx bindingList = GetBindingList(_currentCodon);

            if (bindingList == null)
            {
                return;
            }

            //Debug.Assert(bindingList.Contains(obj), "_bindingList中没有指定对象");

            if (bindingList.Contains(obj) == false)
            {
                return;
            }

            if (_currentCodon.Compatible(obj))
            {
                bindingList.ResetItem(bindingList.IndexOf(obj));
            }
        }
Esempio n. 2
0
        public void Update <T>(Filter <T> filter) where T : class
        {
            Debug.Assert(filter != null, "Filter 为 null");

            if (filter == null)
            {
                return;
            }

            if (_currentCodon == null)
            {
                return;
            }

            IBindingListEx bindingList = GetBindingList(_currentCodon);

            if (bindingList == null || bindingList.Count == 0)
            {
                return;
            }

            Type tType = typeof(T);

            if (_currentCodon.UpwardCompatible(tType) == false &&
                _currentCodon.Compatible(tType) == false)
            {
                return;
            }

            for (int i = 0; i < bindingList.Count; i++)
            {
                object obj = bindingList[i];

                if (Compatible(tType, obj.GetType()) && filter((T)obj))
                {
                    bindingList.ResetItem(i);
                }
            }
        }