Exemplo n.º 1
0
 internal StartMonitoringSessionAsyncResult(MonitoringChannel channel, Agent agentToMonitor, AcdSupervisorSession session, AsyncCallback userCallback, object state)
     : base(userCallback, state)
 {
     _session        = session;
     _agentToMonitor = agentToMonitor;
     _channel        = channel;
 }
Exemplo n.º 2
0
        internal IAsyncResult BeginStartMonitoringSession(MonitoringChannel channel, Agent agentToMonitor, AsyncCallback userCallback, object state)
        {
            StartMonitoringSessionAsyncResult asyncResult = new StartMonitoringSessionAsyncResult(channel, agentToMonitor, this, userCallback, state);

            bool Process = false;

            lock (_syncRoot)
            {
                if (_state == SupervisorSessionState.GeneralAgentActivityTracking)
                {
                    this.UpdateState(SupervisorSessionState.JoiningCustomerSession);
                    Process = true;
                }
                else
                {
                    throw new InvalidOperationException("AcdSupervisorSession is not in the correct state to start monitoring an agent");
                }
            }

            if (Process)
            {
                ThreadPool.QueueUserWorkItem((waitState) =>
                {
                    var tempAr = waitState as StartMonitoringSessionAsyncResult;
                    tempAr.Process();
                }, asyncResult);
            }
            return(asyncResult);
        }
Exemplo n.º 3
0
        private void ProcessRequest(requestType request)
        {
            Debug.Assert(request != null);

            ContextChannelRequestReceivedEventArgs eventArgs = null;
            ContextChannelRequest contextChannelRequest      = null;

            MonitoringChannel mChannel = m_monitoringChannel;

            if (!string.IsNullOrEmpty(request.sessionId) &&
                mChannel != null &&
                mChannel.Id.Equals(request.sessionId, StringComparison.OrdinalIgnoreCase))
            {
                mChannel.ProcessRequest(request);
            }
            else
            {
                if (request.startmonitoringsession != null)
                {
                    m_monitoringChannel = new MonitoringChannel(request.startmonitoringsession.sessionId,
                                                                new Uri(request.startmonitoringsession.uri), this);

                    contextChannelRequest = new MonitoringRequest(request, ContextChannelRequestType.StartMonitoring, m_monitoringChannel);
                }
                else if (request.terminatemonitoringsession != null)
                {
                    MonitoringChannel monitoringChannel = m_monitoringChannel;

                    if (monitoringChannel != null &&
                        String.Equals(request.terminatemonitoringsession.sessionId, monitoringChannel.Id, StringComparison.OrdinalIgnoreCase))
                    {
                        contextChannelRequest = new MonitoringRequest(request, ContextChannelRequestType.StopMonitoring, monitoringChannel);
                    }
                }
                else
                {
                    //TODO:Log and ignore
                }

                if (contextChannelRequest != null)
                {
                    eventArgs = new ContextChannelRequestReceivedEventArgs(contextChannelRequest.RequestType, contextChannelRequest);

                    EventHandler <ContextChannelRequestReceivedEventArgs> eventHandler = this.RequestReceived;
                    if (eventHandler != null)
                    {
                        eventHandler.Invoke(this, eventArgs);
                    }
                }
            }
        }
Exemplo n.º 4
0
 internal MonitoringRequest(requestType request, ContextChannelRequestType requestType, MonitoringChannel monitoringChannel)
     : base(request, requestType, monitoringChannel.SupervisorContextChannel.InnerChannel)
 {
     m_monitoringChannel = monitoringChannel;
 }