public void RefreshMessages(Endpoint endpoint, int pageIndex = 1, string searchQuery = null, string orderBy = null, bool ascending = false) { try { eventAggregator.PublishOnUIThread(new WorkStarted("Loading {0} messages...", endpoint == null ? "all" : endpoint.Address)); if (orderBy != null) { lastSortColumn = orderBy; lastSortOrderAscending = ascending; } PagedResult <StoredMessage> pagedResult; if (endpoint != null) { pagedResult = serviceControl.GetAuditMessages(endpoint, pageIndex: pageIndex, searchQuery: searchQuery, orderBy: lastSortColumn, ascending: lastSortOrderAscending); } else if (!searchQuery.IsEmpty()) { pagedResult = serviceControl.Search(pageIndex: pageIndex, searchQuery: searchQuery, orderBy: lastSortColumn, ascending: lastSortOrderAscending); } else { pagedResult = serviceControl.Search(pageIndex: pageIndex, searchQuery: null, orderBy: lastSortColumn, ascending: lastSortOrderAscending); } if (pagedResult == null) { return; } TryRebindMessageList(pagedResult); SearchBar.IsVisible = true; SearchBar.SetupPaging(new PagedResult <StoredMessage> { CurrentPage = pagedResult.CurrentPage, TotalCount = pagedResult.TotalCount, Result = pagedResult.Result, }); } finally { eventAggregator.PublishOnUIThread(new WorkFinished()); } }
public void RefreshMessages(Endpoint endpoint, int pageIndex = 1, string searchQuery = null, string orderBy = null, bool ascending = false) { using (workNotifier.NotifyOfWork($"Loading {(endpoint == null ? "all" : endpoint.Address)} messages...")) { if (orderBy != null) { lastSortColumn = orderBy; lastSortOrderAscending = ascending; } PagedResult <StoredMessage> pagedResult; if (endpoint != null) { pagedResult = serviceControl.GetAuditMessages(endpoint, pageIndex: pageIndex, searchQuery: searchQuery, orderBy: lastSortColumn, ascending: lastSortOrderAscending); } else if (!searchQuery.IsEmpty()) { pagedResult = serviceControl.Search(pageIndex: pageIndex, searchQuery: searchQuery, orderBy: lastSortColumn, ascending: lastSortOrderAscending); } else { pagedResult = serviceControl.Search(pageIndex: pageIndex, searchQuery: null, orderBy: lastSortColumn, ascending: lastSortOrderAscending); } if (pagedResult == null) { return; } TryRebindMessageList(pagedResult); SearchBar.IsVisible = true; SearchBar.SetupPaging(new PagedResult <StoredMessage> { CurrentPage = pagedResult.CurrentPage, TotalCount = pagedResult.TotalCount, Result = pagedResult.Result, }); } }