async Task <bool> CreateDeviceList_OneTime(Type[] deviceClasses) { foreach (Type ty in deviceClasses) { DeviceInformationCollection deviceList = null; if (ty == typeof(BarcodeScanner)) { deviceList = await DeviceInformation.FindAllAsync(BarcodeScanner.GetDeviceSelector()); } else if (ty == typeof(PosPrinter)) { deviceList = await DeviceInformation.FindAllAsync(PosPrinter.GetDeviceSelector()); } else if (ty == typeof(CashDrawer)) { deviceList = await DeviceInformation.FindAllAsync(CashDrawer.GetDeviceSelector()); } else if (ty == typeof(MagneticStripeReader)) { deviceList = await DeviceInformation.FindAllAsync(MagneticStripeReader.GetDeviceSelector()); } else if (ty == typeof(LineDisplay)) { deviceList = await DeviceInformation.FindAllAsync(LineDisplay.GetDeviceSelector()); } AddToSelectionList(ty, deviceList); } return(true); }
private static string GetPosSelector(Type ty) { if (ty == typeof(BarcodeScanner)) { return(BarcodeScanner.GetDeviceSelector()); } if (ty == typeof(PosPrinter)) { return(PosPrinter.GetDeviceSelector()); } if (ty == typeof(CashDrawer)) { return(CashDrawer.GetDeviceSelector()); } if (ty == typeof(MagneticStripeReader)) { return(MagneticStripeReader.GetDeviceSelector()); } if (ty == typeof(LineDisplay)) { return(LineDisplay.GetDeviceSelector()); } return(null); }
// By default, use all connections types. public static async Task <MagneticStripeReader> GetFirstMagneticStripeReaderAsync(PosConnectionTypes connectionTypes = PosConnectionTypes.All) { return(await DeviceHelpers.GetFirstDeviceAsync(MagneticStripeReader.GetDeviceSelector(connectionTypes), async (id) => await MagneticStripeReader.FromIdAsync(id))); }
public static async Task <MagneticStripeReader> GetFirstMagneticStripeReaderAsync() { return(await DeviceHelpers.GetFirstDeviceAsync(MagneticStripeReader.GetDeviceSelector(), async (id) => await MagneticStripeReader.FromIdAsync(id))); }