protected override void OnLoaded() { if (_localDiskUser == null) { _localDiskUser = _localDiskUserRepository.FirstOrDefault(); } }
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()); }
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); }
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(); } }
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); }