コード例 #1
0
 public AuditController(
     TokenProvisioningStorage tokenProvisioningStorage,
     OtpCodeStorage otpCodeStorage,
     CallbackStorage callbackStorage)
 {
     _tokenProvisioningStorage = tokenProvisioningStorage;
     _otpCodeStorage           = otpCodeStorage;
     _callbackStorage          = callbackStorage;
 }
コード例 #2
0
 public TokenController(
     ResponseSettingsStorage responseSettingsStorage,
     TokenProvisioningStorage tokenProvisioningStorage,
     OtpCodeStorage otpCodeStorage,
     CallbackStorage callbackStorage)
 {
     _responseSettingsStorage  = responseSettingsStorage;
     _tokenProvisioningStorage = tokenProvisioningStorage;
     _otpCodeStorage           = otpCodeStorage;
     _callbackStorage          = callbackStorage;
 }
コード例 #3
0
    // Triggers the job to run on the main thread, and waits for it to finish.
    public TResult Run <TResult>(System.Func <TResult> callback)
    {
        if (ManagesThisThread())
        {
            return(callback());
        }

        var waitHandle = new System.Threading.EventWaitHandle(
            false, System.Threading.EventResetMode.ManualReset);

        var result = new CallbackStorage <TResult>();

        lock (queue)
        {
            queue.Enqueue(() => {
                try
                {
                    result.Result = callback();
                }
                catch (System.Exception e)
                {
                    result.Exception = e;
                }
                finally
                {
                    waitHandle.Set();
                }
            });
        }
        waitHandle.WaitOne();
        if (result.Exception != null)
        {
            throw result.Exception;
        }
        return(result.Result);
    }