c# - Using ReactiveUI InvokeCommand Extension with Changing Targets -


The code below works, I do not know that this is the best practice, I am thinking that I am more on the situation I am thinking.

Status: The code below is in my main view model manufacturer. ViewModel has MessageHandler which has Reactive Commands property on which it is called Receivemessage . ViewModel has a property with a RawMessage with another property ScannerViewModel . I would like to use the Reactive UI code. Invoic Commands () Extension Method for Pipe RawMessage to Receivemessage I want it to check for .CENExecute Although MessageHandler (or even getmessage potentially possible) may change, as well as with ScannerViewModel .

  this.WhenAnyValue (t = & gt; t.MessageHandler.ReceiveMessage). Select (CMD => this when any value (T => TSCNR Videodel.Romesses). Invoke Commands (CMD). Scan (Disposable.pt, (ACC, N) => ACC. Dies (); Return n;}). Subscribe ();  

then seems to work up. I am not sure whether I need to dispose of the last incocommand disposation, so that the .can section may be unnecessary or may have done better.

I tried to overload the Awake Commands extension, which could set you a goal, but it seemed static, or I understood the syntax to move it Could not be a inspector as a goal:

  this.WhenAnyValue (t => t.ScannerViewModel.RawMessage). InvoCommand (MessageHandler, m => m.receiveMessage);  

This will follow RawMessage as its parent, but if MessageHandler is changed then it will be broken and it does not compile Is:

  this.WhenAnyValue (t = & gt; t.ScannerViewModel.RawMessage). InvoCommand (this.WhenAnyValue (t => T. MessageHandler), M => m.ReceiveMessage);  

I am not against anything that I have found, unless it finds any fault with it. I'm looking for something that is probably less pronounced and easy to follow.

Do not ask me why do not I think:

  this WhenAnyValue (t = & gt; t.ScannerViewModel.RawMessage). InvoCommand (this, t => T. Message Handler. Receive Message);  

I was looking at it upside down I think it will receive what I want.

From time to time, I have to make the framework that I have already found solutions to problems - it is only a case of messing up for yourself.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -