MainPage.xaml.cs
//**************************************************************************
/// <summary>
/// sendTextButton_Click: Action to take when 'WRITE' button is clicked
/// - Create a DataWriter object with the OutputStream of the SerialDevice
/// - Create an async task that performs the write operation
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
Action to take when 'WRITE' button is clicked
Create a DataWriter object with the OutputStream of the SerialDevice
Create an async task that performs the write operation
Action to take when ' WRITE ' button is clicked Create a DataWriter object with the OutputStream of the SerialDevice Create an async task that performs the write operation
private async void sendTextButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (serialPort != null)
                {
                    dataWriteObject = new DataWriter(serialPort.OutputStream);
                    await WriteAsync();
                }
                else
                {
                }
            }
            catch
            {
            }
            finally
            {
                if (dataWriteObject != null)
                {
                    dataWriteObject.DetachStream();
                    dataWriteObject = null;
                }
            }
        }
private async void sendTextButton_Click ( object sender , RoutedEventArgs e ) { try { if ( serialPort != null ) { dataWriteObject = new DataWriter ( serialPort . OutputStream ) ; await WriteAsync ( ) ; } else { } } catch { } finally { if ( dataWriteObject != null ) { dataWriteObject . DetachStream ( ) ; dataWriteObject = null ; } } }
sendTextButton_Click: Action to take when 'WRITE' button is clicked
 Create a DataWriter object with the OutputStream of the SerialDevice
 Create an async task that performs the write operation
sendTextButton_Click : Action to take when ' WRITE ' button is clicked Create a DataWriter object with the OutputStream of the SerialDevice Create an async task that performs the write operation
// Create the DataWriter object and attach to OutputStream //Launch the WriteAsync task to perform the write //status.Text = "Select a device and connect"; //status.Text = "sendTextButton_Click: " + ex.Message; // Cleanup once complete
sender
object
None
e
RoutedEventArgs
None