Esempio n. 1
0
        public void RefreshDownloadItems()
        {
            if (!m_Releases.Any())
            {
                RefreshAfterSynchronize(null);
            }

            DownloadItemsMode type = DownloadItemsMode.All;

            switch (m_SelectedSection.Type)
            {
            case DownloadSectionType.All:
                type = DownloadItemsMode.All;
                break;

            case DownloadSectionType.Downloading:
                type = DownloadItemsMode.Downloading;
                break;

            case DownloadSectionType.Downloaded:
                type = DownloadItemsMode.Downloaded;
                break;

            case DownloadSectionType.NotDownloaded:
                type = DownloadItemsMode.NotDownloaded;
                break;

            default: throw new NotSupportedException($"Type {type} not supported");
            }
            Downloads = m_DownloadService.GetDownloads(type)
                        .Select(MapToModel)
                        .ToList();
            NoFilteredDownloads = !Downloads.Any();
        }
        public void RefreshDownloadItems()
        {
            if (!m_Releases.Any())
            {
                RefreshAfterSynchronize(null);
            }

            var selectedReleaseId = SelectedDownload?.ReleaseId;

            DownloadItemsMode type = DownloadItemsMode.All;

            switch (m_SelectedSection.Type)
            {
            case DownloadSectionType.All:
                type = DownloadItemsMode.All;
                break;

            case DownloadSectionType.Downloading:
                type = DownloadItemsMode.Downloading;
                break;

            case DownloadSectionType.Downloaded:
                type = DownloadItemsMode.Downloaded;
                break;

            case DownloadSectionType.NotDownloaded:
                type = DownloadItemsMode.NotDownloaded;
                break;

            default: throw new NotSupportedException($"Type {type} not supported");
            }
            var downloads = m_DownloadService.GetDownloads(type)
                            .Select(MapToModel)
                            .ToList();

            Downloads           = FilterDownloads(downloads);
            NoFilteredDownloads = !Downloads.Any();

            if (selectedReleaseId.HasValue)
            {
                SelectedDownload = Downloads.FirstOrDefault(a => a.ReleaseId == selectedReleaseId.Value);
            }
        }