Esempio n. 1
0
        /// <summary>
        /// 引发 <see cref="AfterRequest" /> 事件
        /// </summary>
        /// <param name="ea">包含此事件的参数</param>
        public virtual void OnAfterRequest(WebEventArgs ea)
        {
            var handler = AfterRequest;

            handler?.Invoke(this, ea);
            GlobalEvents.OnAfterRequest(this, ea);
        }
Esempio n. 2
0
        /// <summary>
        /// 引发 <see cref="HttpContextCreated" /> 事件
        /// </summary>
        /// <param name="ea">包含此事件的参数</param>
        public virtual void OnHttpContextCreated(WebEventArgs ea)
        {
            var handler = HttpContextCreated;

            handler?.Invoke(this, ea);
            GlobalEvents.OnHttpContextCreated(this, ea);
        }
Esempio n. 3
0
        /// <summary>
        /// 引发 <see cref="RequestSuccess" /> 事件
        /// </summary>
        /// <param name="ea">包含此事件的参数</param>
        public virtual void OnRequestSuccess(WebEventArgs ea)
        {
            var handler = RequestSuccess;

            handler?.Invoke(this, ea);
            GlobalEvents.OnRequestSuccess(this, ea);
            Debug.WriteLine("网络请求成功,地址=" + ea.Request.Uri);
        }
