I am trying to start a WPF application using Win Forms application.
Here is my code
private void button2_Click(object sender, EventArgs e)
{
try
{
var app = new App();
app.InitializeComponent();
app.Run(new MainWindow());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
When i click the button it will load WPF app. Then if i close the WPF and click the button again then i get the following error
Cannot create more than one System.Windows.Application instance in the same AppDomain