Control over Avalonia Message Loop #17023
Replies: 3 comments 2 replies
-
You need a |
Beta Was this translation helpful? Give feedback.
-
Just want to thank you for your reply. I may follow this up when I have discovered a path to go down for my solution. |
Beta Was this translation helpful? Give feedback.
-
I'm not up to speed on WASM yet, but would need to my solution to eventually work in a browser. I'm thinking that the way to go might be to employ 2 long running threads. One is the app main which can handle Avalonia. The other I will use to handle the blocking calls as mentioned above. The only thing needed would be a way to get the two to communicate. Q. I'm a little confused by threads in WASM. In some literature, I read that they are not implemented in .NET 8 but might be .NET 9. On the other hand, I see you guys already using them: Any problems in WASM using the Thread class or Task? |
Beta Was this translation helpful? Give feedback.
-
It would be complex to explain fully what I'm trying to do here, but I need to chain together custom blocking functions called in response to events, while preserving the MainWindow and responding to Avalonia events.
Essentially, I need to enter the Avalonia message loop, come out of it on demand, and then go back in.
To phrase it another way, I need the equivalent of a
Window.ShowDialog()
method on a Window that is already visible.I'm reading:
https://docs.avaloniaui.net/docs/concepts/application-lifetimes
I see the code:
Q. What I'm asking is can I cancel
Run()
, end then re-enter it? Something like...Would this work?
Is the another way to do it?
Beta Was this translation helpful? Give feedback.
All reactions