void InitNotification(SoapClientMessage clientMessage) { if (clientMessage.Client is IProxyProgressExtension) { IProxyProgressExtension proxy = clientMessage.Client as IProxyProgressExtension; m_requestGuid = proxy.RequestGuid; GetContentLength(clientMessage, proxy); m_progressCallback = proxy.Callback; } }
/// <summary> /// Store the size of data to be processed. /// The way to obtain the size differs depending on whether we are sending or receiving data. /// * When we are reading from the web server, the web server reports the size in through the web response. /// * When we are sending data our stream has the size to be sent. /// </summary> /// <param name="clientMessage"></param> /// <param name="proxy"></param> void GetContentLength(SoapClientMessage clientMessage, IProxyProgressExtension proxy) { if (clientMessage.Stage == SoapMessageStage.BeforeDeserialize) { m_totalSize = proxy.ResponseContentLength; } else if (clientMessage.Stage == SoapMessageStage.AfterSerialize) { m_totalSize = clientMessage.Stream.Length; } else { m_totalSize = TotalSizeUnknown; } }