예제 #1
0
        bool thOutPortB_HandlerStatusCallback(TrafficHandlerPort sender, TrafficHandlerPort attacher)
        {
            if (sender != OutPortB)
            {
                throw new InvalidOperationException("The Out Port B query callback was called by another sender than the Out Port B. This is a serious internal error.");
            }

            ConditionalTrafficSplitter thSplitter = (ConditionalTrafficSplitter)TrafficHandler;

            return(thSplitter.OutputB == attacher.ParentHandler);
        }
예제 #2
0
        bool OutPortA_HandlerDetaching(TrafficHandlerPort sender, TrafficHandlerPort attacher)
        {
            if (sender != OutPortA)
            {
                throw new InvalidOperationException("The Out Port A detach event was signalled by another sender than the Out Port A. This is a serious internal error.");
            }

            ConditionalTrafficSplitter thSplitter = (ConditionalTrafficSplitter)TrafficHandler;

            if (attacher.PortType == PortType.Input)
            {
                if (thSplitter.OutputA == attacher.ParentHandler)
                {
                    thSplitter.OutputA = null;
                    return(true);
                }
                else
                {
                    throw new InvalidOperationException("The specified ports are not connected.");
                }
            }

            throw new InvalidOperationException("This port can only be used with input ports.");
        }
예제 #3
0
        bool thOutPortB_HandlerAttached(TrafficHandlerPort sender, TrafficHandlerPort attacher)
        {
            if (sender != OutPortB)
            {
                throw new InvalidOperationException("The Out Port B attach event was signalled by another sender than the Out Port B. This is a serious internal error.");
            }

            ConditionalTrafficSplitter thSplitter = (ConditionalTrafficSplitter)TrafficHandler;

            if (attacher.PortType == PortType.Input)
            {
                if (thSplitter.OutputB == null)
                {
                    thSplitter.OutputB = attacher.ParentHandler;
                    return(false);
                }
                else
                {
                    throw new InvalidOperationException("Another handler is already connected to this port.");
                }
            }

            throw new InvalidOperationException("This port can only be used with input ports.");
        }
예제 #4
0
 public ConditionalSplitterConfigurationLoader(TrafficHandler thHandler)
     : base(thHandler)
 {
     this.thHandler = (ConditionalTrafficSplitter)thHandler;
 }
 public ConditionalSplitterConfigurationWriter(TrafficHandler thToSave)
     : base(thToSave)
 {
     thHandler = (ConditionalTrafficSplitter)thToSave;
 }