Beispiel #1
0
        public DownloadSelectionUIController(IDownloadSelectionView view,
                                             FileNameFetchMode mode, IEnumerable <IRequestData> downloads)
        {
            this.view = view;
            this.mode = mode;

            string?folder = null;

            if (Config.Instance.FolderSelectionMode == FolderSelectionMode.Manual)
            {
                folder = Helpers.GetManualDownloadFolder();
            }
            view.DownloadLocation = folder ?? Config.Instance.DefaultDownloadFolder;
            view.SetData(mode, downloads, PopuplateEntryWrapper);

            view.BrowseClicked += (_, _) =>
            {
                var folder = view.SelectFolder();
                if (!string.IsNullOrEmpty(folder))
                {
                    view.DownloadLocation = folder;
                    Config.Instance.UserSelectedDownloadFolder = folder;
                    Helpers.UpdateRecentFolderList(folder);
                }
            };
            view.DownloadClicked       += View_DownloadClicked;;
            view.DownloadLaterClicked  += View_DownloadLaterClicked;
            view.QueueSchedulerClicked += (s, e) =>
            {
                ApplicationContext.Application.ShowQueueWindow(view);
            };
        }
Beispiel #2
0
 public void ShowDownloadSelectionWindow(FileNameFetchMode mode, IEnumerable <IRequestData> downloads)
 {
     RunOnUiThread(() =>
     {
         ApplicationContext.PlatformUIService.ShowDownloadSelectionWindow(mode, downloads);
     });
 }
Beispiel #3
0
        public void ShowDownloadSelectionWindow(FileNameFetchMode mode, IEnumerable <IRequestData> downloads)
        {
            var dsvc = new DownloadSelectionUIController(DownloadSelectionWindow.CreateFromGladeFile(),
                                                         FileNameFetchMode.FileNameAndExtension, downloads);

            dsvc.Run();
        }
Beispiel #4
0
        public void AddItemToTop(
            string id,
            string targetFileName,
            DateTime date,
            long fileSize,
            string type,
            FileNameFetchMode fileNameFetchMode,
            string primaryUrl,
            DownloadStartType startType,
            AuthenticationInfo?authentication,
            ProxyInfo?proxyInfo)
        {
            var downloadEntry = new InProgressDownloadItem
            {
                Name           = targetFileName,
                DateAdded      = date,
                DownloadType   = type,
                Id             = id,
                Progress       = 0,
                Size           = fileSize,
                Status         = startType == DownloadStartType.Waiting ? DownloadStatus.Waiting : DownloadStatus.Stopped,
                TargetDir      = "",
                PrimaryUrl     = primaryUrl,
                Authentication = authentication,
                Proxy          = proxyInfo
            };

            AppDB.Instance.Downloads.AddNewDownload(downloadEntry);

            RunOnUiThread(() =>
            {
                ApplicationContext.MainWindow.AddToTop(downloadEntry);
                ApplicationContext.MainWindow.SwitchToInProgressView();
                ApplicationContext.MainWindow.ClearInProgressViewSelection();
                UpdateToolbarButtonState();
            });
        }