Example #1
0
        /// <summary>
        /// Queues an action.
        /// </summary>
        private void QueueStackAction(StackAction action)
        {
            System.ServiceModel.OperationContext context = System.ServiceModel.OperationContext.Current;

            if (context != null)
            {
                IStackControl control = context.Channel.GetProperty <IStackControl>();

                if (control != null)
                {
                    control.QueueAction(action);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Sets the event sink for the current channel.
        /// </summary>
        private void SetEventSink()
        {
            System.ServiceModel.OperationContext context = System.ServiceModel.OperationContext.Current;

            if (context != null)
            {
                IStackControl control = context.Channel.GetProperty <IStackControl>();

                if (control != null)
                {
                    control.SetEventSink(this);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Queues an action.
        /// </summary>
        private void QueueStackAction(SessionClient session, StackAction action)
        {
            System.ServiceModel.ClientBase <ISessionChannel> channel = session.InnerChannel as System.ServiceModel.ClientBase <ISessionChannel>;

            if (channel != null)
            {
                IStackControl control = channel.InnerChannel.GetProperty <IStackControl>();

                if (control != null)
                {
                    control.QueueAction(action);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Sets the event sink for the current channel.
        /// </summary>
        private void InterruptListener(int duration)
        {
            System.ServiceModel.OperationContext context = System.ServiceModel.OperationContext.Current;

            if (context != null)
            {
                IStackControl control = context.EndpointDispatcher.ChannelDispatcher.Listener.GetProperty <IStackControl>();

                if (control != null)
                {
                    StackAction action = new StackAction();

                    action.ActionType = StackActionType.CloseListeningSocket;
                    action.Duration   = duration;

                    control.QueueAction(action);
                }
            }
        }