Пример #1
0
        private async Task StartDownload()
        {
            isListViewDirty = true;
            if (mediaDownloadQueue.Count == 0)
            {
                TaskDialogHelper.ShowMessage(owner: Handle, icon: TaskDialogStandardIcon.Error, buttons: TaskDialogStandardButtons.Ok,
                                             caption: "No tracks are in the queue.",
                                             message:
                                             "You can add tracks by copying the URL to an album, artist, track, or playlist and pasting it into Athame.");
                return;
            }

            try
            {
                LockUi();
                totalStatusLabel.Text = "Warming up...";
                await mediaDownloadQueue.StartDownloadAsync(Program.DefaultSettings.Settings.SavePlaylist);

                totalStatusLabel.Text      = "All downloads completed";
                collectionStatusLabel.Text = GetCompletionMessage();
                currentlyDownloadingItem   = null;
                mediaDownloadQueue.Clear();
                SetGlobalProgress(0);
                SystemSounds.Beep.Play();
                this.Flash(FlashMethod.All | FlashMethod.TimerNoForeground, Int32.MaxValue, 0);
            }
            catch (Exception ex)
            {
                PresentException(ex);
            }
            finally
            {
                UnlockUi();
            }
        }
Пример #2
0
        private async void startDownloadButton_Click(object sender, EventArgs e)
        {
            isListViewDirty = true;
            if (mediaDownloadQueue.Count == 0)
            {
                using (
                    var td = CommonTaskDialogs.Message(owner: this, icon: TaskDialogStandardIcon.Error, caption: "No tracks are in the queue.",
                                                       message: "You can add tracks by copying the URL to an album, artist, track, or playlist and pasting it into Athame."))
                {
                    td.Show();
                }
                return;
            }

            try
            {
                LockUi();
                totalStatusLabel.Text = "Warming up...";
                await mediaDownloadQueue.StartDownloadAsync();

                totalStatusLabel.Text      = "All downloads completed";
                collectionStatusLabel.Text = GetCompletionMessage();
                currentlyDownloadingItem   = null;
                mediaDownloadQueue.Clear();
                SetGlobalProgress(0);
                SystemSounds.Beep.Play();
                this.Flash(FlashMethod.All | FlashMethod.TimerNoForeground, Int32.MaxValue, 0);
            }
            catch (Exception ex)
            {
                PresentException(ex);
            }
            finally
            {
                UnlockUi();
            }
        }