Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created October 19, 2017 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/91e32b5732aa8e50c2ac0e70ba378c7a to your computer and use it in GitHub Desktop.
Save elbruno/91e32b5732aa8e50c2ac0e70ba378c7a to your computer and use it in GitHub Desktop.
UwpPublishToStreamingDataSet.cs
private async void ReportVisitorsAsync(string pushUrl, int totalVisitors, int totalVisitorsIdentified, string centerName)
{
var visitorsMeasurement = new
{
TotalVisitors = totalVisitors,
TotalRecognizedVisitors = totalVisitorsIdentified,
timeStamp = DateTime.Now,
CenterName = centerName
};
var jsonString = JsonConvert.SerializeObject(visitorsMeasurement);
var request = WebRequest.Create(pushUrl);
request.Method = "POST";
request.ContentType = "application/json";
using (var requestWriter = new StreamWriter(await request.GetRequestStreamAsync()))
{
requestWriter.Write(jsonString);
requestWriter.Flush();
}
await request.GetResponseAsync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment