/// <summary>
        /// Event handler for clicks on the "Send bidi request" button.
        /// </summary>
        private void SendBidiRequest_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PrinterInfo queue = (PrinterInfo)PrinterComboBox.SelectedItem;

                // Retrieve a COM IPrinterExtensionContext object, using the static WinRT factory.
                // Then instantiate one "PrinterExtensionContext" object that allows operations on the COM object.
                Object comComtext = Windows.Devices.Printers.Extensions.PrintExtensionContext.FromDeviceId(queue.DeviceId);
                PrinterExtensionContext context = new PrinterExtensionContext(comComtext);

                // Create an instance of the callback object, and perform an asynchronous 'bidi set' operation.
                PrinterBidiSetRequestCallback callback = new PrinterBidiSetRequestCallback();

                // Add an event handler to the callback object's OnBidiResponseReceived event.
                // The event handler will be invoked once the Bidi response is received.
                callback.OnBidiResponseReceived += OnBidiResponseReceived;

                // Send the Bidi "Set" query asynchronously.
                IPrinterExtensionAsyncOperation operationContext
                    = context.Queue.SendBidiSetRequestAsync(BidiQueryInput.Text, callback);

                // Note: The 'operationContext' object can be used to cancel the operation if required.
            }
            catch (Exception exception)
            {
                rootPage.NotifyUser("Caught an exception: " + exception.Message, NotifyType.ErrorMessage);
            }
        }
        /// <summary>
        /// Event handler for clicks on the "Send bidi request" button.
        /// </summary>
        private void SendBidiRequest_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PrinterInfo queue = (PrinterInfo)PrinterComboBox.SelectedItem;

                // Retrieve a COM IPrinterExtensionContext object, using the static WinRT factory.
                // Then instantiate one "PrinterExtensionContext" object that allows operations on the COM object.
                Object comComtext = Windows.Devices.Printers.Extensions.PrintExtensionContext.FromDeviceId(queue.DeviceId);
                PrinterExtensionContext context = new PrinterExtensionContext(comComtext);

                // Create an instance of the callback object, and perform an asynchronous 'bidi set' operation.
                PrinterBidiSetRequestCallback callback = new PrinterBidiSetRequestCallback();

                // Add an event handler to the callback object's OnBidiResponseReceived event.
                // The event handler will be invoked once the Bidi response is received.
                callback.OnBidiResponseReceived += OnBidiResponseReceived;

                // Send the Bidi "Set" query asynchronously.
                IPrinterExtensionAsyncOperation operationContext
                    = context.Queue.SendBidiSetRequestAsync(BidiQueryInput.Text, callback);

                // Note: The 'operationContext' object can be used to cancel the operation if required.
            }
            catch (Exception exception)
            {
                rootPage.NotifyUser("Caught an exception: " + exception.Message, NotifyType.ErrorMessage);
            }
        }