in DataStreamerAppServiceUWPCommSample/DataStreamerAppServiceUWPCommSample/MainPage.xaml.cs [107:129]
private async Task SendDataAsync()
{
try
{
//Create a message to send to Data Streamer
var message = new ValueSet
{
//When sending data to Data Streamer we always use a "Write" command
{ "Command", "Write" },
//This is the data we will send to Data Streamer. The data should always be a string.
{ "Data", textBox.Text }
};
AppServiceResponse response = await App.DataStreamerConnection.SendMessageAsync(message);
textBlockStatus.Text = response.Message.Count > 0 ? response.Message["Result"].ToString() : response.Status.ToString();
}
catch (Exception ex)
{
textBlockStatus.Text = ex is NullReferenceException ? "Excel -> DataStreamer -> Connect a Device -> Connect to DataStreamerAppServiceUWPCommSample" : ex.Message;
App.IsConnectedToDataStreamerAppService = false;
}
}