private void PrinterLv_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            DependencyService.Get <IPrinterDiscovery>().CancelDiscovery();
            if (e.SelectedItem is IDiscoveredPrinterUsb)
            {
                if (!((IDiscoveredPrinterUsb)e.SelectedItem).HasPermissionToCommunicate)
                {
                    DependencyService.Get <IPrinterDiscovery>().RequestUsbPermission(((IDiscoveredPrinterUsb)e.SelectedItem));
                }
            }

            OnPrinterSelected?.Invoke((IDiscoveredPrinter)e.SelectedItem);
            mainPage.PopAsync();
        }
Exemplo n.º 2
0
        void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
        {
            DependencyService.Get <IPrinterDiscovery>().CancelDiscovery();
            if (e.SelectedItem is IDiscoveredPrinterUsb)
            {
                if (!((IDiscoveredPrinterUsb)e.SelectedItem).HasPermissionToCommunicate)
                {
                    DependencyService.Get <IPrinterDiscovery>().RequestUsbPermission(((IDiscoveredPrinterUsb)e.SelectedItem));
                }
            }

            OnPrinterSelected?.Invoke((IDiscoveredPrinter)e.SelectedItem);

            App.myPrinter = (IDiscoveredPrinter)e.SelectedItem;


            Navigation.PopAsync();
        }