示例#1
0
文件: NavBar.cs 项目: zjjyyang/ftdr
        private void InvalidateRowFilter()
        {
            if (_applyRowFilterTask != null)
            {
                _applyRowFilterTask.Dispose();
                _applyRowFilterTask = null;
            }
            var bindingListView = GetBindingListView();

            if (bindingListView == null)
            {
                return;
            }
            if (_filterText != tbxFind.Text)
            {
                var unfilteredRows = bindingListView.UnfilteredItems.ToArray();
                if (string.IsNullOrEmpty(tbxFind.Text))
                {
                    bindingListView.SetFilteredItems(unfilteredRows);
                    _filterText = "";
                }
                else
                {
                    _applyRowFilterTask = new ApplyRowFilterTask(unfilteredRows,
                                                                 bindingListView.GetItemProperties(new PropertyDescriptor[0]).Cast <PropertyDescriptor>().ToArray(),
                                                                 tbxFind.Text);
                    new Action(_applyRowFilterTask.FilterBackground).BeginInvoke(ApplyRowFilterTaskCallback, _applyRowFilterTask);
                }
            }
        }
示例#2
0
文件: NavBar.cs 项目: zjjyyang/ftdr
 private void SetFilteredRowsNow(ApplyRowFilterTask applyRowFilterTask, IList <RowItem> rows)
 {
     try
     {
     }
     finally
     {
         applyRowFilterTask.Dispose();
     }
 }
示例#3
0
文件: NavBar.cs 项目: zjjyyang/ftdr
 private void ApplyRowFilterTaskCallback(IAsyncResult result)
 {
     if (!result.IsCompleted)
     {
         return;
     }
     if (!ReferenceEquals(_applyRowFilterTask, result.AsyncState))
     {
         return;
     }
     if (InvokeRequired)
     {
         BeginInvoke(new Action <IAsyncResult>(ApplyRowFilterTaskCallback), result);
         return;
     }
     if (!ReferenceEquals(_applyRowFilterTask, result.AsyncState))
     {
         return;
     }
     try
     {
         var bindingListView = GetBindingListView();
         if (bindingListView == null)
         {
             return;
         }
         bindingListView.SetFilteredItems(_applyRowFilterTask.FilteredRows.ToArray());
         _filterText = _applyRowFilterTask.FilterText;
     }
     finally
     {
         _applyRowFilterTask.Dispose();
         _applyRowFilterTask = null;
     }
     RefreshUi();
 }