如何将值从窗口返回到另一个C#

时间:2017-03-09 08:47:48

标签: c#

我有这段代码

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

和这三种方法:

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 
}

在另一个窗口,我有两个值a1和b1。

我想调用调用其他三种方法的BckGrwndWrkrInHst() 我想在method(a1,b1)中返回a1和b1。我不知道该怎么做

(application.current.mainwindow as mainwindow).BckGrwndWrkrHst();

0 个答案:

没有答案