none
Serial Scanner listener RRS feed

  • Question

  • Hi,

    I have scenario like below.

    1. Serial Scanner have a data received event, listening from com port.

    2. Serial scanner expose one event when data received from com port.

    3. WPF application gets events from serial scanner.

    4. multiple windows are subscribed to event defined in point 2

    5. Now my 2 windows which are subscribed to event which is in point 2 have an issue, when both windows are open.

    6. One of the window is parent, now i am opening another window as a showdialog. 

    7. I want event to be raised for child window, instead both.

    Currently i have solution of adding/removing listener runtime, but it does not look good.

    please suggest.

    Thanks,

    Rajnikant

    Friday, May 1, 2015 10:31 AM

Answers

  • Hello Rajnikant,

    >>2. Serial scanner expose one event when data received from com port.

    Will the Serial scanner a .NET based project so that the event would be a .NET event? If so, the measure of .NET to handle events is that it would have a list to record all registered menthod, and it is by designed that all registered events would be fired.

    >>Currently i have solution of adding/removing listener runtime, but it does not look good.

    You could try to customize the event args property: https://msdn.microsoft.com/en-us/library/system.eventargs%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396, when the Serial scanner files these events, passing an args to specific which event you want it to be fired. We cannot stop events to be fired, however, we can determine how they can be run, you could use if statement in your each registered event, to check the passed agrs to see if you want these code in this event to be run.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 4, 2015 6:22 AM
    Moderator