Ejemplo n.º 1
0
        private static async Task LogCompleteAsync(IBiliDownload download)
        {
            var item = new Entities.CompleteItem()
            {
                Name  = download.DownloadName,
                Title = download.Title,
                Path  = download.OutputPath,
                Size  = download.FullProgress,
                Type  = BiliDownloadType.Manga
            };

            item.Id = (int)await App.SqliteData.AddCompleteItem(item);

            var group = DownloadPage.Current.Groups;

            if (group.Any(g => g.Title == download.Title))
            {
                group.Single(g => g.Title == download.Title).Completes.Add((Complete)item);
            }
            else
            {
                group.Add(new CompleteGroup()
                {
                    Title     = download.Title,
                    Completes = new System.Collections.ObjectModel.ObservableCollection <Complete>()
                    {
                        (Complete)item
                    }
                });
            }
        }
Ejemplo n.º 2
0
 public void RemoveDownload(IBiliDownload download)
 {
     if (_activeDownloads.Contains(download))
     {
         _activeDownloads.Remove(download);
     }
 }
Ejemplo n.º 3
0
        public static void ShowVideoCompleteNotice(IBiliDownload download)
        {
            var content = new ToastContentBuilder().AddToastActivationInfo("downloadCompleted", ToastActivationType.Foreground)
                          .AddText("下载完成")
                          .AddText($"{download.Title} - {download.DownloadName}")
                          .AddButton("播放", ToastActivationType.Foreground, $"video\n{download.OutputPath}")
                          .GetToastContent();

            ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(content.GetXml()));
        }
Ejemplo n.º 4
0
        public static async Task CancelMangaDownloadAsync(IBiliDownload download)
        {
            try
            {
                await download.CancelAsync();

                DownloadPage.Current.RemoveDownload(download);
                _logger.Info($"下载取消 {download.Title}-{download.DownloadName}");
            }
            catch (Exception ex)
            {
                _logger.Info(ex, ex.Message);
                //var dialog = new ExceptionDialog(ex);
                //await dialog.ShowAsync();
                return;
            }
        }
Ejemplo n.º 5
0
 public void CreateDownload(IBiliDownload download)
 {
     _activeDownloads.Add(download);
 }