Example #1
0
 private static WalletLocker GetLocker(Wallet wallet)
 {
     if (singleton == null || singleton.wallet != wallet)
     {
         singleton = new WalletLocker(wallet);
     }
     return(singleton);
 }
Example #2
0
        public static void Unlock(Wallet wallet, string password, uint second)
        {
            WalletLocker locker = GetLocker(wallet);

            if (locker.timer == null)
            {
                locker.unlockTime = DateTime.Now;
                locker.duration   = second;
                locker.timer      = new Timer(new TimerCallback(Lock), null, 1000 * second, -1);
            }
            else
            {
                if (DateTime.Now.AddSeconds(second) > locker.unlockTime.AddSeconds(locker.duration))
                {
                    locker.unlockTime = DateTime.Now;
                    locker.duration   = second;
                    locker.timer.Change(1000 * second, -1);
                }
            }
            wallet.Unlock(password);
            locker.locked = false;
        }
Example #3
0
 public static void Reset()
 {
     singleton = null;
 }
Example #4
0
File: Wallet.cs Project: txhsl/neo
 public void Unlock(string password, uint second)
 {
     WalletLocker.Unlock(this, password, second);
 }