Beispiel #1
0
        public IAsyncResult BeginStartMonitoringSession(Uri uri,
                                                        AsyncCallback userCallback, object state)
        {
            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.StartMonitoring);

            request.startmonitoringsession = new startmonitoringsessionType
            {
                uri       = uri.ToString(),
                sessionId = Guid.NewGuid().ToString()
            };


            SupervisorMonitoringChannel monitoringChannel = new SupervisorMonitoringChannel(this, request.startmonitoringsession.sessionId);

            _monitoringChannel = monitoringChannel;

            ProcessRequestAsyncResult requestAsyncResult =
                new StartMonitoringProcessRequestAsyncResult(monitoringChannel, request, _requestProcessor,
                                                             userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return(requestAsyncResult);
        }
Beispiel #2
0
        public IAsyncResult BeginStopMonitoringSession(
            AsyncCallback userCallback, object state)
        {
            SupervisorMonitoringChannel monitoringChannel = _monitoringChannel;

            if (monitoringChannel == null)
            {
                AsyncResultNoResult result = new AsyncResultNoResult(userCallback, state);
                result.SetAsCompleted(null, true);
                return(result);
            }
            _monitoringChannel = null;

            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.StopMonitoring);

            request.terminatemonitoringsession           = new terminatemonitoringsessionType();
            request.terminatemonitoringsession.sessionId = monitoringChannel.SessionId;

            ProcessRequestAsyncResult requestAsyncResult =
                new ProcessRequestAsyncResult(request, _requestProcessor, Conversation, ApplicationId,
                                              userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return(requestAsyncResult);
        }
 public StartMonitoringProcessRequestAsyncResult(SupervisorMonitoringChannel monitoringChannel,
                                                 requestType request,
                                                 RequestProcessor requestProcessor,
                                                 AsyncCallback userCallback, object state)
     : base(request, requestProcessor, monitoringChannel.SupervisorDashboardChannel.Conversation,
            monitoringChannel.SupervisorDashboardChannel.ApplicationId, userCallback, state)
 {
     SupervisorMonitoringChannel = monitoringChannel;
 }
Beispiel #4
0
        private void ProcessResponse(responseType response)
        {
            SupervisorMonitoringChannel monitoringChannel = _monitoringChannel;

            if (!string.IsNullOrEmpty(response.sessionId) &&
                monitoringChannel != null &&
                response.sessionId.Equals(monitoringChannel.SessionId))
            {
                monitoringChannel.ProcessResponse(response);
            }
            else
            {
                _requestProcessor.ProcessResponse(response);
            }
        }
Beispiel #5
0
        private void ProcessNotification(notificationType notification)
        {
            SupervisorMonitoringChannel monitoringChannel = _monitoringChannel;

            if (!string.IsNullOrEmpty(notification.sessionId) &&
                monitoringChannel != null &&
                notification.sessionId.Equals(monitoringChannel.SessionId))
            {
                monitoringChannel.ProcessNotification(notification);
            }
            else
            {
                if (notification.agentinfos.Length > 0 || notification.agentsremoved.Length > 0)
                {
                    lock (_agents)
                    {
                        foreach (agentType notificationAgentinfo in notification.agentinfos)
                        {
                            _agents[notificationAgentinfo.uri] = notificationAgentinfo;
                        }

                        foreach (string uri in notification.agentsremoved)
                        {
                            _agents.Remove(uri);
                        }

                        AgentsChangedEventArgs e = new AgentsChangedEventArgs(notification.agentinfos, notification.agentsremoved);

                        EventHandler <AgentsChangedEventArgs> agentsChangedHandler = AgentsChanged;

                        if (agentsChangedHandler != null)
                        {
                            agentsChangedHandler(this, e);
                        }
                    }
                }
            }
        }
Beispiel #6
0
 public MonitoredEventArgs(SupervisorMonitoringChannel monitoringChannel)
 {
     MonitoringChannel = monitoringChannel;
 }