private async void SendEmotionButton_Click(object sender, RoutedEventArgs e) { Status.Text = string.Empty; await IotHubClient.InitializeConnections(); if (string.IsNullOrEmpty(this.EmotionValue.Text)) { SolidColorBrush brush = new SolidColorBrush(Windows.UI.Colors.Red); Status.Foreground = brush; Status.Text = "No Emotion data to send"; return; } await IotHubClient.SendFootfallAndEmotionData(this.EmotionValue.Text); if (string.IsNullOrEmpty(IotHubClient.ErrorString)) { SolidColorBrush brush = new SolidColorBrush(Windows.UI.Colors.Green); Status.Foreground = brush; Status.Text = "sent"; } else { SolidColorBrush brush = new SolidColorBrush(Windows.UI.Colors.Red); Status.Foreground = brush; Status.Text = "Error sending emotion data : " + IotHubClient.ErrorString; } }
private async void SendTelemetryButton_Click(object sender, RoutedEventArgs e) { Status.Text = string.Empty; await IotHubClient.InitializeConnections(); IotHubClient.SendWeightDataToIotHub(); if (string.IsNullOrEmpty(IotHubClient.ErrorString)) { SolidColorBrush brush = new SolidColorBrush(Windows.UI.Colors.Green); Status.Foreground = brush; Status.Text = "sending food consumption data continuously...."; } else { SolidColorBrush brush = new SolidColorBrush(Windows.UI.Colors.Red); Status.Foreground = brush; Status.Text = "Error sending telemetry data : " + IotHubClient.ErrorString; } }