/// <summary>
 /// Parse the bidi response argument.
 /// </summary>
 /// <param name="responseArguments">The bidi response</param>
 /// <returns>A string that contains either the bidi response string or explains the invalid result.</returns>
 private string ParseResponse(PrinterQueueEventArgs responseArguments)
 {
     if (responseArguments.StatusHResult == (int)HRESULT.S_OK)
         return responseArguments.Response;
     else
         return InvalidHResult(responseArguments.StatusHResult);
 }
예제 #2
0
 /// <summary>
 /// This event handler is invoked when a Bidi response is raised.
 /// </summary>
 private async void OnBidiResponseReceived(object sender, PrinterQueueEventArgs responseArguments)
 {
     // Invoke the ink level event with appropriate data.
     // Dispatching this event invocation to the UI thread is required because in JavaScript,
     // events handlers need to be invoked on the UI thread.
     await dispatcher.RunAsync(
         Windows.UI.Core.CoreDispatcherPriority.Normal,
         () =>
     {
         OnInkLevelReceived(sender, ParseResponse(responseArguments));
     });
 }
        /// <summary>
        /// This is the method invoked when a bidi response is received.
        /// </summary>
        /// <param name="sender">IPrinterQueue object.</param>
        /// <param name="e">The results of the bidi response.</param>
        private void OnBidiResponseReceived(object sender, PrinterQueueEventArgs e)
        {
            if (e.StatusHResult != (int)HRESULT.S_OK)
            {
                MockInkStatus();
                return;
            }

            //
            // Display the ink levels from the mock data.
            //

            BidiHelperSource = new BidiHelper(e.Response);
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource"));
            }
            InkStatusTitle = "Ink status (Live data)";
        }