Exemplo n.º 1
0
        static void Main(string[] args)
        {
            DeviceServices.SendMessageAsync(deviceClient).GetAwaiter();
            DeviceServices.RecieveMessageAsync(deviceClient).GetAwaiter();

            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            DeviceServices.deviceClient.SetMethodHandlerAsync("SetTelemetryInterval", DeviceServices.SetTelemetryInterval, null).Wait();
            DeviceServices.SendMessageAsync().GetAwaiter();

            Console.ReadKey();
        }
 private void btnSendMessage_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DeviceServices.SendMessageAsync(deviceClient).GetAwaiter();
     }
     catch { }
 }
Exemplo n.º 4
0
        private async void btnSendMessageAsync_Click(object sender, RoutedEventArgs e)
        {
            var result = await DeviceServices.SendMessageAsync(deviceClient);

            dynamic data = JObject.Parse(result);

            var temp = Convert.ToString(data.Temperature);
            var hum  = Convert.ToString(data.Humidity);

            DeviceServices.ReceiveMessageAsync(deviceClient).GetAwaiter();

            try
            {
                weatherlist.Add(new TempratureModel($"Temeprature: {temp}", $"Humidity: {hum}"));
            }
            catch
            {
            }
        }