Assuming two projects, a WinForms project and a WPF project, in the WinForms project there is no problem with the following code being in Main() and removing the Application.Run:
while (true)
{
Thread.Sleep(1000);
Form1 window = new Form1();
window.Show();
Thread.Sleep(1000);
window.Close();
}
However, in the WPF application, removing the StartupUri="Window1.xaml" and then creating:
public App()
{
while (true)
{
Thread.Sleep(1000);
Window window = new Window();
window.Show();
Thread.Sleep(1000);
window.Close();
}
}
The program loops indefinitely but the Window only opens up once?