private void LoadBeatmapData(int Beatmap) { Threaded.Add(() => { ApiRequestBeatmapDetail bm = ApiBase.Create<ApiRequestBeatmapDetail>(Beatmap.ToString()); this.Beatmap = bm.GetData<ApiBeatmap>().Beatmap; Dispatcher.Invoke(DispatcherPriority.Normal, new Action(this.DisplayData)); }); }
public static void AddToQueue(Beatmap bm, DownloadType Type) { if (dqForm == null) { dqForm = new DownloadQueue(); dqForm.Show(); dqForm.Closed += (object sender, EventArgs e) => { dqForm = null; }; } else if (dqForm.Visibility != Visibility.Visible) dqForm.Show(); if (Type == DownloadType.Beatmap) { if (string.IsNullOrEmpty(Configuration.BeatmapDownloadLocation)) { MessageBox.Show("Please first select download locations in settings pannel at the bottom of the window.", "Welp", MessageBoxButton.OK, MessageBoxImage.Information); return; } } Queue.Add(bm); if (QueuedFile != null) QueuedFile(bm); if (DownloaderThread == null) { DownloaderThread = new Thread[4]; DownloaderThread[0] = new Thread(new ThreadStart(DownloadQueue)); DownloaderThread[0].Start(); DownloaderThread[1] = new Thread(new ThreadStart(DownloadQueue)); DownloaderThread[1].Start(); DownloaderThread[2] = new Thread(new ThreadStart(DownloadQueue)); DownloaderThread[2].Start(); DownloaderThread[3] = new Thread(new ThreadStart(DownloadQueue)); DownloaderThread[3].Start(); } }