Newb here.
I am instantiating the class below from a Silverlight page's code-behind.
I am trying to understand why the threads that spin off (the loadoperation and the worker) successfully raise the Selected event on the class when their completed events fire, but the Select event on the method call (in this case the constructer) itself is always null and therefore cannot?
Is there a way to raise the event on the method call itself?
Thanks!
public EventTest()
{
if (1 != 1) //for test purposes
{
IPWorxDomainContext ctx = new IPWorxDomainContext();
loadOperation = ctx.Load(ctx.GetTradeMarkRegistryListingsQuery());
loadOperation.Completed += new EventHandler(loadOperation_Completed);
}
else
{
if (Selected != null) //always null
{
Selected(null, new EventArgs());
}
worker = new BackgroundWorker();
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.RunWorkerAsync();
}
}