// Authentication loop job private void AuthenticateLoopJob(Object threadContext) { OnStartSession("Auth Loop"); try { ShowProgressTitle("Connecting.."); _authenticator.Connect(_serialConfig); var authArgs = new rsid.AuthArgs { hintClbk = OnAuthHint, statusClbk = OnAuthStatus, ctx = IntPtr.Zero }; ShowProgressTitle("Authenticating.."); _authloopRunning = true; ToggleLoopButton(true); _authenticator.AuthenticateLoop(authArgs); } catch (Exception ex) { try { _authenticator.Cancel(); //try to cancel the auth loop } catch { } ShowFailedStatus(ex.Message); } finally { ToggleLoopButton(false); OnStopSession(); _authloopRunning = false; _authenticator.Disconnect(); } }
// Authenticate job private void AuthenticateJob(Object threadContext) { OnStartSession("Authenticate"); try { ShowProgressTitle("Connecting.."); _authenticator.Connect(_serialConfig); var authArgs = new rsid.AuthArgs { hintClbk = OnAuthHint, statusClbk = OnAuthStatus, ctx = IntPtr.Zero }; ShowProgressTitle("Authenticating.."); _authenticator.Authenticate(authArgs); } catch (Exception ex) { ShowFailedStatus(ex.Message); } finally { OnStopSession(); _authenticator.Disconnect(); } }