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 <CashDrawer> GetFirstCashDrawerAsync(PosConnectionTypes connectionTypes = PosConnectionTypes.All) { return(await DeviceHelpers.GetFirstDeviceAsync(CashDrawer.GetDeviceSelector(connectionTypes), async (id) => await CashDrawer.FromIdAsync(id))); }