I have an event, PropertyChangedEventHandler and I raise it like this:
PropertyChanged(this, new PropertyChangedEventArgs("LogFile"));
PropertyChanged(this, new PropertyChangedEventArgs("Nodes"));
I also attached to it:
PropertyChanged += UpdateCamxWindowEvent;
How can I execute UpdateCamxWindowEvent only when the event is raised with "LogFile"?
What I should change in my code?
There is no way to execute specific method only for certain parameters, unless you created another event. What you should do is to change
UpdateCamxWindowEvent, so that it actually does something only when the parameter isLogFile.If you can’t do that or it logically doesn’t make sense in your application, you can add an handler that just tests the argument and if it matches, calls the method:
Note that you wouldn’t be able to unsubscribe this anonymous method from the event. If you need to do that, use normal method with the same functionality.