public void UnsubscribeAll()
        {
            if (_checkTimer != null)
            {
                _checkTimer.Enabled = false;
                _checkTimer.Stop();
                _checkTimer.Dispose();

                _checkTimer = null;
            }
            if (OTPChanged == null)
            {
                return;
            }
            foreach (Delegate d in OTPChanged.GetInvocationList())
            {
                OTPChanged -= (EventHandler <int>)d;
            }
        }
 private void _initTimer()
 {
     if (_checkTimer != null)
     {
         _checkTimer.Enabled = false;
         _checkTimer.Stop();
         _checkTimer.Dispose();
     }
     _checkTimer          = new System.Timers.Timer();
     _checkTimer.Interval = 1000;
     _checkTimer.Elapsed += (s, a) =>
     {
         int otp = Auth2FA.GenerateOTP(secret, interval, digits);
         if (otp != prev)
         {
             OTPChanged?.Invoke(this, otp);
             prev = otp;
         }
     };
     _checkTimer.Enabled = true;
 }