public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll,
                                   ref bool noToAll)
        {
            // if we are on the original thread, just call straight thru.
            if (_originalThread == Thread.CurrentThread)
            {
                return(_originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll,
                                                              ref noToAll));
            }

            CheckForInteractive();

            // otherwise, queue up the request and wait for the main thread to do the right thing.
            try
            {
                // wait for our turn to talk to the main thread
                WaitOurTurn();

                var yta    = yesToAll;
                var nta    = noToAll;
                var result = false;

                // set the function to run
                _runOnMainThread                   = () =>
                                            result = _originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta,
                                                                                            ref nta);

                // tell the main thread to go ahead
                _readyToRun.Set();

                // wait for the result (or cancellation!)
                WaitForCompletion();

                // set the output variables
                yesToAll = yta;
                noToAll  = nta;
                return(result);
            }
            catch (OperationCanceledException exception)
            {
                // maybe don't even worry?
                throw exception;
            }
        }