1

I have this code

public void BckGrwndWrkrInHst()
{
    var BWLoad = new BackgroundWorker()
    { WorkerReportsProgress = true };
    BWLoad.RunWorkerAsync();
    BWLoad.DoWork += Bwload_DoWork;
    BWLoad.ProgressChanged += Bwload_ProgressChanged;
}

and these three methods :

private void Bwload_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
    LPrgrBar.Value = e.ProgressPercentage;
}

public void Bwload_DoWork(object sender, DoWorkEventArgs e)
{
    method(/* dnw what to do */);
}
public void method(string a , string b)
{
    //work to do 
}

And on the other window, I have two values a1 and b1.

I want to call the BckGrwndWrkrInHst() which calls the other three methods and I want to return a1 and b1 in the method(a1,b1). I don't know how to do this

(application.current.mainwindow as mainwindow).BckGrwndWrkrHst();
Draken
  • 3,134
  • 13
  • 34
  • 54
elie mardelly
  • 79
  • 2
  • 10
  • If you are talking about different processes, then [IPC](http://stackoverflow.com/q/56121/1997232) is the way to go. – Sinatr Mar 09 '17 at 08:51
  • 1
    As an aside, abbreviating method names is a bad habit to get into. Methods are generally 'write once, read many', so you should write them for future people, including yourself, to easily read and understand. – Steve Mar 09 '17 at 08:52
  • can you show me w to do it please @DarrenYoung – elie mardelly Mar 09 '17 at 08:56
  • Google for delegating methods – Pwnstar Mar 09 '17 at 10:17

0 Answers0