示例#1
0
        private void OpenAsync(string address, string password, TimeSpan?timeoutToClose)
        {
            ECKeyPair kp = ReadKeyPairAsync(address, password);

            OpenAccount acc = new OpenAccount();

            acc.KeyPair = kp;

            if (timeoutToClose.HasValue)
            {
                Timer t = new Timer(CloseAccount, acc, timeoutToClose.Value, timeoutToClose.Value);
                acc.CloseTimer = t;
            }

            _openAccounts.Add(acc);
        }
示例#2
0
        private async Task OpenAsync(string address, string password, TimeSpan?timeoutToClose)
        {
            var keyPair = await ReadKeyPairAsync(address, password);

            var openAccount = new OpenAccount(address)
            {
                KeyPair = keyPair
            };

            if (timeoutToClose.HasValue)
            {
                var t = new Timer(CloseAccount, openAccount, timeoutToClose.Value, timeoutToClose.Value);
                openAccount.CloseTimer = t;
            }

            _openAccounts.Add(openAccount);
        }