private void BeatSaverApi_DownloadCompleted(object sender, BeatSaver.Events.DownloadCompletedEventArgs e)
        {
            BeatmapDownloadingUserControl downloadingUserControl = GetDownloadingBeatmap(e.Beatmap);

            if (downloadingUserControl is null)
            {
                return;
            }

            BeatmapCompletedUserControl completedUserControl = new BeatmapCompletedUserControl(e.Beatmap, downloadingUserControl.ViewModel.ToDownload);

            userControl.stackPanelDownloading.Children.Remove(downloadingUserControl);
            DownloadingCount--;
            userControl.stackPanelCompleted.Children.Insert(0, completedUserControl);
            CompletedCount++;
        }
        private BeatmapCompletedUserControl GetCompletedBeatmap(OnlineBeatmap beatmap)
        {
            BeatmapCompletedUserControl completedUserControl = null;

            foreach (object obj in userControl.stackPanelCompleted.Children)
            {
                if (obj is BeatmapCompletedUserControl control)
                {
                    if (control.ViewModel.Beatmap == beatmap)
                    {
                        completedUserControl = control;
                        break;
                    }
                }
            }

            return(completedUserControl);
        }
        private void BeatSaverApi_DownloadFailed(object sender, BeatSaver.Events.DownloadFailedEventArgs e)
        {
            BeatmapDownloadingUserControl downloadingUserControl = GetDownloadingBeatmap(e.Beatmap);
            BeatmapCompletedUserControl   completedUserControl   = GetCompletedBeatmap(e.Beatmap);
            BeatmapFailedUserControl      failedUserControl      = new BeatmapFailedUserControl(e.Beatmap, e.Exception);

            userControl.stackPanelFailed.Children.Insert(0, failedUserControl);
            FailedCount++;

            if (downloadingUserControl != null)
            {
                userControl.stackPanelDownloading.Children.Remove(downloadingUserControl);
                DownloadingCount--;
            }
            else if (completedUserControl != null)
            {
                userControl.stackPanelCompleted.Children.Remove(completedUserControl);
                CompletedCount--;
            }
        }