I'm opening a second window in my main window. This window is used to display a progress bar, so I don't want to block my application when it is open.
My code is:
public partial class MainWindow : Window, IDisposable
{
private void doUpdate(object sender, UpdateInfosArgs e)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
using (DownloadingFileWindow dlw = new DownloadingFileWindow())
{
dlw.OnDownloadFileComplete += OnDownloadFileComplete;
this.Dispatcher.BeginInvoke((Action)(() => dlw.ShowDialog()));
// or dlw.Show();
}
}
}
}
Currently, when the window is shown, it is closed immediately when execution reaches the }
of the using
.
Is there a way to way that windows is closed?