Esempio n. 1
0
        //Start searching for printers
        private void StartBluetoothDiscovery()
        {
            IDiscoveryEventHandler bthandler = DiscoveryHandlerFactory.Current.GetInstance();

            bthandler.OnDiscoveryError    += DiscoverError;
            bthandler.OnDiscoveryFinished += DiscoveryFinished;
            bthandler.OnFoundPrinter      += DiscoveryHandler_OnFoundPrinter;
            IPrinterDiscovery ip = new PrinterDiscovery();

            ip.FindBluetoothPrinters(bthandler, this);
            BluetoothDiscoverer.Current.FindPrinters(Android.App.Application.Context, bthandler);
            // DependencyService.Get<IPrinterDiscovery>().FindBluetoothPrinters(bthandler);
        }
Esempio n. 2
0
 private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
 {
     try
     {
         IPrinterDiscovery ip = new PrinterDiscovery();
         ip.CancelDiscovery();
         //Object type for printers returned are DiscoveredPrinters, theres an additional type that says USB but is not the target of this project
         //We assign now the printer selected from the list.
         ChoosenPrinter = printers[e.Position] as IDiscoveredPrinter;
         Toast.MakeText(this, "Printer Selected", ToastLength.Long).Show();
     }
     catch (Exception ex)
     { }
 }