Esempio n. 4
0
        /// <summary>
        /// 引发 <see cref="RequestFailed" /> 事件
        /// </summary>
        /// <param name="ea">包含此事件的参数</param>
        public virtual void OnRequestEnd(WebEventArgs ea)
        {
            var handler = RequestEnd;

            GlobalEvents.OnRequestEnd(this, ea);
            handler?.Invoke(this, ea);
            Debug.WriteLine("网络请求已完成,地址=" + ea.Request.Uri);
        }
        /// <summary>
        /// 引发 <see cref="RequestCancelled" /> 事件
        /// </summary>
        /// <param name="sender">引发此事件的源对象</param>
        /// <param name="ea">包含此事件的参数</param>
        internal static void OnRequestCancelled(object sender, WebEventArgs ea)
        {
            var handler = RequestCancelled;

            if (handler != null)
            {
                handler(sender, ea);
            }
        }
        /// <summary>
        /// 引发 <see cref="BeforeRequest" /> 事件
        /// </summary>
        /// <param name="sender">引发此事件的源对象</param>
        /// <param name="ea">包含此事件的参数</param>
        internal static void OnBeforeRequest(object sender, WebEventArgs ea)
        {
            var handler = BeforeRequest;

            if (handler != null)
            {
                handler(sender, ea);
            }
        }
        /// <summary>
        /// 引发 <see cref="HttpContextCreated" /> 事件
        /// </summary>
        /// <param name="sender">引发此事件的源对象</param>
        /// <param name="ea">包含此事件的参数</param>
        internal static void OnHttpContextCreated(object sender, WebEventArgs ea)
        {
            var handler = HttpContextCreated;

            if (handler != null)
            {
                handler(sender, ea);
            }
        }
        /// <summary>
        /// 引发 <see cref="RequestSuccess" /> 事件
        /// </summary>
        /// <param name="sender">引发此事件的源对象</param>
        /// <param name="ea">包含此事件的参数</param>
        internal static void OnRequestSuccess(object sender, WebEventArgs ea)
        {
            var handler = RequestSuccess;

            if (handler != null)
            {
                handler(sender, ea);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 引发 <see cref="BeforeRequest" /> 事件
        /// </summary>
        /// <param name="ea">包含此事件的参数</param>
        public virtual void OnBeforeRequest(WebEventArgs ea)
        {
            var handler = BeforeRequest;

            Debug.WriteLine("即将发起网络请求,源地址=" + ea.Request.Uri + ",提交数据=" + (ea.Request.RequestData == null ? "(null)" : ea.Request.RequestData.ToString()));

            handler?.Invoke(this, ea);
            GlobalEvents.OnBeforeRequest(this, ea);
        }
Esempio n. 10
0
 public virtual void OnBeforeRequest(WebEventArgs e)
 {
     BeforeRequest?.Invoke(e.Context, e);
 }
Esempio n. 11
0
 public virtual void OnRequestCreated(WebEventArgs e)
 {
     RequestCreated?.Invoke(this, e);
 }
Esempio n. 12
0
 public virtual void OnPerformanceObjectCreated(WebEventArgs e)
 {
     PerformanceObjectCreated?.Invoke(this, e);
 }
Esempio n. 13
0
 public virtual void OnDetectResponseContentType(WebEventArgs e)
 {
     DetectResponseContentType?.Invoke(this, e);
 }
Esempio n. 14
0
 public virtual void OnPreviewResponseHeader(WebEventArgs e)
 {
     PreviewResponseHeader?.Invoke(e.Context, e);
 }
Esempio n. 15
0
 public virtual void OnRequestCancelled(WebEventArgs e) => RequestCancelled?.Invoke(this, e);
Esempio n. 16
0
 /// <summary>
 /// 引发 <see cref="HttpHandler.ResponseContentObjectInitialized"/> 事件
 /// </summary>
 public virtual void OnResponseContentObjectInitialized(WebEventArgs e) => ResponseContentObjectInitialized?.Invoke(e.Context, e);
Esempio n. 17
0
 public virtual void OnResponseDataReceiveCompleted(WebEventArgs e)
 {
     ResponseDataReceiveCompleted?.Invoke(e.Context, e);
 }
Esempio n. 18
0
 public virtual void OnRequestDataSent(WebEventArgs e)
 {
     RequestDataSent?.Invoke(this, e);
 }
Esempio n. 19
0
 public virtual void OnRequestFinished(WebEventArgs e)
 {
     RequestFinished?.Invoke(e.Context, e);
 }
Esempio n. 20
0
 public virtual void OnRequestValidateResponse(WebEventArgs e)
 {
     RequestValidateResponse?.Invoke(e.Context, e);
 }
Esempio n. 21
0
 /// <summary>
 /// 引发 <see cref="HttpHandler.StateChanged" /> 事件
 /// </summary>
 public virtual void OnStateChanged(WebEventArgs e) => StateChanged?.Invoke(this, e);
Esempio n. 22
0
 public virtual void OnRequestDataPrepared(WebEventArgs e) => RequestDataPrepared?.Invoke(this, e);
Esempio n. 23
0
 public virtual void OnRequestDataSending(WebEventArgs e)
 {
     RequestDataSending?.Invoke(e.Context, e);
 }
Esempio n. 24
0
 public virtual void OnRequestStreamFetched(WebEventArgs e)
 {
     RequestStreamFetched?.Invoke(e.Context, e);
 }
Esempio n. 25
0
 /// <summary>
 /// 验证响应头。在这里抛出的异常将会导致请求被设置为失败。
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnValidateResponseHeader(WebEventArgs e)
 {
     ValidateResponseHeader?.Invoke(e.Context, e);
 }
Esempio n. 26
0
 public virtual void OnRequestSent(WebEventArgs e)
 {
     RequestSent?.Invoke(e.Context, e);
 }
Esempio n. 27
0
 public virtual void OnResponseHeaderReceived(WebEventArgs e)
 {
     ResponseHeaderReceived?.Invoke(e.Context, e);
 }
Esempio n. 28
0
        /// <summary>
        /// 引发 <see cref="HttpHandler.HttpContextCreated.HttpContextCreated" /> 事件
        /// </summary>
        /// <param name="ea">包含此事件的参数</param>
        public virtual void OnHttpContextCreated(WebEventArgs ea)
        {
            var handler = HttpContextCreated;

            handler?.Invoke(ea.Context, ea);
        }