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();
            }
        }
Esempio n. 2
0
        private void ShowDownloadQueue()
        {
            if (this.dqForm == null)
            {
                this.dqForm = new DownloadQueue();
                this.dqForm.Show();

                this.dqForm.Closed += (object sender, EventArgs e) =>
                {
                    this.dqForm = null;
                };
            }
            else if (this.dqForm.Visibility != Visibility.Visible)
            {
                this.dqForm.Show();
            }

            if (!this.dqForm.IsFocused)
            {
                this.dqForm.Focus();
            }
        }