private static WalletLocker GetLocker(Wallet wallet) { if (singleton == null || singleton.wallet != wallet) { singleton = new WalletLocker(wallet); } return(singleton); }
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; }
public static void Reset() { singleton = null; }
public void Unlock(string password, uint second) { WalletLocker.Unlock(this, password, second); }