public override void OnLoaded()
 {
     if (TransferredFiles == null)
     {
         TransferredFiles = new ObservableSortedCollection <ILocalDiskFile>(
             AcceleriderUser
             .GetNetDiskUsers()
             .SelectMany(item => item.GetDownloadedFiles()),
             DefaultTransferredFileComparer);
     }
 }
        public DownloadedViewModel(IUnityContainer container, IDownloaderManager downloaderManager) : base(container)
        {
            _downloaderManager = downloaderManager;

            EmptyAllRecordCommand = new RelayCommand(
                () =>
            {
                AcceleriderUser.GetNetDiskUsers().ForEach(item => item.ClearDownloadFiles());
                TransferredFiles.Clear();
            },
                () => TransferredFiles?.Any() ?? false);

            EventAggregator.GetEvent <TransferItemCompletedEvent>().Subscribe(
                item => TransferredFiles.Add(item),
                Prism.Events.ThreadOption.UIThread,
                true,
                _ => TransferredFiles != null);
        }
        public override void OnLoaded()
        {
            if (TransferTasks == null)
            {
                TransferTasks = new ObservableSortedCollection <IDownloadingFile>(DownloadingFileComparer);

                AcceleriderUser
                .GetNetDiskUsers()
                .SelectMany(item => item.GetDownloadingFiles())
                .ForEach(item =>
                {
                    if (item.DownloadInfo.Status != TransferStatus.Completed)
                    {
                        InitializeTransferItem(item);
                    }
                    else
                    {
                        EventAggregator
                        .GetEvent <TransferItemCompletedEvent>()
                        .Publish(LocalDiskFile.Create(item));
                    }
                });
            }
        }
Exemplo n.º 4
0
        public async void OnLoaded()
        {
            await AcceleriderUser.RefreshAsyncEx();

            NetDiskUsers = new ObservableCollection <INetDiskUser>(AcceleriderUser.GetNetDiskUsers());
        }