public DownloadingTaskItemViewModel(IDiskFile diskFile) : base(diskFile)
        {
            // 方法一:
            //var downloadItem = TaskManager.GetTaskManagerByLocalDiskUser(UserMounted).GetDownloadItemById(FileId);
            //if (downloadItem == null) return;
            //downloadItem.DownloadProgressChangedEvent += OnDownloadProgressChanged;
            //downloadItem.DownloadStateChangedEvent += OnDownloadStateChanged;

            // 方法二

            //TaskManager.GetTaskManagerByLocalDiskUser(UserMounted).SubEvents(OnDownloadStateChanged,
            //     OnDownloadProgressChanged, FileId);
        }
Example #2
0
        public DownloadingTaskItemViewModel(IUnityContainer container, IDiskFile diskFile)
            : base(container, diskFile)
        {
            PauseTaskCommand  = new Command(PauseTaskCommandExecute, PauseTaskCommandCanExecute);
            StartTaskCommand  = new Command(StartTaskCommandExecute, StartTaskCommandCanExecute);
            CancelTaskCommand = new Command(CancelTaskCommandExecute);

            EventAggregator.GetEvent <DownloadProgressChangedEvent>().Subscribe(OnDownloadProgressChanged,
                                                                                ThreadOption.UIThread,
                                                                                keepSubscriberReferenceAlive: false,
                                                                                filter: e => e.FileId == FileId);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(OnDownloadStateChanged,
                                                                             ThreadOption.UIThread,
                                                                             keepSubscriberReferenceAlive: false,
                                                                             filter: e => e.FileId == FileId);
        }
Example #3
0
 protected DownloadTaskItemViewModel(IUnityContainer container, IDiskFile diskFile)
     : base(container)
 {
     _diskFile         = diskFile;
     OpenFolderCommand = new Command(OpenFolderCommandExecuteAsync, () => File.Exists(FilePath.FullPath));
 }
        public DownloadingTaskItemViewModel(IUnityContainer container, ILocalDiskUser localDiskUser, IDiskFile diskFile)
            : base(container, diskFile)
        {
            // TODO: Temporary solution.
            _localDiskUser = localDiskUser;

            PauseTaskCommand  = new Command(PauseTaskCommandExecute, () => DownloadState == DownloadStateEnum.Downloading || DownloadState == DownloadStateEnum.Waiting);
            StartTaskCommand  = new Command(StartTaskCommandExecute, () => DownloadState == DownloadStateEnum.Paused);
            CancelTaskCommand = new Command(CancelTaskCommandExecute);

            EventAggregator.GetEvent <DownloadProgressChangedEvent>().Subscribe(OnDownloadProgressChanged,
                                                                                ThreadOption.UIThread,
                                                                                keepSubscriberReferenceAlive: false,
                                                                                filter: e => e.FileId == FileId);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(OnDownloadStateChanged,
                                                                             ThreadOption.UIThread,
                                                                             keepSubscriberReferenceAlive: false,
                                                                             filter: e => e.FileId == FileId);
        }
 public DownloadedTaskItemViewModel(IUnityContainer container, IDiskFile diskFile)
     : base(container, diskFile)
 {
     OpenFileCommand    = new Command(OpenFileCommandExecuteAsync, () => File.Exists(FilePath.FullPath));
     ClearRecordCommand = new Command(ClearRecordCommandExecute);
 }
Example #6
0
 public TaskItemViewModel(IDiskFile diskFile)
 {
     _diskFile = diskFile;
 }