开发者

Opening a new window in WPF withoug using .show()?

It seems to be possible in this project...

After they use pd = new ProgressDialog();, the new window appears.

Ho开发者_运维技巧w did they do that?


Let's define next instances first:

BackgroundWorker worker;
ProgressDialog pd;

then show a form through the ShowDialog() method in the click handler:

private void btnReportProgress_Click(object sender, RoutedEventArgs e)
{
    int maxRecords = 1000;
    pd = new ProgressDialog();
    // doing something more...
    pd.ShowDialog();
}

ProgressDialog.xaml.cs class could have additional properties:

public string ProgressText
public int ProgressValue


pd.ShowDialog() is the last line of the btnReportProgress_Click function. It shows modal dialog, which is closed when the worker thread is completed, see worker.RunWorkerCompleted event subscription.


Maybe they call this.Show() in the constructor of ProgressDialog class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