BackgroundWorker and Nunit

Keith Woods <[email protected]> Wed, 24 Sep 2008 02:22:28 -0700 (PDT)
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
--===============2734883345666413468==
Content-Type: multipart/alternative; boundary="0-918804661-1222248148=:52616"

--0-918804661-1222248148=:52616
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Everyone=0A =0AI=E2=80=99ve been=0Atrying to test some code that uses a =
background worker. The issues I=E2=80=99m having=0Ais that my test appears =
to NOT report progress on the same thread that created=0Athe background wor=
ker. For tests that involve Dependency objects (WPF) the call=0Aback needs =
to happen on the same thread.=0A =0AI have a=0Asample application using Bac=
kgroundWorker (this is below) for one test and=0ASynchronizationContext for=
 another, both are reporting back onto another=0Athread, not the correct on=
e.  =0A =0AUsing nunit=0AGUI I=E2=80=99ve explicitly set the test to run in=
 the STA ApartmentState.=0AUsing nunit=0Aconsole I=E2=80=99ve specified /no=
thread flag=0A =0ANothings=0Aappears to be working. I=E2=80=99m either misu=
nderstanding the functionality provided=0Aby BackgroundWorker/Synchronizati=
onContext, incorrectly using nunit, or it=E2=80=99s a=0Abug in nunit.=0A =
=0AAny help=0Awould be much appreciated, =0A =0ACheers=0A =0AKeith=0A =0Ap.=
s. Here=0Ais the test with the background worker:=0A =0AusingSystem;=0Ausin=
gSystem.Collections.Generic;=0AusingSystem.Linq;=0AusingSystem.Text;=0Ausin=
gNUnit.Core;=0AusingNUnit.Framework;=0AusingSystem.Threading;=0A =0Anamespa=
ceNunitBackgroundWorker=0A{=0A    [TestFixture]=0A    public class Backgrou=
ndTester=0A    {=0A        [Test]=0A        public void TestBackgroundWorke=
r()=0A        {=0A            new Background().RunBackgroundWorker();=0A =
=0A            Thread.Sleep(5000);=0A =0A            Console.WriteLine();=
=0A        }=0A}=0A =0AusingSystem;=0AusingSystem.Collections.Generic;=0Aus=
ingSystem.Linq;=0AusingSystem.Text;=0AusingSystem.ComponentModel;=0AusingSy=
stem.Reflection;=0AusingSystem.Threading;=0AusingSystem.Windows.Threading;=
=0A =0AnamespaceNunitBackgroundWorker=0A{=0A    public class Background=0A =
   {=0A        private BackgroundWorker _worker =3D null;=0A =0A        pub=
lic Background()=0A        {=0A            Console.WriteLine("ctor=0A" + Me=
thodInfo.GetCurrentMethod().Name);=0A =0A           =0AInitializeBackgoundW=
orker();=0A        }=0A =0A        private void InitializeBackgoundWorker()=
=0A        {=0A            int dispatcherHash =3D Dispatcher.CurrentDispatc=
her.Thread.GetHashCode();=0A            bool isBackGround =3D Dispatcher.Cu=
rrentDispatcher.Thread.IsBackground;=0A            int id =3D Dispatcher.Cu=
rrentDispatcher.Thread.ManagedThreadId;=0A            ApartmentState thread=
_state =3D Dispatcher.CurrentDispatcher.Thread.GetApartmentState();=0A     =
       Console.WriteLine(MethodInfo.GetCurrentMethod().Name);=0A           =
 Console.WriteLine("    =0ADispatcherHash:{0}, IsBackground:{1}, Id:{2}, Th=
readState:{3}",=0AdispatcherHash, isBackGround, id, thread_state);=0A =0A  =
         =0A_worker =3D new BackgroundWorker();=0A           =0A_worker.DoW=
ork +=3D new DoWorkEventHandler(ProcessPhotosWorker_DoWork);=0A           =
=0A_worker.RunWorkerCompleted +=3D new RunWorkerCompletedEventHandler(Proce=
ssPhotosWorker_RunWorkerCompleted);=0A        =0A   _worker.ProgressChanged=
 +=3D new ProgressChangedEventHandler(ProcessPhotosWorker_ProgressChanged);=
=0A           =0A_worker.WorkerReportsProgress =3D true;=0A        }=0A =0A=
        void ProcessPhotosWorker_ProgressChanged(object sender, ProgressCha=
ngedEventArgs e)=0A        {=0A            int dispatcherHash =3D Dispatche=
r.CurrentDispatcher.Thread.GetHashCode();=0A            bool isBackGround =
=3D Dispatcher.CurrentDispatcher.Thread.IsBackground;=0A            int id =
=3D Dispatcher.CurrentDispatcher.Thread.ManagedThreadId;=0A     =0A      Ap=
artmentState thread_state =3D Dispatcher.CurrentDispatcher.Thread.GetApartm=
entState();=0A            Console.WriteLine(MethodInfo.GetCurrentMethod().N=
ame=0A+ e.UserState.ToString());=0A            Console.WriteLine("    =0ADi=
spatcherHash:{0}, IsBackground:{1}, Id:{2}, ThreadState:{3}",=0AdispatcherH=
ash, isBackGround, id, thread_state);=0A        }=0A =0A        private voi=
d ProcessPhotosWorker_DoWork(object sender, DoWorkEventArgs e)=0A        {=
=0A            int dispatcherHash =3D Dispatcher.CurrentDispatcher.Thread.G=
etHashCode();=0A            bool isBackGround =3D Dispatcher.CurrentDispatc=
her.Thread.IsBackground;=0A            int id =3D Dispatcher.CurrentDispatc=
her.Thread.ManagedThreadId;=0A            ApartmentState thread_state =3D D=
ispatcher.CurrentDispatcher.Thread.GetApartmentState();=0A            Conso=
le.WriteLine(MethodInfo.GetCurrentMethod().Name);=0A            Console.Wri=
teLine("    =0ADispatcherHash:{0}, IsBackground:{1}, Id:{2}, ThreadState:{3=
}",=0AdispatcherHash, isBackGround, id, thread_state);=0A =0A           =0A=
_worker.ReportProgress(25, "25%done");=0A            Thread.Sleep(1000);=0A=
           =0A_worker.ReportProgress(50, "50%done");=0A            Thread.S=
leep(1000);=0A           =0A_worker.ReportProgress(75, "75%done");=0A      =
      Thread.Sleep(1000);=0A           =0A_worker.ReportProgress(100, "100%=
done");=0A        }=0A =0A        void ProcessPhotosWorker_RunWorkerComplet=
ed(object sender, RunWorkerCompletedEventArgs e)=0A        {=0A            =
int dispatcherHash =3D Dispatcher.CurrentDispatcher.Thread.GetHashCode();=
=0A            bool isBackGround =3D Dispatcher.CurrentDispatcher.Thread.Is=
Background;=0A            int id =3D Dispatcher.CurrentDispatcher.Thread.Ma=
nagedThreadId;=0A            ApartmentState thread_state =3D Dispatcher.Cur=
rentDispatcher.Thread.GetApartmentState();=0A            Console.WriteLine(=
MethodInfo.GetCurrentMethod().Name);=0A            Console.WriteLine("    =
=0ADispatcherHash:{0}, IsBackground:{1}, Id:{2}, ThreadState:{3}",=0Adispat=
cherHash, isBackGround, id, thread_state);=0A        }=0A =0A        public=
 void RunBackgroundWorker()=0A        {=0A            int dispatcherHash =
=3D Dispatcher.CurrentDispatcher.Thread.GetHashCode();=0A            bool i=
sBackGround =3D Dispatcher.CurrentDispatcher.Thread.IsBackground;=0A       =
     int id =3D Dispatcher.CurrentDispatcher.Thread.ManagedThreadId;=0A    =
        ApartmentState thread_state =3D Dispatcher.CurrentDispatcher.Thread=
.GetApartmentState();=0A            Console.WriteLine(MethodInfo.GetCurrent=
Method().Name);=0A            Console.WriteLine("    =0ADispatcherHash:{0},=
 IsBackground:{1}, Id:{2}, ThreadState:{3}",=0AdispatcherHash, isBackGround=
, id, thread_state);=0A =0A            =0A_worker.RunWorkerAsync("TestData"=
);=0A        }=0A    }=0A}=0A=0A=0A      
--0-918804661-1222248148=:52616
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head><style type=3D"text/css"><!-- DIV {margin:0px;} --></style></he=
ad><body><div style=3D"font-family:tahoma, 'new york', times, serif;font-si=
ze:12pt"><div><p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-ansi=
-language:EN-AU">Hi Everyone<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNorm=
al"><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p=
></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-=
ansi-language:EN-AU">I=E2=80=99ve been=0Atrying to test some code that uses=
 a background worker. The issues I=E2=80=99m having=0Ais that my test appea=
rs to NOT report progress on the same thread that created=0Athe background =
worker. For tests that involve Dependency objects (WPF) the call=0Aback nee=
ds to happen on the same thread.<o:p></o:p></span></p>=0A=0A<p class=3D"Mso=
Normal"><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0<=
/o:p></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"=
mso-ansi-language:EN-AU">I have a=0Asample application using BackgroundWork=
er (this is below) for one test and=0ASynchronizationContext for another, b=
oth are reporting back onto another=0Athread, not the correct one.=C2=A0 <o=
:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=
=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"=
MsoNormal"><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU">Using nun=
it=0AGUI I=E2=80=99ve explicitly set the test to run in the STA ApartmentSt=
ate.<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU"=
 style=3D"mso-ansi-language:EN-AU">Using nunit=0Aconsole I=E2=80=99ve speci=
fied /nothread flag<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal"><b><s=
pan lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p></spa=
n></b></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-an=
si-language:EN-AU">Nothings=0Aappears to be working. I=E2=80=99m either mis=
understanding the functionality provided=0Aby BackgroundWorker/Synchronizat=
ionContext, incorrectly using nunit, or it=E2=80=99s a=0Abug in nunit.<o:p>=
</o:p></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D=
"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"Mso=
Normal"><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU">Any help=0Aw=
ould be much appreciated, <o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal=
"><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p><=
/span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-an=
si-language:EN-AU">Cheers<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal"=
><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p></=
span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-ans=
i-language:EN-AU">Keith<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal"><=
span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p></sp=
an></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-ansi-=
language:EN-AU">p.s. Here=0Ais the test with the background worker:<o:p></o=
:p></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"ms=
o-ansi-language:EN-AU"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNor=
mal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-=
family:&quot;Courier New&quot;;color:blue">using</span><span style=3D"font-=
size:10.0pt;=0Afont-family:&quot;Courier New&quot;"> System;<o:p></o:p></sp=
an></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span sty=
le=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;;color:blue">u=
sing</span><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New=
&quot;"> System.Collections.Generic;<o:p></o:p></span></p>=0A=0A<p class=3D=
"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;;color:blue">using</span><span style=
=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"> System.Linq;<=
o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:n=
one"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;=
;color:blue">using</span><span style=3D"font-size:10.0pt;=0Afont-family:&qu=
ot;Courier New&quot;"> System.Text;<o:p></o:p></span></p>=0A=0A<p class=3D"=
MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;;color:blue">using</span><span style=
=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"> NUnit.Core;<o=
:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:no=
ne"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;;=
color:blue">using</span><span style=3D"font-size:10.0pt;=0Afont-family:&quo=
t;Courier New&quot;"> NUnit.Framework;<o:p></o:p></span></p>=0A=0A<p class=
=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0p=
t;=0Afont-family:&quot;Courier New&quot;;color:blue">using</span><span styl=
e=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"> System.Threa=
ding;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autos=
pace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New=
&quot;"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"t=
ext-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Co=
urier New&quot;;color:blue">namespace</span><span style=3D"font-size:=0A10.=
0pt;font-family:&quot;Courier New&quot;"> NunitBackgroundWorker<o:p></o:p><=
/span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span =
style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">{<o:p></o=
:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><s=
pan style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=
=A0=C2=A0=C2=A0 [<span style=3D"color:#2B91AF">TestFixture</span>]<o:p></o:=
p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><sp=
an style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=
=C2=A0=C2=A0 <span style=3D"color:blue">public</span>=0A<span style=3D"colo=
r:blue">class</span> <span style=3D"color:#2B91AF">BackgroundTester<o:p></o=
:p></span></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:n=
one"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;=
">=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" st=
yle=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:=
&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [<span =
style=3D"color:#2B91AF">Test</span>]<o:p></o:p></span></p>=0A=0A<p class=3D=
"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 <span style=3D"color:blue">public</span> <span style=3D"color:blu=
e">void</span>=0ATestBackgroundWorker()<o:p></o:p></span></p>=0A=0A<p class=
=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0p=
t;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text=
-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Couri=
er New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=0A<span style=3D"color:blue">new</span> <span style=3D"color:#2B91AF=
">Background</span>().RunBackgroundWorker();<o:p></o:p></span></p>=0A=0A<p =
class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:=
10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B=
91AF">Thread</span>.Sleep(5000);<o:p></o:p></span></p>=0A=0A<p class=3D"Mso=
Normal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afo=
nt-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></span></p>=0A=0A<p cla=
ss=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.=
0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Consol=
e</span>.WriteLine();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" sty=
le=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&=
quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<o:p></=
o:p></span></p>=0A=0A<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt=
;font-family:&quot;Courier New&quot;">}<o:p></o:p></span></p>=0A=0A<p class=
=3D"MsoNormal"><span lang=3D"EN-AU" style=3D"mso-ansi-language:EN-AU"><o:p>=
=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace=
:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quo=
t;;color:blue">using</span><span style=3D"font-size:10.0pt;=0Afont-family:&=
quot;Courier New&quot;"> System;<o:p></o:p></span></p>=0A=0A<p class=3D"Mso=
Normal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afo=
nt-family:&quot;Courier New&quot;;color:blue">using</span><span style=3D"fo=
nt-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"> System.Collections.=
Generic;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-au=
tospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier =
New&quot;;color:blue">using</span><span style=3D"font-size:10.0pt;=0Afont-f=
amily:&quot;Courier New&quot;"> System.Linq;<o:p></o:p></span></p>=0A=0A<p =
class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:=
10.0pt;=0Afont-family:&quot;Courier New&quot;;color:blue">using</span><span=
 style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"> System.=
Text;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autos=
pace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New=
&quot;;color:blue">using</span><span style=3D"font-size:10.0pt;=0Afont-fami=
ly:&quot;Courier New&quot;"> System.ComponentModel;<o:p></o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;;color:blue">using</s=
pan><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"=
> System.Reflection;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" styl=
e=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&q=
uot;Courier New&quot;;color:blue">using</span><span style=3D"font-size:10.0=
pt;=0Afont-family:&quot;Courier New&quot;"> System.Threading;<o:p></o:p></s=
pan></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span st=
yle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;;color:blue">=
using</span><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier Ne=
w&quot;"> System.Windows.Threading;<o:p></o:p></span></p>=0A=0A<p class=3D"=
MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></span></p>=0A=0A<=
p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-siz=
e:10.0pt;=0Afont-family:&quot;Courier New&quot;;color:blue">namespace</span=
><span style=3D"font-size:=0A10.0pt;font-family:&quot;Courier New&quot;"> N=
unitBackgroundWorker<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" styl=
e=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&q=
uot;Courier New&quot;">{<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" =
style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-famil=
y:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0 <span style=3D"color:blue">pu=
blic</span>=0A<span style=3D"color:blue">class</span> <span style=3D"color:=
#2B91AF">Background<o:p></o:p></span></span></p>=0A=0A<p class=3D"MsoNormal=
" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-fam=
ily:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=
=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font=
-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 <span style=3D"color:blue">private</span> <span style=
=3D"color:#2B91AF">BackgroundWorker</span>=0A_worker =3D <span style=3D"col=
or:blue">null</span>;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" sty=
le=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&=
quot;Courier New&quot;"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNo=
rmal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont=
-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 <span style=3D"color:blue">public</span> Background()<o:p></o:p></span></p=
>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"=
font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal=
" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-fam=
ily:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Console</span>.WriteL=
ine(<span style=3D"color:#A31515">"ctor=0A"</span> + <span style=3D"color:#=
2B91AF">MethodInfo</span>.GetCurrentMethod().Name);<o:p></o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></=
span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span s=
tyle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0AInitializeBackg=
oundWorker();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"te=
xt-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Cou=
rier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<o:p></o:p></sp=
an></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span sty=
le=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0<=
/o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none">=
<span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <span style=3D"color:blue">private<=
/span> <span style=3D"color:blue">void</span>=0AInitializeBackgoundWorker()=
<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:=
none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A=
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int=
</span> dispatcherHash =3D <span style=3D"color:#2B91AF">Dispatcher</span>.=
CurrentDispatcher.Thread.GetHashCode();<o:p></o:p></span></p>=0A=0A<p class=
=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0p=
t;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">bool</span> =
isBackGround =3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDis=
patcher.Thread.IsBackground;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNorm=
al" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-f=
amily:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</span> id =3D <sp=
an style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.Manag=
edThreadId;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text=
-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Couri=
er New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=0A<span style=3D"color:#2B91AF">ApartmentState</span> thread_state =
=3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Threa=
d.GetApartmentState();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" st=
yle=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:=
&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Console</span>.WriteLine=
(<span style=3D"color:#2B91AF">MethodInfo</span>.GetCurrentMethod().Name);<=
o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:n=
one"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;=
">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<spa=
n style=3D"color:#2B91AF">Console</span>.WriteLine(<span style=3D"color:#A3=
1515">"=C2=A0=C2=A0=C2=A0=C2=A0=0ADispatcherHash:{0}, IsBackground:{1}, Id:=
{2}, ThreadState:{3}"</span>,=0AdispatcherHash, isBackGround, id, thread_st=
ate);<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autos=
pace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New=
&quot;"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"t=
ext-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Co=
urier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=0A_worker =3D <span style=3D"color:blue">new</span> <span style=
=3D"color:#2B91AF">BackgroundWorker</span>();<o:p></o:p></span></p>=0A=0A<p=
 class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size=
:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A_worker.DoWork +=3D <span style=
=3D"color:blue">new</span> <span style=3D"color:#2B91AF">DoWorkEventHandler=
</span>(ProcessPhotosWorker_DoWork);<o:p></o:p></span></p>=0A=0A<p class=3D=
"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A_worker.RunWorkerCompleted +=3D <span s=
tyle=3D"color:blue">new</span> <span style=3D"color:#2B91AF">RunWorkerCompl=
etedEventHandler</span>(ProcessPhotosWorker_RunWorkerCompleted);<o:p></o:p>=
</span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span=
 style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A=C2=A0=C2=A0=C2=A0_worker.Prog=
ressChanged +=3D <span style=3D"color:blue">new</span>=0A<span style=3D"col=
or:#2B91AF">ProgressChangedEventHandler</span>(ProcessPhotosWorker_Progress=
Changed);<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-a=
utospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier=
 New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=0A_worker.WorkerReportsProgress =3D <span style=3D"color:blue">true</sp=
an>;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autosp=
ace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&=
quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<o:p></o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></=
span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span s=
tyle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <span style=3D"color:blue">void</span> Pr=
ocessPhotosWorker_ProgressChanged(<span style=3D"color:blue">object</span> =
sender, <span style=3D"color:#2B91AF">ProgressChangedEventArgs</span>=0Ae)<=
o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:n=
one"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;=
">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<=
p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-siz=
e:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int=
</span> dispatcherHash =3D <span style=3D"color:#2B91AF">Dispatcher</span>.=
CurrentDispatcher.Thread.GetHashCode();<o:p></o:p></span></p>=0A=0A<p class=
=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0p=
t;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">bool</span> =
isBackGround =3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDis=
patcher.Thread.IsBackground;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNorm=
al" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-f=
amily:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</span> id =3D <sp=
an style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.Manag=
edThreadId;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text=
-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Couri=
er New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0<span style=3D"color:#2B91AF">ApartmentState</span>=0Athread_state=
 =3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thre=
ad.GetApartmentState();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" s=
tyle=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family=
:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Console</span>.WriteLine=
(<span style=3D"color:#2B91AF">MethodInfo</span>.GetCurrentMethod().Name=0A=
+ e.UserState.ToString());<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal=
" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-fam=
ily:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Console</span>.WriteL=
ine(<span style=3D"color:#A31515">"=C2=A0=C2=A0=C2=A0=C2=A0=0ADispatcherHas=
h:{0}, IsBackground:{1}, Id:{2}, ThreadState:{3}"</span>,=0AdispatcherHash,=
 isBackGround, id, thread_state);<o:p></o:p></span></p>=0A=0A<p class=3D"Ms=
oNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Af=
ont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 }<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autos=
pace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New=
&quot;"><o:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"t=
ext-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Co=
urier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <span style=3D"=
color:blue">private</span> <span style=3D"color:blue">void</span>=0AProcess=
PhotosWorker_DoWork(<span style=3D"color:blue">object</span> sender, <span =
style=3D"color:#2B91AF">DoWorkEventArgs</span> e)<o:p></o:p></span></p>=0A=
=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font=
-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" s=
tyle=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family=
:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</span> dispatcherHash =
=3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Threa=
d.GetHashCode();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D=
"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;=
Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=0A<span style=3D"color:blue">bool</span> isBackGround =3D <spa=
n style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.IsBack=
ground;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-aut=
ospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier N=
ew&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=0A<span style=3D"color:blue">int</span> id =3D <span style=3D"color:#2B=
91AF">Dispatcher</span>.CurrentDispatcher.Thread.ManagedThreadId;<o:p></o:p=
></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><spa=
n style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=
=3D"color:#2B91AF">ApartmentState</span> thread_state =3D <span style=3D"co=
lor:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.GetApartmentState()=
;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace=
:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quo=
t;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<s=
pan style=3D"color:#2B91AF">Console</span>.WriteLine(<span style=3D"color:#=
2B91AF">MethodInfo</span>.GetCurrentMethod().Name);<o:p></o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B=
91AF">Console</span>.WriteLine(<span style=3D"color:#A31515">"=C2=A0=C2=A0=
=C2=A0=C2=A0=0ADispatcherHash:{0}, IsBackground:{1}, Id:{2}, ThreadState:{3=
}"</span>,=0AdispatcherHash, isBackGround, id, thread_state);<o:p></o:p></s=
pan></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span st=
yle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0=
</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"=
><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A_worke=
r.ReportProgress(25, <span style=3D"color:#A31515">"25%done"</span>);<o:p><=
/o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none">=
<span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span sty=
le=3D"color:#2B91AF">Thread</span>.Sleep(1000);<o:p></o:p></span></p>=0A=0A=
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A_worker.ReportProgress(50, <sp=
an style=3D"color:#A31515">"50%done"</span>);<o:p></o:p></span></p>=0A=0A<p=
 class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size=
:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Thr=
ead</span>.Sleep(1000);<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" s=
tyle=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family=
:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=0A_worker.ReportProgress(75, <span style=3D"color:#A3151=
5">"75%done"</span>);<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" sty=
le=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&=
quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Thread</span>.Sleep(1000);<=
o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:n=
one"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;=
">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A_wor=
ker.ReportProgress(100, <span style=3D"color:#A31515">"100%done"</span>);<o=
:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:no=
ne"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"=
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<o:p></o:p></span></p>=0A=0A<p=
 class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size=
:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></span></p=
>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"=
font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 <span style=3D"color:blue">void</span> ProcessPhot=
osWorker_RunWorkerCompleted(<span style=3D"color:blue">object</span> sender=
, <span style=3D"color:#2B91AF">RunWorkerCompletedEventArgs</span>=0Ae)<o:p=
></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none=
"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<p =
class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:=
10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</s=
pan> dispatcherHash =3D <span style=3D"color:#2B91AF">Dispatcher</span>.Cur=
rentDispatcher.Thread.GetHashCode();<o:p></o:p></span></p>=0A=0A<p class=3D=
"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">bool</span> =
isBackGround =3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDis=
patcher.Thread.IsBackground;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNorm=
al" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-f=
amily:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</span> id =3D <sp=
an style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.Manag=
edThreadId;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text=
-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Couri=
er New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=0A<span style=3D"color:#2B91AF">ApartmentState</span> thread_state =
=3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Threa=
d.GetApartmentState();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" st=
yle=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:=
&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:#2B91AF">Console</span>.WriteLine=
(<span style=3D"color:#2B91AF">MethodInfo</span>.GetCurrentMethod().Name);<=
o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:n=
one"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;=
">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<spa=
n style=3D"color:#2B91AF">Console</span>.WriteLine(<span style=3D"color:#A3=
1515">"=C2=A0=C2=A0=C2=A0=C2=A0=0ADispatcherHash:{0}, IsBackground:{1}, Id:=
{2}, ThreadState:{3}"</span>,=0AdispatcherHash, isBackGround, id, thread_st=
ate);<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autos=
pace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New=
&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<o:p></o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o:p>=C2=A0</o:p></=
span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span s=
tyle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <span style=3D"color:blue">public</span> =
<span style=3D"color:blue">void</span>=0ARunBackgroundWorker()<o:p></o:p></=
span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span s=
tyle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {<o:p></o:p></span></p>=0A=0A<p class=3D"=
MsoNormal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=
=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</span> d=
ispatcherHash =3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDi=
spatcher.Thread.GetHashCode();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNo=
rmal" style=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont=
-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">bool</span> isBackGro=
und =3D <span style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.T=
hread.IsBackground;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=
=3D"text-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&qu=
ot;Courier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=0A<span style=3D"color:blue">int</span> id =3D <span style=
=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.ManagedThread=
Id;<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospa=
ce:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&q=
uot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A=
<span style=3D"color:#2B91AF">ApartmentState</span> thread_state =3D <span =
style=3D"color:#2B91AF">Dispatcher</span>.CurrentDispatcher.Thread.GetApart=
mentState();<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"tex=
t-autospace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Cour=
ier New&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=0A<span style=3D"color:#2B91AF">Console</span>.WriteLine(<span style=
=3D"color:#2B91AF">MethodInfo</span>.GetCurrentMethod().Name);<o:p></o:p></=
span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span s=
tyle=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0A<span style=3D"=
color:#2B91AF">Console</span>.WriteLine(<span style=3D"color:#A31515">"=C2=
=A0=C2=A0=C2=A0=C2=A0=0ADispatcherHash:{0}, IsBackground:{1}, Id:{2}, Threa=
dState:{3}"</span>,=0AdispatcherHash, isBackGround, id, thread_state);<o:p>=
</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"=
><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quot;"><o=
:p>=C2=A0</o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autosp=
ace:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&=
quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=0A_worker.RunWorkerAsync(<span style=3D"color:#A31515">"TestData"</s=
pan>);<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-auto=
space:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier Ne=
w&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<o:p></o:p></span></p>=
=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"f=
ont-size:10.0pt;=0Afont-family:&quot;Courier New&quot;">=C2=A0=C2=A0=C2=A0 =
}<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal" style=3D"text-autospace=
:none"><span style=3D"font-size:10.0pt;=0Afont-family:&quot;Courier New&quo=
t;">}<o:p></o:p></span></p>=0A=0A<p class=3D"MsoNormal"><span lang=3D"EN-AU=
" style=3D"mso-ansi-language:EN-AU"><o:p>=C2=A0</o:p></span></p></div><div =
style=3D"position:fixed"></div></div><br>=0A=0A=0A=0A=0A      </body></html=
>
--0-918804661-1222248148=:52616--


--===============2734883345666413468==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
--===============2734883345666413468==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users

--===============2734883345666413468==--