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