Hello!
I´ve set up business logic handling a connection of a clientsoftware to a serversoftware. My design is based on ReactiveExtensions/ReactiveUi
That BL is encapsulated in this interface:
public interface IServerConnectionLogic { IObservable<bool> Connected { get; } Task Connect(); ... }
In my viewmodel (based on ReactiveObject) I create my commands, that should trigger the server-connection:
CmdConnectToService = new ReactiveCommand(ServerConnectionLogic.Connected.Select(connected => !connected)); CmdConnectToService.Subscribe(_ => ServerConnectionLogic.Connect());
The command is bound to a button in my UI-XAML.
When pressing the button the subscribed lamda is hit and the "Connect" method is called. Inside the Observable "Connected" is set to "true.
Also the lambda in the "CanExecute"-parameter of the constructor of the ReactiveCommand is hit.
But the UI is not updated. I would have expected the button to get disabled, since the observable "Connected" turns to "true" and the "Select" statement inverts my boolean value...
Another idea was, that the "CanExecuteChanged"-Event was not triggered, so i attached to this event with some dummy-handler and it got hit...
I´ve tried that with the "RibbonButton" from the WpfToolkit as well as with a "normal" Button. Both are not getting updated.
The same IObservable is also bound to a member field:
m_ServerConnected = new ObservableAsPropertyHelper<bool>(ServerConnectionLogic.Connected, _ => raisePropertyChanged("ServerConnected"));
while "m_ServerConnected" is bound to a CheckBox (for testing) via a property. That one is working fine, so the
observable must be working...
Does anyone have an idea what could be my issue?