Пример #1
0
        public HomeViewModel(IUnityContainer container, ILocalDiskUserRepository localDiskUserRepository)
            : base(container)
        {
            _localDiskUserRepository = localDiskUserRepository;

            // TODO: Replace the Command to Prism.Commands.DelegateCommand.
            ReturnFolderCommand      = new Command(() => CurrentFile = CurrentFile.Parent, () => CurrentFile?.Parent != null);
            EnterFolderCommand       = new Command <NetDiskFileNodeViewModel>(file => CurrentFile = file, file => file?.FileType == FileTypeEnum.FolderType);
            RefreshFileListCommand   = new Command(RefreshFileListCommandExecuteAsync);
            BatchDownloadFileCommand = new Command <IList>(BatchDownloadFileCommandExecute, param => GetSeletedItems(param).Any());
            BatchDeleteFileCommand   = new Command <IList>(BatchDeleteFileCommandExecute, param => GetSeletedItems(param).Any());
        }
Пример #2
0
        public DownloadedPageViewModel(IUnityContainer container, ILocalDiskUserRepository localDiskUserRepository)
            : base(container)
        {
            _localDiskUserRepository = localDiskUserRepository;

            ClearAllRecordCommand = new Command(ClearAllRecordCommandExecute, () => DownloadTaskList?.Any() ?? false);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(
                OnDownloadCompleted,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.NewState == DownloadStateEnum.Completed);
        }
        public DownloadingPageViewModel(IUnityContainer container, ILocalDiskUserRepository localDiskUserRepository)
            : base(container)
        {
            _localDiskUserRepository = localDiskUserRepository;
            Func <bool> isAnyElementInDownloadTaskList = () => DownloadTaskList?.Any() ?? false;

            PauseAllCommand  = new Command(PauseAllCommandExecute, isAnyElementInDownloadTaskList);
            StartAllCommand  = new Command(StartAllCommandExecute, isAnyElementInDownloadTaskList);
            CancelAllCommand = new Command(CancelAllCommandExecute, isAnyElementInDownloadTaskList);

            EventAggregator.GetEvent <DownloadProgressChangedEvent>().Subscribe(OnDownloadPregressChanged, ThreadOption.UIThread);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(OnDownloadStateChanged, ThreadOption.UIThread);
        }
        public NetDiskFileNodeViewModel(IUnityContainer container, ILocalDiskUserRepository localDiskUserRepository, INetDiskFile netDiskFile)
            : base(container)
        {
            _localDiskUserRepository = localDiskUserRepository;
            _netDiskFile             = netDiskFile;

            DeleteFileCommand   = new Command(DeleteFileCommandExecuteAsync);
            DownloadFileCommand = new Command(DownloadFileCommandExecuteAsync);

            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(
                OnDownloadStateChanged,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.FileId == FileId);
            EventAggregator.GetEvent <DownloadProgressChangedEvent>().Subscribe(
                OnDownloadProgressChanged,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.FileId == FileId);
        }
Пример #5
0
 public ConfigurePageViewModel(IUnityContainer container, ILocalDiskUserRepository localDiskUserRepository)
     : base(container)
 {
     _localDiskUserRepository = localDiskUserRepository;
     OpenFolderBrowserCommand = new Command(OpenFolderBrowserCommandExecute, () => _localDiskUser != null);
 }