private void SetSearchParametersComplete(Object sender, DownloadCompleteEventArgs args) { try { DappleSearchWebDownload oDSWebDownload = sender as DappleSearchWebDownload; if (args.Error != null) throw args.Error; // --- If the search indices don't match, it's because a new search was done before this one completed, so discard these results --- if (oDSWebDownload.SearchIndex == m_lSearchIndex) { XmlDocument oDoc = new XmlDocument(); oDoc.Load(args.Response.GetResponseStream()); SearchResultSet oPage1 = new SearchResultSet(oDoc); InitSearch(oPage1); } } catch (WebException) { this.Invoke(new MethodInvoker(SetSearchFailed)); } catch (XmlException) { this.Invoke(new MethodInvoker(SetSearchFailed)); } }
private void ForwardPageComplete(Object sender, DownloadCompleteEventArgs args) { DappleSearchWebDownload oDSWebDownload = sender as DappleSearchWebDownload; // --- If the search indices don't match, it's because a new search was done before this one completed, so discard these results --- if (oDSWebDownload.SearchIndex == m_lSearchIndex) { XmlDocument oDoc = new XmlDocument(); oDoc.Load(args.Response.GetResponseStream()); SearchResultSet oPage = new SearchResultSet(oDoc); ExtendSearch(oPage, m_iCurrentPage); } }
private void InitSearch(SearchResultSet oResults) { if (InvokeRequired) { this.Invoke(new InitResultsDelegate(InitSearch), new Object[] { oResults }); return; } else { m_iCurrentPage = 0; m_iAccessedPages = 1; if (oResults != null) { int iNumPages = PageNavigator.PagesFromResults(oResults.TotalCount); m_aPages = new SearchResultSet[iNumPages]; if (iNumPages > 0) { m_aPages[0] = oResults; } } else { m_aPages = null; } RefreshResultList(); } }
private void ExtendSearch(SearchResultSet oResults, int iPage) { if (InvokeRequired) { this.Invoke(new UpdateResultsDelegate(ExtendSearch), new Object[] { oResults, iPage }); return; } else { if (oResults != null) { m_aPages[iPage] = oResults; } else { c_oPageNavigator.SetState("DappleSearch not configured"); } RefreshResultList(); } }