I did the following scenario:
But nothing happens, the Login is still visible.
I also tried to Dispose the MainPage and Desktop.Show.
But nothing brings the desktop “in front”. Could you please give me advise, how to handle this correct.
The code you attached is wrong and it causes a NullReferenceException.
It uses an Async method handler and starts another thread in there with Awai, which starts another thread losing the context a second time! Async methods are executed in a different thread which has no knowledge of the context. This is not a Wisej issue, the same happens with any web framework when using async handlers. The exception is shown in Visual Studio. Cannot be show on the browser because the new thread is out of context.
There is no reason to use async handlers. But if you really want to, simply pass a reference to the Login method :AddHandler Button1.Click, Sub() locMyMVVM.Login(Me) and in Public Async Sub Login(dialog As Wisej.Web.Form) call dialog.Close().
Also the sample is not using a Page, which is OK. See my attached sample for a different approach.
See also: https://wisej.com/docs/html/BackgroundTasks.htm
I changed the design, as you told me.
But, I still face issues, when I try to get the Application.OpenForms, within an async routine.
I attach a project, where it can be reproduced.
When you uncomment the Task.Run and don’t use the async word, then everything works as expected.
The problem is, that I use async/await for all of my database queries and therefore I will need it.
THX and I hope a solution can be found
In https://github.com/iceteagroup/wisej-examples there is a collection of samples. The UIContainers sample shows the behaviour of different types of applications: Window only, Page+Window and Desktop+Window. Please note that Window is another name for Form.
I’m afraid there isn’t a mixed Desktop/Page application example since Desktop and Page take over the full browser area so one control would hide the other.
If the UIContainers sample doesn’t help, please attach a sample.
Please login first to submit.