Created
October 19, 2017 01:44
-
-
Save elbruno/91e32b5732aa8e50c2ac0e70ba378c7a to your computer and use it in GitHub Desktop.
UwpPublishToStreamingDataSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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