Beispiel #1
0
        private static async void PushData(Dictionary <string, string> values)
        {
            if (null == GUID)
            {
                throw new Exception("GUID was not set, data cannot be sent!");
            }

            if (null == URL)
            {
                throw new Exception("URL was not set, data cannot be sent!");
            }

            if (values.Count < 1)
            {
                throw new ArgumentException("No data was given to be sent!");
            }

            FormUrlEncodedContent content = new FormUrlEncodedContent(values);

            string postAddress = string.Format("{0}/{1}.json", URL, GUID);

            HttpResponseMessage response = await client.PostAsync(postAddress, content);

            var responseString = await response.Content.ReadAsStringAsync();

            EvtPushDataAnswer?.Invoke(typeof(Volkszaehler), new Classes.PushDataAnswer(responseString, DateTime.Now));
        }
Beispiel #2
0
        private static async void PushData(Dictionary <string, string> values)
        {
            FormUrlEncodedContent content = new FormUrlEncodedContent(values);

            string postAddress = string.Format("{0}/{1}.json", URL, GUID);

            HttpResponseMessage response = await client.PostAsync(postAddress, content);

            var responseString = await response.Content.ReadAsStringAsync();

            EvtPushDataAnswer?.Invoke(typeof(Volkszaehler), new PushDataAnswer(responseString, DateTime.Now));
        }