コード例 #1
0
ファイル: DownloadManagerInfo.cs プロジェクト: bxstar/KanKan
        public async Task DownLoadFile(string title, string videoSrcUrl, string mode, string downPath)
        {
            if (!string.IsNullOrEmpty(title))
            {
                var downloader = new FlvDownloader(videoSrcUrl);



                var partUrls = new List <string>();

                partUrls = await downloader.GetDownloadFiles(mode);

                if (partUrls != null && partUrls.Count > 0)
                {
                    string newdir = Path.Combine(downPath, title);
                    if (!Directory.Exists(newdir))
                    {
                        Directory.CreateDirectory(newdir);
                    }

                    var taskInfo = new DownloadTaskInfo(title, newdir, partUrls);
                    DownloadTaskList.Add(taskInfo);

                    taskInfo.Start();
                }
            }
        }
コード例 #2
0
        protected override void OnLoaded()
        {
            var netDiskUser = _localDiskUserRepository?.FirstOrDefault()?.CurrentNetDiskUser;

            if (netDiskUser == null)
            {
                return;
            }
            foreach (var item in netDiskUser.GetUncompletedFiles())
            {
                DownloadTaskList.Add(Container.Resolve <DownloadingTaskItemViewModel>(new DependencyOverride <IDiskFile>(item)));
            }
        }
コード例 #3
0
 /// <summary>
 /// 下载文件
 /// </summary>
 /// <param name="localPath"></param>
 /// <param name="fileName"></param>
 /// <param name="guid"></param>
 /// <returns></returns>
 public string download(string localPath, string fileName, string id)
 {
     if (userService == null)
     {
         return(null);
     }
     DownloadTaskList.Add(new FileControlBlock
     {
         FileName  = fileName,
         Id        = id,
         LocalPath = localPath,
         Status    = StatusType.Waiting
     });
     return(null);
 }
コード例 #4
0
 protected override void OnLoaded()
 {
     SetProperty(ref _netDiskUser, _mountUserRepository?.FirstOrDefault()?.GetCurrentNetDiskUser());
     if (_netDiskUser == null)
     {
         DownloadTaskList.Clear();
         return;
     }
     foreach (var item in _netDiskUser.GetUncompletedFiles())
     {
         if (DownloadTaskList.Any(element => element.FileId == item.FileId))
         {
             continue;
         }
         DownloadTaskList.Add(Container.Resolve <DownloadingTaskItemViewModel>(new DependencyOverride <IMountUser>(_mountUserRepository.FirstOrDefault()), new DependencyOverride <IDiskFile>(item)));
     }
 }
コード例 #5
0
        private void InitialDownloadList()
        {
            foreach (var item in TaskManager.GetTaskManagerByLocalDiskUser(_netDiskUser).GetUnCompletedList())
            {
                if (DownloadTaskList.Any(element => element.FileId == item.FileId))
                {
                    continue;
                }

                var viewmodel = new DownloadingTaskItemViewModel(item);
                viewmodel.RemoveItemEvent += (task) =>
                {
                    DownloadTaskList.Remove(task);
                };
                DownloadTaskList.Add(viewmodel);
            }
        }
コード例 #6
0
        protected override void OnLoaded()
        {
            TaskManager.GetTaskManagerByLocalDiskUser(MountUserRepository.MountedUser).TaskCollectionChanged += (httpdownload) =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                });
            };


            foreach (var item in TaskManager.GetTaskManagerByLocalDiskUser(MountUserRepository.MountedUser).GetCompletedList())
            {
                if (DownloadTaskList.Any(element => element.FileId == item.FileId))
                {
                    continue;
                }
                DownloadTaskList.Add(new DownloadedTaskItemViewModel(item));
            }
        }
コード例 #7
0
ファイル: MainWindow.xaml.cs プロジェクト: iSudocat/SudoDrive
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            UserRequest userService = new UserRequest();

            userService.Login("sudodog", "ssss11111", out _);

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "1.txt",
                Id        = "335",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "2.txt",
                Id        = "336",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "3.txt",
                Id        = "337",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "4.txt",
                Id        = "338",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "5.txt",
                Id        = "339",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "6.txt",
                Id        = "340",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });

            DownloadTaskList.Add(new FileControlBlock
            {
                FileName  = "7.txt",
                Id        = "341",
                LocalPath = @"C:\Users\i\Desktop",
                Status    = StatusType.Waiting
            });
        }