示例#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);
        }
示例#2
0
        public SupervisorMonitoringChannel EndStartMonitoringSession(IAsyncResult result)
        {
            StartMonitoringProcessRequestAsyncResult asyncResult = result as StartMonitoringProcessRequestAsyncResult;

            if (asyncResult != null)
            {
                asyncResult.EndInvoke();
            }
            else
            {
                throw new Exception("Invalid async result");
            }

            return(asyncResult.SupervisorMonitoringChannel);
        }