/// <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); } } }
/// <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); } } }
/// <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); } } }
/// <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); } } }