Is it possible to use dialogs with the Elmish hooks? #250
-
I'm using the Elmish hooks in the component model, but I can't get The non-hook Elmish version has Any help would be greatly appreciated! My update function is type WindowParams = { Window : Window }
type Msg = | PickProjectFile | SetProjectFile of string
let handler windowParams msg model =
match msg with
| PickProjectFile ->
let saveFileTask =
Dispatcher.UIThread.InvokeAsync<string>(
System.Func<System.Threading.Tasks.Task<string>>(fun () ->
let dialog = SaveFileDialog()
dialog.ShowAsync windowParams.Window
))
model, saveFileTask.Result |> SetProjectFile |> Cmd.ofMsg Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Thanks for posting your issue. The |
Beta Was this translation helpful? Give feedback.
-
Also, you may need to add |
Beta Was this translation helpful? Give feedback.
-
I've added some sample code at https://github.com/marklam/FuncUIFileDialog It's a standalone solution (using paket - so |
Beta Was this translation helpful? Give feedback.
-
Please Ignore this comment, it's fixed (explanation in the replies) As a side note, the AppBuilder needs a call to
The strange thing is that the call isn't needed if the demo project is built & run within the Avalonia.FuncUI tree, with project references rather than nuget package references. Is this a known/expected thing, or should I create a separate bug/issue for it? |
Beta Was this translation helpful? Give feedback.
-
The next prerelease will have a completely reworked useElmish hook that will be fully based off of Elmish 4, so it will have all the latest async handlers. |
Beta Was this translation helpful? Give feedback.
The next prerelease will have a completely reworked useElmish hook that will be fully based off of Elmish 4, so it will have all the latest async handlers.
#251