How to make a program that only loads the window but doesn't show it, and doesn't block the code? #236
-
I'm developing with Blazor, and for the Windows platform, my program need COM call, and I don't want it to block subsequent code, I want the window to be there and not take focus. PhotinoBlazorApp.Run();
// The code is blocked. I tried looking for the method in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@vitash Why not make your COM call on another thread before opening the window? If we don't block and wait on the windows, they the .NET code will simply run to completion and exit. Otherwise, it would be up to your code to block. |
Beta Was this translation helpful? Give feedback.
-
I tried running it in a new thread, but the program that called COM crashed. PhotinoBlazorApp app = BuildWindow();
var t1 = new Thread(() => {
app.Run();
});
t1.SetApartmentState(ApartmentState.STA);
t1.Start(); |
Beta Was this translation helpful? Give feedback.
@vitash Why not make your COM call on another thread before opening the window? If we don't block and wait on the windows, they the .NET code will simply run to completion and exit. Otherwise, it would be up to your code to block.