Domanda

I'm using BackgroundTransferRequest in WP8 application for uploading a file to my server. The server receives the file and send a response back with some useful info regarding uploaded file. How can I get this info?

It seems there's no API for that (shamely). Probably, I'm missing something.

Note that request.BytesReceived property returns 99 bytes, looks like request knows that some data is returned from server, but I've no idea how to get it.

È stato utile?

Soluzione

With the great help of Eric Fleck form MSFT we found out that adding DownloadLocation and Method="Post" properties making response to be written in DownloadLocation file. So the valid request is:

var request = new BackgroundTransferRequest(targetUri)
    {
        DownloadLocation = new Uri(downloadTo, UriKind.Relative),
        UploadLocation = new Uri(uploadFrom, UriKind.Relative),
        Method = "POST"
    };

Altri suggerimenti

It appears that there are two events you can subscribe to, TransferStatusChanged and TransferProgressChanged (see MSDN BackgroundTransferRequest page). Would these provide the information you're looking for?

There is also an example "How to implement background file transfers for Windows Phone" that shows a way to display transfer information for multiple transfers.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top