Open Evangelink opened 3 years ago
- Undo/Redo
I created this undo/redo code that doesn't even depend on the Elmish NuGet package, but it is intended to be consumed by an Elimsh application. I did not make it into a NuGet package.
- helpers to get to background thread, UI thread for functions but also async.
In my application at my (former) employer, I wrote several functions to do this. Most of the work was creating a function-based API for the Async<_>
type. Some of it can be tricky because getting the correct signature doesn't mean it has the right behavior. Subscriptions and commands are executed on the UI thread (though not synchronously as we recently discussed in issue #403), so I never found a need to move execution back to the UI thread from a background thread.
There are a couple of helpers (types & functions) that seems to be reusable patterns [...]
In my application at my (former) employer, I defined this type (after dropping the suffix Msg
) in an AutoOpen
ed module because I find the OutMsg
with translator pattern so useful.
https://github.com/elmish/Elmish.WPF/blob/1bf4d28c238671d990736e4030792b53776b2927/src/Samples/SubModelSeq.Core/Program.fs#L9-L11
[...] I am wondering if they could/should be part of the Elmish.WPF framework or maybe even some global Elmish as maybe some could also be used in Elmish web.
I only want to add code to Elmish.WPF if it is specific to WPF (while keeping at eye out for what is truly unique to WPF and what can be shared with Elmish.Uno...c.f. issue #364). For everything else, the easiest thing is to simply share the code (like I did for undo/redo) or write about it. A more streamlined solution is to package up that code via NuGet and maybe even host it from within the Elmish organization.
- as it's not possible to use datatemplateselector, I am usually defining the various views at once and using visibility to "select" the view. There might be a few generic helpers we could provide.
Yes, I do that too. It is a bit annoying, but I don't know of a better solution. This is specific to WPF, so we might be able to add something one day that helps with this.
@Evangelink I think this is a great idea, have you had any success implementing some of it? Could you share some examples/code samples? I think the best thing for now would be to create a repo where any user can propose their helpers/patterns etc. so we can browse them at a unique place (instead endlessly searching/reading posted “Issues”) and discuss how to refine these.
@TysonMN You seem to have many of these scattered throughout the “Issues”/“PR” posts, do you have personal nugets/class libraries of such templates/features/helpers that you could share with all of us (I am aware of Undo/Redo, but sometimes some links are "404" broken)? It would certainly help a lot. Thank you very much
I have nothing private. Everything is in this GitHub repository.
Hey there,
There are a couple of helpers (types & functions) that seems to be reusable patterns and I am wondering if they could/should be part of the Elmish.WPF framework or maybe even some global Elmish as maybe some could also be used in Elmish web. I am sure there are some helpers you have also defined and generally reuse hence this question/proposition.
Some ideas: