Here is the code snippet for creating a new app domain and hosting your wpf allication in that domain
1 var domain1 = AppDomain.CreateDomain( 2: "new domain"); 3: 4: CrossAppDomainDelegate action = () => 5: { 6: Thread thread = new Thread(() => 7: { 8: App app = new App(); 9: app.MainWindow = new Window1(); 10: app.MainWindow.Show(); 11: app.Run(); 12: }); 13: thread.SetApartmentState( 14: ApartmentState.STA); 15: thread.Start(); 16: }; 17: 18: domain1.DoCallBack(action);
No comments:
Post a Comment