Exemple #1
0
        private void downloadBundled()
        {
            if (bundledDownloader != null)
            {
                return;
            }

            bundledDownloader = new BundledBeatmapDownloader(false);

            AddInternal(bundledDownloader);

            foreach (var tracker in bundledDownloader.DownloadTrackers)
            {
                tracker.State.BindValueChanged(_ => updateProgress(), true);
            }

            void updateProgress()
            {
                double progress = (double)bundledDownloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / bundledDownloader.DownloadTrackers.Count();

                if (progress == 1)
                {
                    downloadBundledButton.Complete();
                }
                else
                {
                    downloadBundledButton.SetProgress(progress, true);
                }
            }
        }
Exemple #2
0
        private void downloadTutorial()
        {
            if (tutorialDownloader != null)
            {
                return;
            }

            tutorialDownloader = new BundledBeatmapDownloader(true);

            AddInternal(tutorialDownloader);

            var downloadTracker = tutorialDownloader.DownloadTrackers.First();

            downloadTracker.State.BindValueChanged(state =>
            {
                if (state.NewValue == DownloadState.LocallyAvailable)
                {
                    downloadTutorialButton.Complete();
                }
            }, true);

            downloadTracker.Progress.BindValueChanged(progress =>
            {
                downloadTutorialButton.SetProgress(progress.NewValue, false);
            }, true);
        }