This project is read-only.

Progress Bar Sample

Aug 9, 2011 at 9:41 AM

Hello,

i'm playing around with these really nice library since a few days and got some simple CloudStorage tasks working on my apache2 webdav server. I've to say that i've switched from advanced php web development to C# application development only a few weeks ago - cause of that my understanding in this language is not at a high level. Please be patient ;)

So here is my request: I've been searching this site and the source code unit tests for a easy example for a progress bar implementation. I already found some code snippets that took me to the right way but after all i didn't brought it to a functional state. So could you anyone here provide me a simple sample how to implement a progress bar into an upload or download function?

An other question is. I made some sample scripts for the webdav connection ( cause it is different from the dropbox samples ). Is there a way to publish it in the Documentation area so that other ppl will have an easier start to webdav?

Greetings

Aug 9, 2011 at 4:12 PM
Hi,

you problem with the progress bar should be solved with the sample in our first tutorial. Code can be find here: http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=sharpbox&DownloadId=268444 and the tutorial pdf should be find here: http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=sharpbox&DownloadId=268435

If you check out the code go to the sample into Program.cs and search for the following lines

// upload a testfile from temp directory into public folder of DropBox
// with progress information
dropBoxStorage.UploadFile(srcFile, publicFolder, UploadDownloadProgress);

As you can see we attach a simple callback to the upload or download method. This call will be triggered every transfered chunk. To calculate the percentages for a progressbar the following parameters in the callback can be used:

sizebystes - contains the amount of bytes which has to be transfered totally
currentbytes - contains the amount of bytes currently transfered

Just calc the percentage value and set the value of your progressbar.

For your other question: Because of an other request I added an appendix in the pdf tutorial which describes the way for WebDav as well. Would be cool to get feedback from your side if something missing.

Thanks
Dirk


2011/8/9 maltmann <notifications@codeplex.com>

From: maltmann

Hello,

i'm playing around with these really nice library since a few days and got some simple CloudStorage tasks working on my apache2 webdav server. I've to say that i've switched from advanced php web development to C# application development only a few weeks ago - cause of that my understanding in this language is not at a high level. Please be patient ;)

So here is my request: I've been searching this site and the source code unit tests for a easy example for a progress bar implementation. I already found some code snippets that took me to the right way but after all i didn't brought it to a functional state. So could you anyone here provide me a simple sample how to implement a progress bar into an upload or download function?

An other question is. I made some sample scripts for the webdav connection ( cause it is different from the dropbox samples ). Is there a way to publish it in the Documentation area so that other ppl will have an easier start to webdav?

Greetings

Read the full discussion online.

To add a post to this discussion, reply to this email (sharpbox@discussions.codeplex.com)

To start a new discussion for this project, email sharpbox@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Aug 16, 2011 at 3:34 PM

Hi,

thank you for your fast response. It was a hard way for me as a C# beginner but finally got it working today. I had many things to learn about backgroundworker prozesses... but now it works like a charm.

Here as promised my code for connecting to a apache2 WebDAV server:

// collect user data used for login
GenericNetworkCredentials credentials = new GenericNetworkCredentials();
credentials.UserName = Username;
credentials.Password = Password;
ICloudStorageCredentials cloudCredentials = credentials;

// build url to webdav server
UriBuilder ub = new UriBuilder();
ub.Scheme = "http";
ub.Host = "webserver.de";
ub.Port = 80;
Uri uri = ub.Uri;

// create configuration object
WebDavConfiguration actConfiguration = new WebDavConfiguration(uri);

// create storage object
CloudStorage webdavStorage = new CloudStorage();

// establish connection
webdavStorage.Open(actConfiguration,cloudCredentials);
if (webdavStorage.IsOpened)
{
      // upload - download - whatever
      //....
      webdavStorage.Close();
}

Perhaps it will help someone...

Aug 16, 2011 at 10:51 PM

That helped me immensely Thank you!

Apr 25, 2016 at 1:20 PM
How to get the information sizebystes, currentbytes to show on front end. For example to an aspx page?