Nevron .NET Vision
Nevron.Dom Namespace / NNodeEventSinkService Class
Members


In This Topic
    NNodeEventSinkService Class
    In This Topic
    The NNodeEventSinkService class represent a service, which provides nodes with a centrilized mechanizm to fire events
    Object Model
    NNodeEventSinkService Class
    Syntax
    'Declaration
     
    
    Public Class NNodeEventSinkService 
       Inherits NService
       Implements INService, Nevron.INReferenceHolder, Nevron.INReferenceProvider 
    'Usage
     
    
    Dim instance As NNodeEventSinkService
    public class NNodeEventSinkService : NService, INService, Nevron.INReferenceHolder, Nevron.INReferenceProvider  
    Remarks
    You can subscribe for the node events routed to this service in two ways:
    • This is achieved by adding an event handler for one of the node events exposed by the service. For example: ... // subscribe for a broadcasted event nodeEventSinkService.NodePropertyChanged += new NodePropertyEventHandler(OnAnyNodePropertyChanged); ... private void OnAnyNodePropertyChanged(NNodePropertyEventArgs args) { } The OnAnyNodePropertyChanged method will be called when a property of any of the nodes, which are connected to this service has changed. This is particularly useful if you do not want to hook/unhook the events of all nodes residing in the node scene.
    • This is achieved with the help of the AddNodeEventListener method. For example: ... // install node event listener for the NodePropertyChanged event nodeEventSinkService.AddNodeEventListener("NodePropertyChanged", node1, new NodePropertyEventHandler(OnNode1PropertyChanged)); ... ... private void OnNode1PropertyChanged(NNodePropertyEventArgs args) { } The OnNode1PropertyChanged method will only be called when a property of node1 has changed. This method for event subscription is usefull if you want to monitor only the events of a particular node.

    From a nodes' point of view it is enough to only call the respective FireXXX method in order to update all listeners and broadcasted event subscribers. By design the service first invokes the event handlers of the registered node listeners and then invokes the broadcasted event handlers.

    You can also specify a node event filter. This is achieved with the help of the NodeFilter property. If a node filter is specified (the NodeFilter property is not null), then a node event will only be fired if the node satisfies the provided filter. This helps you globally block any node event if the node for which it will be fired does not satisfy the filter criteria.

    Inheritance Hierarchy

    System.Object
       Nevron.Dom.NService
          Nevron.Dom.NNodeEventSinkService
             Nevron.Chart.NEventSinkService
             Nevron.Diagram.NDiagramEventSinkService

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also