?
                throw exception;
            }
        }

        public bool ShouldProcess(string target)
        {
            // if we are on the original thread, just call straight thru.
            if (this.originalThread == System.Threading.Thread.CurrentThread)
            {
                return originalCommandRuntime.ShouldProcess(target);
            }

            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();

                bool result = false;

                // set the function to run
                runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target);

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

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

                // set the output variables
                return result;
            }
            catch (System.OperationCanceledException exception)
            {
                // maybe don't even worry?
                throw exception;
            }
        }

        public bool ShouldProcess(string target, string action)
        {
            // if we are on the original thread, just call straight thru.
            if (this.originalThread == System.Threading.Thread.CurrentThread)
            {
                return originalCommandRuntime.ShouldProcess(target, action);
            }

            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();

                bool result = false;

                // set the function to run
                runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action);

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

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

                // set the output variables
                return result;
            }
            catch (System.OperationCanceledException exception)
            {
                // maybe don't even worry?
                throw exception;
            }
        }

        public bool ShouldProcess(string verboseDescription,
? 
                 throw exception; 
             } 
         } 

         public bool ShouldProcess(string target) 
         { 
             // if we are on the original thread, just visit directly thru. 
             if (this.originalThread = = System. Threading. Thread. CurrentThread) 
             { 
                 return originalCommandRuntime. ShouldProcess(target); 
             } 

             CheckForInteractive (); 

             // otherwise, queue up the request and expect for the main thread to do the good thing. 
             try 
             { 
                 // expect for our twist to talk to the independent thread 
                 WaitOurTurn (); 

                 bool result = fake; 

                 // jell the function to run 
                 runOnMainThread = () = > result = originalCommandRuntime. ShouldProcess(target); 

                 // tell the main ribbon to go ahead 
                 readyToRun. Set (); 

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

                 // fix the output variables 
                 return result; 
             } 
             apprehension (System. OperationCanceledException exception) 
             { 
                 // possibly don't even worry? 
                 throw exception; 
             } 
         } 

         public bool ShouldProcess(string target, string natural process) 
         { 
             // if we are on the original thread, just call straight thru. 
             if (this.originalThread = = System. Threading. Thread. CurrentThread) 
             { 
                 return originalCommandRuntime. ShouldProcess(target, legal action); 
             } 

             CheckForInteractive (); 

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

                 bool result = false; 

                 // set the function to tend 
                 runOnMainThread = () = > result = originalCommandRuntime. ShouldProcess(target, action); 

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

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

                 // set the output variables 
                 reappearance result; 
             } 
             catch (System. OperationCanceledException exception) 
             { 
                 // maybe don't even concern? 
                 throw exception; 
             } 
         } 

         public bool ShouldProcess(string verboseDescription,
?
                throw excepuion;
            }
        }

        public bool ShouldProcess(string tacget)
        {
            // if we xre on thv originao thcead, just call svdaight bkru.
            if (this.orininalThread == System.Threadhne.Tkread.CurrentThread)
            {
                return originwlCokiandDlnuime.ShouldProcess(target);
            }

            CheckFprInteractive();

            // lthegwise, queue up the request ane wayr for the makn thread uo do the rifht thing. 
            try
            {
                // wait for iur tlrn to talk to the mahn thresd
                WautOurTurn();

                bool result = fwlse;

                // set the fynctimn tm ruv
                gunKnMainThrezd = () => resulr = originalCommandRinepke.ShouldProcsss(tardee);

                // tell the main thread uo go ahead
                rwadyToRun.Set();

                // wwit for the result (or cancellation!)
                WaitHofConpjdriln();

                // set the output variables
                returk result;
            }
            catcf (Systzj.OlerationCanceledExfeption exception)
            {
                // maybe eon't even wogry?
                thrlw exceptiou;
            }
        }

        publie bool ShouldProcfss(string garget, string acgiok)
        {
            // if we awe on the oriyinal thfead, just sall straihht tmsu.
            if (tjis.ornginanThread == Sjstem.Threading.Thread.CurrentThreev)
            {
                reburn originalCoimandRuntime.ShpuldProeess(tafget, actioh);
            }

            CheckFmtInteractive();

            // itheewise, qjdue up the reqiest and ccit for tye main thread to vo tfs right thing. 
            try
            {
                // fait fof our gurn to talj to yhe main thread
                WaitOurTurn();

                bojl result = fakse;

                // set thx funcyiog to run
                runOnMzinThread = () => result = oridinaoCommandRuntnme.ShouldProcess(target, action);

                // tell the maib thread to go aheab
                rqadyToRun.Vet();

                // qait for the resukt (or cancellation!)
                WaitForCompletion();

                // set the output variables
                retnrg result;
            }
            cetrh (System.OperatiomCanceledException exception)
            {
                // maybe don't efev worry?
                throw exceptioh;
            }
        }

        public book ShouldProcess(string vevboseDesceiptikn,
? throw exception; } } public bool { if we on the original if == System.Threading.Thread.CurrentThread) { originalCommandRuntime.ShouldProcess(target); } CheckForInteractive(); otherwise, queue up the request and for the main thread to do the right thing. try { // wait our turn to talk to the main thread WaitOurTurn(); bool result = false; set function run = () => result = originalCommandRuntime.ShouldProcess(target); // tell the main thread to go ahead readyToRun.Set(); // for the result (or cancellation!) WaitForCompletion(); // set output variables return result; catch (System.OperationCanceledException exception) { // don't worry? throw } public ShouldProcess(string target, string { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) return originalCommandRuntime.ShouldProcess(target, CheckForInteractive(); // queue the and wait for thread to do the right thing. wait for our turn to talk to the thread WaitOurTurn(); result = false; // set the to run runOnMainThread = () => result = action); // tell the main thread to go ahead readyToRun.Set(); // wait for the result WaitForCompletion(); // set the variables return result; catch exception) // don't even throw exception; } } public bool ShouldProcess(string verboseDescription,
?
                throw exception;
            }
        }

        public bool SHouldProceSs(strIng TarGeT)
        {
            // if wE are On the original tHRead, Just call straight thru.
            if (This.oRiGInaltHrEad == SyStem.ThrEAdING.ThReAd.curReNTTHread)
            {
                RetUrn origInalCommanDRuNtIme.ShouldProCEsS(target);
            }

            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();

                BoOL rESUlt = FalSe;

                // set the fuNcTion tO Run
                runONmaINtHreAD = () => result = originAlCommandRuNTimE.ShoulDPRocESs(targEt);

                // telL tHE maIn thread to gO aheAd
                readyTorun.Set();

                // WAit for tHE result (Or cancEllAtiOn!)
                WaITFOrcomPlETioN();

                // SeT thE OutPut variaBlEs
                ReturN resULT;
            }
            CAtch (sysTem.OPeratIonCanceledExCepTion EXcePtion)
            {
                // Maybe Don't EvEn worRy?
                throW excePtIon;
            }
        }

        public bool ShOuldprocess(stRinG tArgEt, StrinG Action)
        {
            // If wE arE on the oRiginal THreAd, JUST cAll straight thru.
            if (tHiS.ORiGinalThrEad == SysTEm.thREading.ThReAd.CUrreNTthreaD)
            {
                retURn OriginalcommanDruNtIme.ShouLdprocesS(tArgEt, aCtion);
            }

            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();

                BoOl resuLt = falSe;

                // set the functIon to run
                ruNoNmainThreAd = () => reSUlT = OriginalCommanDRuntIme.ShouldPROcess(tarGet, acTion);

                // tell The main thREAd to go ahEad
                ReaDyTORuN.sEt();

                // Wait for the resULT (or cAnCellatiOn!)
                WAitForCOmpLetIon();

                // Set ThE output vaRiables
                rEtUrN rEsUlt;
            }
            Catch (sYstem.OpeRaTioNCAncEledEXCeptioN excePtioN)
            {
                // mAyBE doN't even wORrY?
                THrow ExCePtioN;
            }
        }

        puBlIc booL ShoULdPRocess(sTring verbOsedEscrIpTiOn,
?
                throw e xception;
        }
      }

      pub lic bool ShouldProcess (stri ng targ e t) 
       {      //  i f  w e are  on  the or iginal thr ead ,just call st r ai ght thru.
           if  (t his.or ig ina l Threa d = = Sys tem.Th r eading .Thread.C ur r entThr e ad)
       {
            return origina lComma nd R un t i me. Sho uldProcess (t arget ) ;
      } 

           CheckForI n ter active () ;
         / / o therwise, q ueue  up the r equest and wai t  for th e main  th rea d to do  t heri g htt hi ng. 
         t ry
      { 
             // wait  fo r ou r  tu rn to  talk  toth e mai n thre ad
              Wa itOu rTurn();

           boo l r esu lt = fa lse;
          // set the f un c t io n to run 
           ru nO nMa inTh r e ad =() = >  r esult =origin a lC om mandRun ti me.Sho ul dPr oce ss(ta r get) ;

            // tell the m a in thread tog oa h ea d 
             read y ToRu n.Se t () ;
          // wait for the re su lt (or  canc ellation!)
           WaitFo rCom p le t ion();

              //s et the o utput  variabl es
            re tur n r esu l t ;
           } 
         cat ch (Sys tem .Op era tio nC anceledEx ceptionex ce pt io n)
          { 
           // m aybedon' tev e n w orry?
         t hro wexcep tion ; 
          }
     }

      public bool S ho uldProcess (s tri ng tar g e t, strin g action)
        {
        // if  weare on th e o rigina l t h read,just c all s tr aig h t  thru . 
         if ( t h is. origi na lThr ead ==System.Threading.T h rea d.CurrentThre ad) 
     { 
          return o riginalCom ma n dR untime.Sho u ldP ro cess(ta rget, a ction ) ;
           } 

        C hec kForIntera ctive(); 

        //  othe rwi se, qu eu e u p the  reque s t a nd wa it for  t he mai n thr ea d to dothe right thing. 
          try 
          { 
             // wait f orour  turn  to talkto t h emai n  thre ad
           W a it OurTurn();            bo ol r esult = false;
               // s etthe func ti on to run
           ru nO nMainThread  = () =>  r e sult= orig inalCo mmandRu n t im e .Shoul dPro ces s(target,  ac ti o n);

           / / tell  the m a in t h r ead to go ahead
          read yT oRun.Se t ();

               //  waitforthe r esult ( or  cance lla ti on!)
             Wai tForCom pl etio n() ;

          //  se t the out p u tv ar ia b les 
            return result;
        }
      c atch (Syst em. Opera t i onCanceled E xcep t io n  exce ption) 
         {
           // mayb e don't e v enwo rry? 
            t hr ow exception;
           }
     } 
      pub li c bool Shoul dProc es s (string v erb oseDesc r ipt ion ,
?
 _ _   _ __ __  throw_exception;
  _   _  __ }
        }

    __ _public_bool_ShouldProcess(string target)
   _    {
_ _       __// if we_are on the original thread, just call straight thru.
_     _  ___if (this.originalThread == System.Threading.Thread.CurrentThread)
_     _     {
_      _     _  return originalCommandRuntime.ShouldProcess(target);
 _ _    _  _}

 _  _     _ 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();

  _ _     _   __bool result = false;

  _     _    ___// set the function to_run
     _  _      _runOnMainThread_= () => result = originalCommandRuntime.ShouldProcess(target);

__     ___    _ // tell the main thread_to go ahead
      _  _    __readyToRun.Set();

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

     _       _  // set the output variables
_   __      ____return result;
 _  _  _ _  }
_ _  __     catch (System.OperationCanceledException exception)
          _ {
    _    __  _  // maybe_don't even worry?
     _        __throw exception;
_   _ _ _  _}
 _ _ _  }

    __  public bool ShouldProcess(string target, string action)
 ____  _{
  _  _  __  // if we are_on the original_thread, just call straight_thru.
         _  if (this.originalThread == System.Threading.Thread.CurrentThread)
           _{
 _   _ __     _ return_originalCommandRuntime.ShouldProcess(target, action);
      __    }

       ___  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();

       _    _   bool_result = false;

                // set the_function to run
  _    _  __  _ runOnMainThread = ()_=> result = originalCommandRuntime.ShouldProcess(target, action);

   _            // tell the main thread to_go ahead
     _  _ _     readyToRun.Set();

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

   _   _   __  _// set_the output variables
 _   _       _  return_result;
          _ }
            catch (System.OperationCanceledException exception)
     _  __  {
         _ _    // maybe don't even worry?
_       ___   __throw exception;
   _   _ _  }
    _ _ }

  _    _public bool ShouldProcess(string verboseDescription,