//private bool _isDataObsolete = true;

        public NetDiskFileNodeViewModel(IUnityContainer container, INetDiskFile netDiskFile)
            : base(container)
        {
            _netDiskFile = netDiskFile;

            DeleteFileCommand   = new Command(DeleteFileCommandExecuteAsync);
            DownloadFileCommand = new Command(DownloadFileCommandExecuteAsync);
        }
 private DownloadingFile(INetDiskUser owner, INetDiskFile file, IDownloader downloader)
 {
     Owner              = owner;
     File               = file;
     DownloadInfo       = downloader;
     BindableDownloader = downloader.ToBindable(Application.Current.Dispatcher);
     Operations         = downloader.AsManaged("any-drive"); // TODO: To const.
     ArddFilePath       = $"{downloader.Context.LocalPath}{Constants.DownloadInfoFileExtension}";
 }
 private DownloadingFile(INetDiskUser owner, INetDiskFile file, IDownloader downloader)
 {
     Owner              = owner;
     File               = file;
     DownloadInfo       = downloader;
     BindableDownloader = downloader.ToBindable(Application.Current.Dispatcher);
     Operations         = downloader.AsManaged("net-disk"); // TODO: To const.
     ArddFilePath       = $"{downloader.Context.LocalPath}.ardd";
 }
Exemplo n.º 4
0
        private TransferItem MockDownload(INetDiskFile file, FileLocator to)
        {
            var downloader = FileTransferService
                             .GetDownloaderBuilder()
                             .UseSixCloudConfigure()
                             .From(file.Path)
                             .To(to)
                             .Build();

            return(new TransferItem(downloader)
            {
                File = file,
                Owner = this
            });
        }
Exemplo n.º 5
0
        public override IDownloadingFile Download(INetDiskFile from, FileLocator to)
        {
            var downloader = FileTransferService
                             .GetDownloaderBuilder()
                             .UseSixCloudConfigure()
                             .Configure(localPath => localPath.GetUniqueLocalPath(path => File.Exists(path) || File.Exists($"{path}{ArddFileExtension}")))
                             .From(new RemotePathProvider(this, from.Path))
                             .To(Path.Combine(to, from.Path.FileName))
                             .Build();

            var result = DownloadingFile.Create(this, from, downloader);

            SaveDownloadingFile(result);

            return(result);
        }
Exemplo n.º 6
0
        public NetDiskFileNodeViewModel(IUnityContainer container, IMountUserRepository mountUserRepository, INetDiskFile netDiskFile)
            : base(container)
        {
            _mountUserRepository = mountUserRepository;
            _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);
        }
Exemplo n.º 7
0
 public abstract Task UploadAsync(FileLocator @from, INetDiskFile to, Action <TransferItem> callback);
Exemplo n.º 8
0
 public abstract IDownloadingFile Download(INetDiskFile from, FileLocator to);
Exemplo n.º 9
0
 public abstract Task <bool> DeleteFileAsync(INetDiskFile file);
 public DownloadTask(IUnityContainer container, INetDiskFile file, DownloadTaskToken token) : base(container)
 {
 }
Exemplo n.º 11
0
 public override Task <bool> DeleteFileAsync(INetDiskFile file)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 12
0
 public override Task UploadAsync(FileLocator @from, INetDiskFile to, Action <TransferItem> callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
        public override async Task <bool> DeleteFileAsync(INetDiskFile file)
        {
            var result = await WebApi.RemoveFileByPathAsync(new PathArgs { Path = file.Path });

            return(true);
        }
Exemplo n.º 14
0
 public override IDownloadingFile Download(INetDiskFile @from, FileLocator to)
 {
     throw new NotImplementedException();
 }
 public static IDownloadingFile Create(INetDiskUser owner, INetDiskFile file, IDownloader downloader)
 {
     return(new DownloadingFile(owner, file, downloader));
 }