当前位置: 首页>>代码示例>>C#>>正文


C# RequestContext.ChangeCefBrowser方法代码示例

本文整理汇总了C#中RequestContext.ChangeCefBrowser方法的典型用法代码示例。如果您正苦于以下问题:C# RequestContext.ChangeCefBrowser方法的具体用法?C# RequestContext.ChangeCefBrowser怎么用?C# RequestContext.ChangeCefBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RequestContext的用法示例。


在下文中一共展示了RequestContext.ChangeCefBrowser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessRequestInternal

 public async Task ProcessRequestInternal(RequestContext request)
 {
     bool flag;
     object json;
     object[] objArray;
     object[] objArray1;
     object[] argument;
     try
     {
         request.ChangeCefBrowser(this.browserWindow.CefBrowser);
         JsApiService.JsResponse jsResponse = new JsApiService.JsResponse(request.OnProgress);
         JsApiService.JsResponse jsResponse1 = new JsApiService.JsResponse(request.OnResult);
         MethodData method = this.api.GetMethod(request.Method);
         ParameterInfo[] parameters = method.Parameters;
         int length = (int)method.Parameters.Length;
         flag = (length < 1 ? false : parameters[0].ParameterType == typeof(JsApiService.JsResponse));
         bool flag1 = flag;
         switch (length)
         {
             case 0:
                 {
                     argument = new object[0];
                     break;
                 }
             case 1:
                 {
                     objArray = (flag1 ? new object[] { jsResponse1 } : new object[] { request.Argument });
                     argument = objArray;
                     break;
                 }
             case 2:
                 {
                     objArray1 = (flag1 ? new object[] { jsResponse, jsResponse1 } : new object[] { request.Argument, jsResponse1 });
                     argument = objArray1;
                     break;
                 }
             case 3:
                 {
                     argument = new object[] { request.Argument, jsResponse, jsResponse1 };
                     break;
                 }
             default:
                 {
                     throw new ArgumentException("Unknown number of parameters in microapi method.");
                 }
         }
         object obj = await this.api.InvokeAsync(request.Method, argument);
         object obj1 = obj;
         JsonResult jsonResult = obj1 as JsonResult;
         JsApiService.JsResponse jsResponse2 = jsResponse1;
         if (jsonResult != null)
         {
             json = jsonResult.Json;
         }
         else
         {
             json = obj1;
         }
         jsResponse2(json);
     }
     catch (MissingMethodException missingMethodException)
     {
         request.OnFault(new { Reason = "missing-method", Data = null });
     }
     catch (Exception exception)
     {
         Exception innerException = exception;
         TargetInvocationException targetInvocationException = innerException as TargetInvocationException;
         if (targetInvocationException != null)
         {
             innerException = targetInvocationException.InnerException;
         }
         string reason = null;
         object info = null;
         JsApiException jsApiException = innerException as JsApiException;
         if (jsApiException != null)
         {
             reason = jsApiException.Reason;
             info = jsApiException.Info;
         }
         InvocationException invocationException = innerException as InvocationException;
         if (invocationException != null)
         {
             PlatformException rootCause = invocationException.RootCause as PlatformException;
             if (rootCause != null)
             {
                 reason = rootCause.RootCauseClassname;
             }
         }
         string jsStyleClassName = reason;
         if (jsStyleClassName == null)
         {
             jsStyleClassName = WintermintApiHost.GetJsStyleClassName(innerException);
         }
         reason = jsStyleClassName;
         request.OnFault(new { Reason = reason, Data = info });
     }
     return;
     throw new ArgumentException("Unknown number of parameters in microapi method.");
 }
开发者ID:RevivalCoding,项目名称:Wintermint,代码行数:100,代码来源:WintermintApiHost.cs

示例2: ProcessRequestInternal

 public async Task ProcessRequestInternal(RequestContext request)
 {
   try
   {
     request.ChangeCefBrowser(this.browserWindow.CefBrowser);
     JsApiService.JsResponse onProgress = new JsApiService.JsResponse(request.OnProgress);
     JsApiService.JsResponse onResult = new JsApiService.JsResponse(request.OnResult);
     MethodData data = this.api.GetMethod(request.Method);
     ParameterInfo[] parameters = data.Parameters;
     int parameterCount = data.Parameters.Length;
     bool param1IsJsResponse = parameterCount >= 1 && parameters[0].ParameterType == typeof (JsApiService.JsResponse);
     object[] args;
     switch (parameterCount)
     {
       case 0:
         args = new object[0];
         break;
       case 1:
         object[] objArray1;
         if (!param1IsJsResponse)
           objArray1 = new object[1]
           {
             request.Argument
           };
         else
           objArray1 = new object[1]
           {
             (object) onResult
           };
         args = objArray1;
         break;
       case 2:
         object[] objArray2;
         if (!param1IsJsResponse)
           objArray2 = new object[2]
           {
             request.Argument,
             (object) onResult
           };
         else
           objArray2 = new object[2]
           {
             (object) onProgress,
             (object) onResult
           };
         args = objArray2;
         break;
       case 3:
         args = new object[3]
         {
           request.Argument,
           (object) onProgress,
           (object) onResult
         };
         break;
       default:
         throw new ArgumentException("Unknown number of parameters in microapi method.");
     }
     object result = await this.api.InvokeAsync(request.Method, args);
     JsonResult json = result as JsonResult;
     onResult(json != null ? (object) json.Json : result);
   }
   catch (MissingMethodException ex)
   {
     request.OnFault((object) new
     {
       Reason = "missing-method",
       Data = (object) null
     });
   }
   catch (Exception ex)
   {
     Exception exception = ex;
     TargetInvocationException invocationException1 = exception as TargetInvocationException;
     if (invocationException1 != null)
       exception = invocationException1.InnerException;
     string str = (string) null;
     object obj = (object) null;
     JsApiException jsApiException = exception as JsApiException;
     if (jsApiException != null)
     {
       str = jsApiException.Reason;
       obj = jsApiException.Info;
     }
     InvocationException invocationException2 = exception as InvocationException;
     if (invocationException2 != null)
     {
       PlatformException platformException = invocationException2.RootCause as PlatformException;
       if (platformException != null)
         str = platformException.RootCauseClassname;
     }
     request.OnFault((object) new
     {
       Reason = (str ?? WintermintApiHost.GetJsStyleClassName((object) exception)),
       Data = obj
     });
   }
 }
开发者ID:NitroXenon,项目名称:Wintermint-client,代码行数:98,代码来源:WintermintApiHost.cs


注:本文中的RequestContext.ChangeCefBrowser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。