private void Search() { if (IsSearching) { return; } IsSearching = true; SynchronizationContext UIContext = SynchronizationContext.Current; SearchResultList.Clear(); new Thread(() => { string FFUURL = null; string[] EmergencyURLs = null; try { string TempProductType = ProductType.ToUpper(); if ((TempProductType != null) && TempProductType.StartsWith("RM") && !TempProductType.StartsWith("RM-")) { TempProductType = "RM-" + TempProductType.Substring(2); } ProductType = TempProductType; FFUURL = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType); if (TempProductType != null) { ProductType = TempProductType; } if (ProductType != null) { EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType); } } catch { } UIContext.Post(s => { if (FFUURL != null) { SearchResultList.Add(new SearchResult(FFUURL, ProductType, FFUDownloaded, null)); } if (EmergencyURLs != null) { SearchResultList.Add(new SearchResult(ProductType + " emergency-files", EmergencyURLs, ProductType, EmergencyDownloaded, ProductType)); } }, null); IsSearching = false; }).Start(); }
private void DownloadAll() { SynchronizationContext UIContext = SynchronizationContext.Current; new Thread(() => { string FFUURL = null; string[] EmergencyURLs = null; try { string TempProductType = ProductType.ToUpper(); if ((TempProductType != null) && TempProductType.StartsWith("RM") && !TempProductType.StartsWith("RM-")) { TempProductType = "RM-" + TempProductType.Substring(2); } ProductType = TempProductType; FFUURL = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType); if (TempProductType != null) { ProductType = TempProductType; } if (ProductType != null) { EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType); } } catch { } UIContext.Post(s => { if (FFUURL != null) { Download(FFUURL, ProductType, FFUDownloadedAndCheckSupported, null); } if (EmergencyURLs != null) { Download(EmergencyURLs, ProductType, EmergencyDownloaded, ProductType); } }, null); }).Start(); }