Beispiel #1
0
 public override void LoadProgress(DBRestClient client, float progress, string destPath)
 {
     if (OnLoadProgress != null)
     {
         OnLoadProgress(progress, destPath);
     }
 }
Beispiel #2
0
 public override void LoadFileFailed(DBRestClient client, NSError error)
 {
     if (OnLoadFileFailed != null)
     {
         OnLoadFileFailed(error);
     }
 }
Beispiel #3
0
 public override void FileMetadataLoaded(DBRestClient client, string destPath, string contentType, DBMetadata metadata)
 {
     if (OnFileMetadataLoaded != null)
     {
         OnFileMetadataLoaded(destPath, contentType, metadata);
     }
 }
        static Task StartDropboxTask (DBRestClient client, FileRequest request, CancellationToken token)
        {
            var description = request.DescriptionAs<DropboxDescription> ();
            var path = description.Path;
            var filename = System.IO.Path.GetFullPath (request.Filename);

            switch (description.Kind) {
            case DropboxDescription.DropboxImageKind.LargeThumbnail:
                return client.LoadThumbnailTask (path, "large", filename, token);
            case DropboxDescription.DropboxImageKind.FullResolution:
                return client.LoadFileTask (path, filename, token);
            default:
                throw new NotImplementedException ();
            }
        }
        public IObservable<Unit> Fetch (Request request)
        {
            return Observable.Create<Unit> (o => {
                var client = new DBRestClient (DBSession.SharedSession);
                var cancel = new CancellationDisposable ();

                var fileRequest = request as FileRequest;
                if (fileRequest == null)
                    throw new NotImplementedException ("DropboxSource only supports saving images to disk");

                var subscription = StartDropboxTask (client, fileRequest, cancel.Token)
                    .ToObservable ()
                    .Subscribe (o);

                return new CompositeDisposable (client, cancel, subscription);
            });
        }
Beispiel #6
0
 public override void LoadProgress(DBRestClient client, nfloat progress, string destPath)
 {
     if (OnLoadProgress != null)
         OnLoadProgress (progress, destPath);
 }
Beispiel #7
0
 public override void LoadFileFailed(DBRestClient client, NSError error)
 {
     if (OnLoadFileFailed != null)
         OnLoadFileFailed (error);
 }
Beispiel #8
0
 public override void FileMetadataLoaded(DBRestClient client, string destPath, string contentType, DBMetadata metadata)
 {
     if (OnFileMetadataLoaded != null)
         OnFileMetadataLoaded (destPath, contentType, metadata);
 }