Exemplo n.º 1
0
        private void UpdateFilter(IAcObjectNew selectObject)
        {
            ClearFilter();

            var listView = InnerItemsSource;

            if (listView == null)
            {
                return;
            }

            var baseFilter = BasicFilter;
            var userFilter = UserFilter;

            var filter = string.IsNullOrWhiteSpace(baseFilter) ? userFilter
                : string.IsNullOrWhiteSpace(userFilter) ? baseFilter : baseFilter + @" & (" + userFilter + @")";

            InnerItemsSource.CurrentChanged -= ItemsSource_CurrentChanged;
            using (listView.DeferRefresh()) {
                if (string.IsNullOrWhiteSpace(filter))
                {
                    listView.Filter = null;
                }
                else
                {
                    _filter         = Filter.Create(UniversalAcObjectTester.Instance, filter);
                    listView.Filter = FilterFunc;
                    _observableCollection.ItemPropertyChanged += Collection_ItemPropertyChanged;
                    _observableCollection.WrappedValueChanged += Collection_WrappedValueChanged;
                }
            }
            InnerItemsSource.CurrentChanged += ItemsSource_CurrentChanged;

            listView.MoveCurrentToOrNull(selectObject);
        }
Exemplo n.º 2
0
        public void MoveCurrentToOrFirst(IAcObjectNew obj) {
            if (obj == null) {
                base.MoveCurrentTo(null);
                return;
            }

            var current = InternalList.Cast<AcItemWrapper>().FirstOrDefault(x => x.Value == obj);
            MoveCurrentTo(current ?? (Count > 0 ? GetItemAt(0) : null));
        }
Exemplo n.º 3
0
        public void MoveCurrentTo(IAcObjectNew obj) {
            if (obj == null) {
                base.MoveCurrentTo(null);
                return;
            }

            var current = InternalList.Cast<AcItemWrapper>().FirstOrDefault(x => x.Value == obj);
            if (current != null) {
                MoveCurrentTo(current);
            }
        }
Exemplo n.º 4
0
        public void MoveCurrentToOrNull(IAcObjectNew obj)
        {
            if (obj == null)
            {
                base.MoveCurrentTo(null);
                return;
            }

            var current = InternalList.Cast <AcItemWrapper>().FirstOrDefault(x => x.Value == obj);

            MoveCurrentTo(current);
        }
Exemplo n.º 5
0
        private void UpdateFilter(IAcObjectNew selectObject) {
            ClearFilter();

            var listView = InnerItemsSource;
            if (listView == null) return;

            var baseFilter = BasicFilter;
            var userFilter = UserFilter;

            var filter = string.IsNullOrWhiteSpace(baseFilter) ? userFilter
                : string.IsNullOrWhiteSpace(userFilter) ? baseFilter : baseFilter + @" & (" + userFilter + @")";

            InnerItemsSource.CurrentChanged -= ItemsSource_CurrentChanged;
            using (listView.DeferRefresh()) {
                if (string.IsNullOrWhiteSpace(filter)) {
                    listView.Filter = null;
                } else {
                    _filter = Filter.Create(UniversalAcObjectTester.Instance, filter);
                    listView.Filter = FilterFunc;
                    _observableCollection.ItemPropertyChanged += Collection_ItemPropertyChanged;
                    _observableCollection.WrappedValueChanged += Collection_WrappedValueChanged;
                }
            }
            InnerItemsSource.CurrentChanged += ItemsSource_CurrentChanged;

            listView.MoveCurrentToOrNull(selectObject);
        }