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); }; }
public void ShowDownloadSelectionWindow(FileNameFetchMode mode, IEnumerable <IRequestData> downloads) { RunOnUiThread(() => { ApplicationContext.PlatformUIService.ShowDownloadSelectionWindow(mode, downloads); }); }
public void ShowDownloadSelectionWindow(FileNameFetchMode mode, IEnumerable <IRequestData> downloads) { var dsvc = new DownloadSelectionUIController(DownloadSelectionWindow.CreateFromGladeFile(), FileNameFetchMode.FileNameAndExtension, downloads); dsvc.Run(); }
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(); }); }