Is it possible to call a method inside a BackgroundWorker's Do_Work event?


hi,

i'm trying call long data processing method inside a do_work event. it's skipping it.  example:

private void backgroundworker1_dowork(object sender, doworkeventargs e)
{
    clipshapefile();
}

appeciate help.


marilyn gambone

sure is. if method code controls of form, have invoke (because control created ui thread, cannot access other thread).

can do:

void dowork(...) {     clipshapefile(); }  void clipshapefile() {     if(yourcontrol.invokerequired)         yourcontrol.invoke((action)(() => clipshapefile()));     else     {         //access controls     } }

otrherwise, if there no code inside your clipshapefile() access controls created on ui thread, not need code. thats it.

hope helps.


mitja



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

SQL Server 2008 - High Memory Usage

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

Problem In Configuring Biztalk 2009 In Creating A ReceivePort.When I Try To Create A Receive POrt I Got This Error