其中一个较小的项目需要功能更改......所以我决定也更新 Gjallarhorn.Bindable.Wpf 库的版本。
事实上,我只是在需要的地方添加了一个附加参数。
但是现在应用程序不能正常工作,因为命令调用的函数被调用了两次。
最小的例子如下:
type Message = |Number of int
let rand = Random()
let mbindings _ source _ =
let getNumber() =
let number = rand.Next()
printfn "RAND = %A" number //print a number twice
number |> Some
[
Bind.Explicit.createCommand "NewNumber" source
|> Observable.map (fun _ -> getNumber())
|> Observable.toMessage Number
]
let mcomponent : IComponent<int, obj, Message> =
Component.fromExplicit mbindings
let app nav =
let model = 42
let update message _ =
match message with
|Number number -> number
Framework.application model update mcomponent nav
...
let nav = Navigation.singleView Application MainWin
let app = app nav.Navigate
Framework.RunApplication (nav, app)
这是图书馆的错误还是我错过了什么?