private async Task GetLedger(ErrorPromptDelegate errorPrompt = null) { var devices = new List <DeviceInformation>(); var collection = WindowsHidDevice.GetConnectedDeviceInformations(); foreach (var ids in WellKnownLedgerWallets) { if (ids.ProductId == null) { devices.AddRange(collection.Where(c => c.VendorId == ids.VendorId)); } else { devices.AddRange(collection.Where(c => c.VendorId == ids.VendorId && c.ProductId == ids.ProductId)); } } var retVal = devices .FirstOrDefault(d => _UsageSpecification == null || _UsageSpecification.Length == 0 || _UsageSpecification.Any(u => d.UsagePage == u.UsagePage && d.Usage == u.Usage)); var ledgerHidDevice = new WindowsHidDevice(retVal); await ledgerHidDevice.InitializeAsync(); _LedgerManager = new LedgerManager(ledgerHidDevice, null, Prompt); }
public LedgerManager(IHandlesRequest ledgerManagerTransport, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt) { ErrorPrompt = errorPrompt; RequestHandler = ledgerManagerTransport; CoinUtility = coinUtility ?? new DefaultCoinUtility(); SetCoinNumber(0); }
public LedgerManagerBroker(int?pollInterval, ICoinUtility coinUtility, ErrorPromptDelegate errorPromptDelegate, ILedgerManagerFactory ledgerManagerFactory) { CoinUtility = coinUtility; PollInterval = pollInterval; ErrorPromptDelegate = errorPromptDelegate; LedgerManagerFactory = ledgerManagerFactory; }
public LedgerManager(IDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt) { ErrorPrompt = errorPrompt; LedgerHidDevice = ledgerHidDevice; CoinUtility = coinUtility ?? new DefaultCoinUtility(); SetCoinNumber(0); }
public LedgerManager(IHidDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt) { ErrorPrompt = errorPrompt; LedgerHidDevice = ledgerHidDevice; CoinUtility = coinUtility; if (CoinUtility == null) { CoinUtility = new DefaultCoinUtility(); } SetCoinNumber(0); }
public IManagesLedger GetNewLedgerManager(IDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt) { return(new LedgerManager(MockLedgerManagerTransport, null, _PromptDelegate)); }
public MockLedgerManagerFactory(ErrorPromptDelegate promptDelegate) { _PromptDelegate = promptDelegate; }
public IManagesLedger GetNewLedgerManager(IDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt) { return(new LedgerManager(new LedgerManagerTransport(ledgerHidDevice), coinUtility, errorPrompt)); }
private async Task GetLedgerBase(ErrorPromptDelegate errorPrompt = null) { var ledgerManagerBroker = new LedgerManagerBroker(3000, null, Prompt); _LedgerManager = await ledgerManagerBroker.WaitForFirstDeviceAsync(); }
protected static void StartBroker(ErrorPromptDelegate errorPrompt, ILedgerManagerFactory ledgerManagerFactory) { _LedgerManagerBroker = new LedgerManagerBroker(3000, null, Prompt, ledgerManagerFactory); _LedgerManagerBroker.Start(); }
public LedgerManagerBroker(int?pollInterval, ICoinUtility coinUtility, ErrorPromptDelegate errorPromptDelegate) { CoinUtility = coinUtility; PollInterval = pollInterval; ErrorPromptDelegate = errorPromptDelegate; }