JordanMarr / ReactiveElmish.Avalonia

Static Avalonia views for Elmish programs
Other
92 stars 8 forks source link

Make Elmish.Avalonia work on non-Windows systems #1

Closed sleepyfran closed 1 year ago

sleepyfran commented 1 year ago

So I was trying to test this out on my Mac and I got a bunch of errors related to the project being Windows-only. After playing some hide and seek with the compiler I was able to pin point these changes to make it work on other OSs. I've only tested in Mac, but given that there's no Windows-specific references here it should work just as well on Linux.

The only gap that I wasn't able to fill is the CommandManager, since this seems to be on the Windows namespace which is not available outside of Windows. For now I've just removed the reference and the sample seems to work just fine, however I'm guessing that this will cause issues when using something like what's mentioned on the type's docs. I'm not familiar with commanding in WPF, is there some Avalonia alternative for this?

Note: There's no need to merge this if you want to keep it Windows only, just thought it'd be nice to have it for other OSs since it's one of the main advantages of Avalonia vs WPF :^)

JordanMarr commented 1 year ago

Good catch! I definitely do want to merge it. It was just an oversight on my part -- something I meant to follow up on but then forgot.

I'm pretty sure Avalonia doesn't even require an ICommand at all and can bind directly to a method.

JordanMarr commented 1 year ago

Tried it and everything works great. This is exactly what I love about OSS!

JordanMarr commented 1 year ago

https://github.com/JordanMarr/Elmish.Avalonia/releases/tag/1.0.0-alpha-3