コード例 #1
0
 protected override void OnLoaded()
 {
     if (_localDiskUser == null)
     {
         _localDiskUser = _localDiskUserRepository.FirstOrDefault();
     }
 }
コード例 #2
0
        public void Save(ILocalDiskUser entity)
        {
            var userPath = Path.Combine(_userDataSavePath, ((LocalDiskUser)entity).Name);

            if (!Directory.Exists(userPath))
            {
                Directory.CreateDirectory(userPath);
            }
            File.WriteAllText(Path.Combine(userPath, "Account.json"), entity.ToString());
        }
コード例 #3
0
        public DownloadedPageViewModel(IUnityContainer container, ILocalDiskUserRepository localDiskUserRepository)
            : base(container)
        {
            _localDiskUser = localDiskUserRepository.FirstOrDefault();

            ClearAllRecordCommand = new Command(ClearAllRecordCommandExecute, () => DownloadTaskList?.Any() ?? false);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(
                OnDownloadCompleted,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.NewState == DownloadStateEnum.Completed);
        }
コード例 #4
0
        protected override void OnLoaded()
        {
            if (_localDiskUser?.CurrentNetDiskUser != null)
            {
                return;
            }

            _localDiskUser = _localDiskUserRepository.FirstOrDefault();
            if (_localDiskUser?.CurrentNetDiskUser != null)
            {
                CurrentFile = Container.Resolve <NetDiskFileNodeViewModel>(new DependencyOverride <INetDiskFile>(_localDiskUser.CurrentNetDiskUser.RootFile));
                CurrentFile?.RefreshChildren();
            }
        }
コード例 #5
0
        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);
        }