//</SnippetSetupBarcodeScanner>


        /// <summary>
        /// Event handler for the Release Device Requested event fired when barcode scanner receives Claim request from another application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"> Contains the ClaimedBarcodeScanner that is sending this request</param>
        //<SnippetReleaseDeviceRequested>
        async void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                e.RetainDevice();
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Event handler for the Release Device Requested event fired when barcode scanner receives Claim request from another application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"> Contains the ClamiedBarcodeScanner that is sending this request</param>
        void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            // always retain the device
            e.RetainDevice();

            rootPage.NotifyUser("Event ReleaseDeviceRequested received. Retaining the barcode scanner.", NotifyType.StatusMessage);
        }
Esempio n. 3
0
        /// <summary>
        /// This method is called upon when a claim request is made on instance 2. If a retain request was placed on the device it rejects the new claim.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        async void claimedBarcodeScannerInstance2_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            await MainPage.Current.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                () =>
            {
                //check if the instance wants to retain the device
                if (Retain2.IsChecked == true)
                {
                    try
                    {
                        //Retain the device
                        claimedBarcodeScannerInstance2.RetainDevice();
                    }
                    catch (Exception exception)
                    {
                        rootPage.NotifyUser("Retain instance 1 failed: " + exception.Message, NotifyType.ErrorMessage);
                    }
                }
                //Release the device
                else
                {
                    claimedBarcodeScannerInstance2.Dispose();
                    claimedBarcodeScannerInstance2 = null;

                    if (barcodeScannerInstance2 != null)
                    {
                        barcodeScannerInstance2.Dispose();
                        barcodeScannerInstance2 = null;
                    }
                }
            }
                );
        }
Esempio n. 4
0
 /// <summary>
 /// This method is called upon when a claim request is made on instance 2. If a retain request was placed on the device it rejects the new claim.
 /// </summary>
 /// <param name="instance"></param>
 /// <returns></returns>
 async void claimedBarcodeScannerInstance2_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
 {
     await MainPage.Current.Dispatcher.RunAsync(
         Windows.UI.Core.CoreDispatcherPriority.Normal,
         () =>
     {
         UpdateOutput(String.Format("\nReleaseDeviceRequested ({0})", claimedBarcodeScannerInstance2.DeviceId));
         //check if the instance wants to retain the device
         if (Retain2.IsChecked == true)
         {
             try
             {
                 //Retain the device
                 claimedBarcodeScannerInstance2.RetainDevice();
                 UpdateOutput(String.Format("\t(Scanner Retained)"));
             }
             catch (Exception exception)
             {
                 UpdateOutput(String.Format("\t(retain failed) ({0})", exception.ToString()));
             }
         }
         //Release the device
         else
         {
             claimedBarcodeScannerInstance2.Dispose();
             claimedBarcodeScannerInstance2 = null;
             UpdateOutput("Scanner Released.");
         }
     }
         );
 }
Esempio n. 5
0
        /// <summary>
        /// Event handler for the Release Device Requested event fired when barcode scanner receives Claim request from another application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"> Contains the ClamiedBarcodeScanner that is sending this request</param>
        async void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                // alsways retain the device
                e.RetainDevice();

                UpdateOutput("Event ReleaseDeviceRequest received. Retaining the Barcode Scanner.");
            });
        }
        /// <summary>
        /// Event handler for the Release Device Requested event fired when barcode scanner receives Claim request from another application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"> Contains the ClamiedBarcodeScanner that is sending this request</param>
        async void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                // always retain the device
                e.RetainDevice();

                rootPage.NotifyUser("Event ReleaseDeviceRequested received. Retaining the barcode scanner.", NotifyType.StatusMessage);
            });
        }
Esempio n. 7
0
        async void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            await CoreApplication.GetCurrentView().CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                // always retain the device
                e.RetainDevice();

                Debug.WriteLine("Event ReleaseDeviceRequested received. Retaining the barcode scanner.");
            });
        }
        /// <summary>
        /// Event handler for the Release Device Requested event fired when barcode scanner receives Claim request from another application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"> Contains the ClamiedBarcodeScanner that is sending this request</param>
        async void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            // always retain the device
            e.RetainDevice();

            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                rootPage.NotifyUser("Event ReleaseDeviceRequested received. Retaining the barcode scanner.", NotifyType.StatusMessage);
            });
        }
Esempio n. 9
0
 private void ClaimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
 {
     UpdateMessage("Another process is requesting barcode scanner device.");
     e.RetainDevice(); 
 }
Esempio n. 10
0
 void claimedBarcodeScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
 {
     e.RetainDevice();  // Retain exclusive access to the device
 }
Esempio n. 11
0
        /// <summary>
        /// Event handler for the Release Device Requested event fired when barcode scanner receives Claim request from another application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"> Contains the ClamiedBarcodeScanner that is sending this request</param>
        async void claimedScanner_ReleaseDeviceRequested(object sender, ClaimedBarcodeScanner e)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                // alsways retain the device
                e.RetainDevice();

                UpdateOutput("Event ReleaseDeviceRequest received. Retaining the Barcode Scanner.");
            }); 
        }
 private void WhenScannerReleaseDeviceRequested(object sender, ClaimedBarcodeScanner args)
 {
     args.RetainDevice();
 }