/// <summary> /// Displays the received results, discarding existing data. /// </summary> /// <param name="lookupId">ID of lookup whose results are shown. If ID is smaller than last seen value, we don't show results.</param> /// <param name="entryProvider">The entry provider; ownership passed by caller to me.</param> /// <param name="results">Cedict lookup results to show.</param> /// <param name="script">Defines which script(s) to show.</param> /// <returns>True if results got shown; false if they're discarded because newer results are already on display.</returns> public bool SetResults(int lookupId, ICedictEntryProvider entryProvider, ReadOnlyCollection <CedictResult> results, SearchScript script) { #if DEBUG // Make us crash at bottom if first result "柏林" (comes up for "bolin") if (results.Count > 0) { CedictEntry entry = entryProvider.GetEntry(results[0].EntryId); if (entry.ChSimpl == "柏林") { crashForTest = true; } else { crashForTest = false; } } #endif try { return(doSetResults(lookupId, entryProvider, results, script)); } finally { if (entryProvider != null) { entryProvider.Dispose(); } } }
protected override void OnUnload(EventArgs e) { base.OnUnload(e); // If lookup returned a results provider, dispose it if (prov != null) { prov.Dispose(); } // If we had a POST query, log it if (queryInfo != null && !isStaticQuery) { TimeSpan tsLookup = queryInfo.DTLookup.Subtract(queryInfo.DTStart); TimeSpan tsTotal = DateTime.UtcNow.Subtract(queryInfo.DTStart); QueryLogger.SearchMode smode = QueryLogger.SearchMode.Target; if (queryInfo.Lang == SearchLang.Target) { smode = QueryLogger.SearchMode.Target; } else if (queryInfo.ResCount > 0) { smode = QueryLogger.SearchMode.Source; } else if (queryInfo.AnnCount > 0) { smode = QueryLogger.SearchMode.Annotate; } int cnt = smode == QueryLogger.SearchMode.Annotate ? queryInfo.AnnCount : queryInfo.ResCount; QueryLogger.Instance.LogQuery(queryInfo.HostAddr, isMobile, Master.UILang, Master.UiScript, Master.UiTones, cnt, (int)tsLookup.TotalMilliseconds, (int)tsTotal.TotalMilliseconds, smode, queryInfo.Query); } }
protected override void OnUnload(EventArgs e) { base.OnUnload(e); // If lookup returned a results provider, dispose it if (prov != null) { prov.Dispose(); } // TO-DO: Log query }
/// <summary> /// Displays the received results, discarding existing data. /// </summary> /// <param name="lookupId">ID of lookup whose results are shown. If ID is smaller than last seen value, we don't show results.</param> /// <param name="entryProvider">The entry provider; ownership passed by caller to me.</param> /// <param name="results">Cedict lookup results to show.</param> /// <param name="script">Defines which script(s) to show.</param> /// <returns>True if results got shown; false if they're discarded because newer results are already on display.</returns> public bool SetResults(int lookupId, ICedictEntryProvider entryProvider, ReadOnlyCollection<CedictResult> results, SearchScript script) { #if DEBUG // Make us crash at bottom if first result "柏林" (comes up for "bolin") if (results.Count > 0) { CedictEntry entry = entryProvider.GetEntry(results[0].EntryId); if (entry.ChSimpl == "柏林") crashForTest = true; else crashForTest = false; } #endif try { return doSetResults(lookupId, entryProvider, results, script); } finally { if (entryProvider != null) entryProvider.Dispose(); } }