Closed metal450 closed 3 months ago
DialogService.Show(null, MainWindow);
If I recall correctly, using this syntax for initiation is only required to enable features like triggering IViewLoaded / IViewClosing / IViewClosed. If you don't create it that way, the app should still work but those events won't be triggered in the ViewModel.
Would you just need a separate method to bind those events when the View is created differently?
Hmm...so maybe the issue is actually something else then. Whenever I try to show a dialog (not just the initial MainView, but in the normal course of operation), I get a similar exception:
*** Terminating app due to uncaught exception 'System.NotSupportedException', reason: 'Specified method is not supported. (System.NotSupportedException)
at Avalonia.iOS.WindowingPlatformStub.CreateWindow()
at Avalonia.Controls.Platform.PlatformManager.CreateWindow()
at Avalonia.Controls.Window..ctor()
at HanumanInstitute.MvvmDialogs.Avalonia.DialogManager.GetDummyWindow()
at HanumanInstitute.MvvmDialogs.DialogManagerBase`1.<>c__DisplayClass32_0`1.<<ShowFrameworkDialogAsync>b__0>d[[Avalonia.Controls.Conte
f27]].MoveNext()
I assumed that was because I hadn't initialized it properly from the get go, but maybe it's something else...?
It's crashing in
Avalonia.iOS.WindowingPlatformStub.CreateWindow()
Looks like something else.
Looks like an issue within Avalonia itself.
Ah ok, will report to them then - thanks for the quick reply. I thought it might have been because I didn't initialize it properly, but I guess not :)
You can post a link to the thread here. I'd be curious to know more about the issue.
Sure. I'm not gonna post it quite yet as I want to work through a few other things & make a standalone repro project first, but I made myself a note & will drop a link here once I do post it to them :)
Developing for iOS is in my plans; without a Mac. So I'm interested in your findings. Didn't get to even see the problem you encountered of needing a physical mac.
Developing for iOS is in my plans; without a Mac.
Ultimately you'll still need a Mac. HotReload just makes development less of a hassle, but Apple won't let you do a build that will run on any other device, nor submit to the app store, without paying them for a physical Mac. They won't even let you run an iOS emulator without a Mac.
Apple is the worst :P
I have an existing Avalonia app, in which MVVMDialogs works great. I'm now wrapping it in a Maui app, via AvaloniaMauiHybrid.
Why/Rationale (as an aside, just for context):
The sole thing I can't figure out is how to get MVVMDialogs to work. Typically, we show the main view in Application.axaml.cs like:
However, in this case, the "main" application is Maui. It starts like this:
And then has one ContentPage, which hosts the MainView of the Avalonia app:
Thus, the Avalonia MainView & ViewModel are "created" in the Maui app's xaml. The
UseAvalonia()
call above invokes the Avalonia core project'sOnFrameworkInitializationCompleted()
. To temporarily get it working (everything except MVVMDialogs), I just commented out the call toDialogService.Show(null, MainWindow)
.So I'm sure you can see the dilemma. It seems like I need to embed the Avalonia main view in the Maui app's xaml...but then if I do, I can't create the view with MVVMDialogs. Can you think of any way I could get MVVMDialogs up and running in this case?
(Side note: if I do call
DialogService.Show()
, it will throw'Specified method is not supported.'. Callstack: ' at Avalonia.iOS.WindowingPlatformStub.CreateWindow()
)Thanks in advance for any ideas