tags:

views:

70

answers:

3

It seems to be possible in this project...

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

How did they do that?

+1  A: 
BackgroundWorker worker;
ProgressDialog pd;

Calling form is done through a ShowDialog().

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

In ProgressDialog.xaml.cs identified two properties

public string ProgressText
public int ProgressValue

In the class Window1.xaml.cs values of these properties change.

Anry
I see.. can we say that .Show() means the 2 windows are independent whereas .ShowDialog() means the child is dependent on the parent?
yeeen
@yeeen Yes. For example property WindowStartupLocation ProgressDialog forms can be set CenterOwner. Then ProgressDialog will start in the center of the parent window.
Anry
A: 

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.

Alex Farber
A: 

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

Alex Janzik