public void GetFetchRecomended() { if (!Settings.Top100Enabled) { return; } if (!Fething) { Fething = true; TempThred tempThred = new TempThred(); tempThred.typeId = 21; // MAKE SURE THIS IS BEFORE YOU CREATE THE THRED tempThred.Thread = new System.Threading.Thread(() => { try { var f = FetchRecomended(bookmarkPosters.Select(t => t.id).ToList()); if (!GetThredActive(tempThred)) { return; } ; // COPY UPDATE PROGRESS iMDbTopList.AddRange(f); LoadMoreImages(); } finally { Fething = false; JoinThred(tempThred); } }); tempThred.Thread.Name = "GetFetchRecomended"; tempThred.Thread.Start(); } }
public void GetFetch(int start = 1) { if (!Settings.Top100Enabled) { return; } Fething = true; TempThred tempThred = new TempThred(); tempThred.typeId = 21; // MAKE SURE THIS IS BEFORE YOU CREATE THE THRED tempThred.Thread = new System.Threading.Thread(() => { try { var f = FetchTop100(new List <string>() { genres[MovieTypePicker.SelectedIndex] }, start); if (!GetThredActive(tempThred)) { return; } ; // COPY UPDATE PROGRESS iMDbTopList.AddRange(f); /* Device.BeginInvokeOnMainThread(() => { * * for (int i = 0; i < iMDbTopList.Count; i++) { * * string img = ConvertIMDbImagesToHD(iMDbTopList[i].img, 67, 98, 4); * IMDbTopList x = iMDbTopList[i]; * * AddEpisode(new EpisodeResult() { Description = x.descript, Title = x.name + " | ★ " + x.rating.Replace(",", "."), Id = x.place, PosterUrl = img, extraInfo = "Id="+x.id+"|||Name="+x.name+"|||" }, false); * } * * // LoadMoreImages(false); * // LoadMoreImages(); * * });*/ //if (!GetThredActive(tempThred)) { return; }; // COPY UPDATE PROGRESS LoadMoreImages(); } finally { Fething = false; JoinThred(tempThred); } }); tempThred.Thread.Name = "FethTop100"; tempThred.Thread.Start(); }
public string DownloadUrl(string url, string fileName, bool mainPath, string extraPath, string toast = "", bool isNotification = false, string body = "") { CloudStreamCore.print(fileName); string basePath = GetPath(fileName); try { //webClient.DownloadFile(url, basePath); using (WebClient wc = new WebClient()) { wc.DownloadProgressChanged += (o, e) => { _App.OnDownloadProgressChanged(basePath, e); /* * if (e.ProgressPercentage == 100) { * App.ShowToast("Download Successful"); * //OpenFile(basePath); * }*/ // print(e.ProgressPercentage + "|" + basePath); }; wc.DownloadFileCompleted += (o, e) => { if (toast != "") { if (isNotification) { _App.ShowNotification(toast, body); } else { ShowToast(toast, 2.5); } } }; wc.DownloadFileAsync( // Param1 = Link of file new System.Uri(url), // Param2 = Path to save basePath ); } } catch (Exception) { print("PROGRESS FAILED"); _App.ShowToast("Download Failed"); return(""); } return(basePath); try { TempThred tempThred = new TempThred(); tempThred.typeId = 4; // MAKE SURE THIS IS BEFORE YOU CREATE THE THRED tempThred.Thread = new System.Threading.Thread(() => { try { WebClient webClient = new WebClient(); byte[] data = webClient.DownloadData(url); DownloadFile(data, fileName, mainPath, extraPath); //if (!GetThredActive(tempThred)) { return; }; // COPY UPDATE PROGRESS } finally { JoinThred(tempThred); } }); tempThred.Thread.Name = "Download Thread"; tempThred.Thread.Start(); return(GetPath(fileName)); } catch (Exception) { CloudStreamForms.App.ShowToast("Download Failed"); return(""); } }