示例#1
0
 private void Load(string address)
 {
     if (address != DefaultLocalUrl)
     {
         htmlToLoad = null;
     }
     if (address.Contains(Uri.SchemeDelimiter) || address == "about:blank" || address.StartsWith("data:"))
     {
         if (CustomSchemes.Any(s => address.StartsWith(s + Uri.SchemeDelimiter)))
         {
             // custom schemes -> turn off security ... to enable full access without problems to local resources
             IsSecurityDisabled = true;
         }
         else
         {
             IsSecurityDisabled = false;
         }
         // must wait for the browser to be initialized otherwise navigation will be aborted
         ExecuteWhenInitialized(() => chromium.Load(address));
     }
     else
     {
         var userAssembly = GetUserCallingMethod().ReflectedType.Assembly;
         Load(new ResourceUrl(userAssembly, address).WithDomain(CurrentDomainId));
     }
 }
示例#2
0
文件: WebView.cs 项目: wuzlai/WebView
 public void LoadUrl(string address, string frameName)
 {
     if (frameName == MainFrameName && address != DefaultLocalUrl)
     {
         htmlToLoad = null;
     }
     if (address.Contains(Uri.SchemeDelimiter) || address == AboutBlankUrl || address.StartsWith("data:"))
     {
         if (frameName == MainFrameName)
         {
             ExecuteWhenInitialized(() => chromium.Load(address));
         }
         else
         {
             GetFrame(frameName)?.LoadUrl(address);
         }
     }
     else
     {
         var userAssembly = GetUserCallingMethod().ReflectedType.Assembly;
         LoadUrl(new ResourceUrl(userAssembly, address).WithDomain(CurrentDomainId), frameName);
     }
 }