Pergunta

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.

Foi útil?

Solução

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"
    };

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top