private async void Firmata_StringMessageReceived(UwpFirmata caller, StringCallbackEventArgs argv) { var content = argv.getString(); await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { this.ReadingTextBlock.Text = content; }); }
/// <summary> /// This is just used for some brute force debugging. I have added various /// /// Firmata.sendMessage("...."); /// /// statements to the sketch deployed to the arduino to get feedback when /// things are happening on the arduino. /// </summary> /// <param name="caller"></param> /// <param name="argv"></param> private async void Firmata_StringMessageReceived(UwpFirmata caller, StringCallbackEventArgs argv) { string message = argv.getString(); FirmataMessage firmataMessage = new FirmataMessage(message); Debug.WriteLine(firmataMessage); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() => { //Add the message to the top of the list so that most recent messages appear at the top Messages.Insert(0, firmataMessage); })); }