private async static Task<string> GetResponseMessage(UploadOperation uploadOperation)
{
ResponseInformation responseInformation = uploadOperation.GetResponseInformation();
//uint contentLength = Convert.ToUInt32(responseInformation.Headers["Content-Length"]);
uint contentLength = (uint)uploadOperation.Progress.BytesReceived;
uint statusCode = responseInformation.StatusCode;
IInputStream resultStreamAt = uploadOperation.GetResultStreamAt(0);
IBuffer result = await resultStreamAt.ReadAsync(
new Windows.Storage.Streams.Buffer(contentLength),
contentLength,
InputStreamOptions.None);
Stream responseStream = result.AsStream();
XDocument xDocument = XDocument.Load(responseStream);
foreach (XElement xe in xDocument.Root.Descendants())
{
if (xe.Name.LocalName.Equals("Ok"))
{
return "SUCCESS";
}
if (xe.Name.LocalName.Equals("Error"))
{
return xe.Value;
}
}
return "Unspecified error submiting video";
}