Multiple WPF applications in the same AppDomain

前端 未结 3 992
时光取名叫无心
时光取名叫无心 2021-01-18 03:57

I got following setup:

WPF_Application.exe

and

a DLL that contains a WinForms Window and an WPF Window.

The \'WPF_Application.exe\' calls th

3条回答
  •  一整个雨季
    2021-01-18 04:23

    System.Windows.Application is a singleton: its constructor must only be invoked once (including App.xaml de-xamlization), or exception is thrown.

    I'm affraid there is not much you can do about it, except maybe check if Application.Current is set before starting your second application, and somewhat use that instance to load it.

    Or you can create another AppDomain, and use it to launch the second application.

提交回复
热议问题