コード例 #1
0
        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);
        }
コード例 #2
0
 public LedgerManager(IHandlesRequest ledgerManagerTransport, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt)
 {
     ErrorPrompt    = errorPrompt;
     RequestHandler = ledgerManagerTransport;
     CoinUtility    = coinUtility ?? new DefaultCoinUtility();
     SetCoinNumber(0);
 }
コード例 #3
0
 public LedgerManagerBroker(int?pollInterval, ICoinUtility coinUtility, ErrorPromptDelegate errorPromptDelegate, ILedgerManagerFactory ledgerManagerFactory)
 {
     CoinUtility          = coinUtility;
     PollInterval         = pollInterval;
     ErrorPromptDelegate  = errorPromptDelegate;
     LedgerManagerFactory = ledgerManagerFactory;
 }
コード例 #4
0
        public LedgerManager(IDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt)
        {
            ErrorPrompt = errorPrompt;

            LedgerHidDevice = ledgerHidDevice;

            CoinUtility = coinUtility ?? new DefaultCoinUtility();

            SetCoinNumber(0);
        }
コード例 #5
0
        public LedgerManager(IHidDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt)
        {
            ErrorPrompt = errorPrompt;

            LedgerHidDevice = ledgerHidDevice;
            CoinUtility     = coinUtility;

            if (CoinUtility == null)
            {
                CoinUtility = new DefaultCoinUtility();
            }

            SetCoinNumber(0);
        }
コード例 #6
0
 public IManagesLedger GetNewLedgerManager(IDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt)
 {
     return(new LedgerManager(MockLedgerManagerTransport, null, _PromptDelegate));
 }
コード例 #7
0
 public MockLedgerManagerFactory(ErrorPromptDelegate promptDelegate)
 {
     _PromptDelegate = promptDelegate;
 }
コード例 #8
0
 public IManagesLedger GetNewLedgerManager(IDevice ledgerHidDevice, ICoinUtility coinUtility, ErrorPromptDelegate errorPrompt)
 {
     return(new LedgerManager(new LedgerManagerTransport(ledgerHidDevice), coinUtility, errorPrompt));
 }
コード例 #9
0
        private async Task GetLedgerBase(ErrorPromptDelegate errorPrompt = null)
        {
            var ledgerManagerBroker = new LedgerManagerBroker(3000, null, Prompt);

            _LedgerManager = await ledgerManagerBroker.WaitForFirstDeviceAsync();
        }
コード例 #10
0
 protected static void StartBroker(ErrorPromptDelegate errorPrompt, ILedgerManagerFactory ledgerManagerFactory)
 {
     _LedgerManagerBroker = new LedgerManagerBroker(3000, null, Prompt, ledgerManagerFactory);
     _LedgerManagerBroker.Start();
 }
コード例 #11
0
 public LedgerManagerBroker(int?pollInterval, ICoinUtility coinUtility, ErrorPromptDelegate errorPromptDelegate)
 {
     CoinUtility         = coinUtility;
     PollInterval        = pollInterval;
     ErrorPromptDelegate = errorPromptDelegate;
 }