I am creating a Kinect application and want to open a new window called ‘Help’ from the ‘MainWindow.xaml.cs’ file.
I tried using the following code:
// The commented code is what I have tried.
public static void ThreadProc()
{
// Window Help = new Window();
//Application.Run(new Window(Help);
Application.Run(new Form());
}
private void button1_Click(object sender, EventArgs e)
{
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
t.Start();
}
Showing a window just requires a call to its
Showmethod.However, keeping an application running requires a call to
Application.Run. If you pass this method a form, it’ll callShowfor you.However, if you already have a running application, you can just do something like
new MyForm().Show().I strongly suspect you don’t need to create a new thread and
Applicationfor your new window. Can’t you just use: