Exemplo n.º 1
0
        private async Task HandleSyncStatusGameFilesOption(SyncFileOption option, IEnumerable <string> files)
        {
            ProgressBarForm form = CreateProgressBar(string.Empty, ProgressBarStyle.Marquee);

            switch (option)
            {
            case SyncFileOption.Add:
                m_progressBarSync = CreateProgressBar("Updating...", ProgressBarStyle.Continuous);
                ProgressBarStart(m_progressBarSync);

                SyncLibraryHandler handler = await Task.Run(() => ExecuteSyncHandler(files.ToArray(), FileManagement.Managed));

                ProgressBarEnd(m_progressBarSync);
                SyncLocalDatabaseComplete(handler, true);
                break;

            case SyncFileOption.Delete:
                form.DisplayText = "Deleting...";
                ProgressBarStart(form);

                await Task.Run(() => DeleteLocalGameFiles(files));

                ProgressBarEnd(form);
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private async Task HandleSyncStatusLibraryOptions(SyncFileOption option, IEnumerable <string> files)
        {
            ProgressBarForm form = new ProgressBarForm();

            form.ProgressBarStyle = ProgressBarStyle.Marquee;

            switch (option)
            {
            case SyncFileOption.Add:
                form.DisplayText = "Searching...";
                ProgressBarStart(form);

                List <IGameFile> gameFiles = await Task.Run(() => FindIdGamesFiles(files));

                foreach (IGameFile gameFile in gameFiles)
                {
                    m_downloadHandler.Download(IdGamesDataSourceAdapter, gameFile as IGameFileDownloadable);
                }

                ProgressBarEnd(form);
                DisplayFilesNotFound(files, gameFiles);

                if (gameFiles.Count > 0)
                {
                    DisplayDownloads();
                }

                break;

            case SyncFileOption.Delete:
                form.DisplayText = "Deleting...";
                ProgressBarStart(form);

                await Task.Run(() => DeleteLibraryGameFiles(files));

                ProgressBarEnd(form);
                UpdateLocal();
                break;

            default:
                break;
            }
        }