private void ExecuteOperation(Action <CslaOperation <T> > operationExecutor) { try { if (_lastOperation != null) { _lastOperation.Cancel(); } if (!IsConcurentRefreshesAllowed && _lastOperation != null) { _nextOperationExecutor = operationExecutor; return; } Error = null; IsBusy = true; _lastOperation = new CslaOperation <T>(QueryCompleted); operationExecutor(_lastOperation); } catch (Exception ex) { Error = ex; IsBusy = false; } }
private void QueryCompleted(DataPortalResult <T> result, bool isCanceled) { _lastOperation = null; if (!IsConcurentRefreshesAllowed && _nextOperationExecutor != null) { var executor = _nextOperationExecutor; _nextOperationExecutor = null; ExecuteOperation(executor); return; } if (isCanceled) { return; } try { if (result.Error == null) { OnRefreshing(result.Object); Model = result.Object; } else { Error = result.Error; } OnRefreshed(); } finally { IsBusy = false; } }