Example #1
0
        protected override Task SearchCallback() =>
        LockFormForExecution(async() => {
            OnSearchToBegin();

            ItemsFound.Clear();
            await ItemsFoundClearedBeforeSearch();

            OperationResult <List <TSearchReturn> > operation =
                await _dataAccessor.SubmitSearchOrderAsync(DataCollectorConverter(DataCollector));

            if (operation.WasSuccessful)
            {
                await Perform.CollectionRehydrationAsync(ItemsFound, DataGridSourceConverter(operation.Result));
            }
            await ItemsFoundFillComplete();
            if (ItemsFound.Count == 1)
            {
                SelectedItem = ItemsFound.First();
            }

            OnSearchComplete(operation);
        });
        protected override Task SearchCallback() =>
        LockFormForExecution(async() => {
            OnSearchToBegin();

            var itemList = new List <TDataGridSource>();
            await ItemsFoundToBeCleared(ItemsFound);

            if (AttemptDisposalAfterClear)
            {
                itemList.AddRange(ItemsFound ?? Enumerable.Empty <TDataGridSource>());
            }

            ItemsFound.ToList().ForEach(item => ItemsFound.Remove(item));
            await ItemsFoundClearedBeforeSearch();

            OperationResult <List <TSearchReturn> > operation =
                await _dataAccessor.SubmitSearchOrderAsync(DataCollectorConverter(DataCollector));

            if (_disposed)
            {
                return;
            }

            if (operation.WasSuccessful)
            {
                await Perform.CollectionRehydrationAsync(ItemsFound, DataGridSourceConverter(operation.Result));
            }

            await ItemsFoundFillComplete();

            if (ItemsFound.Count == 1 && SelectIfOnlyOneItemReturned)
            {
                SelectedItem = ItemsFound.First();
            }

            OnSearchComplete(operation);
        });