Пример #1
0
 public Browser(BrowserSettings browserSettings)
 {
     _browserSettings = browserSettings;
     var preferences = new WebPreferences();
     if (browserSettings.Proxy?.Length > 0) {
         preferences.ProxyConfig = browserSettings.Proxy;
     }
     WebCore.DoWork(() => {
         _session = WebCore.CreateWebSession(preferences);
         return default(int);
     });
 }
Пример #2
0
 public BrowserWrapper(WebRequestHelper webRequestHelper, string proxy)
     : base(webRequestHelper)
 {
     _browserSender = BrowserCreator.BuildBrowser(_browserSettings = new BrowserSettings {
         WindowHeight = 1080,
         WindowWidth = 1920,
         Proxy = proxy
     });
     _currentTabs = new SimpleKangooCache<string, BrowserTab>(s => {
         var tab = _browserSender.GetNewTab();
         tab.OpenPage(s);
         return tab;
     });
 }
Пример #3
0
 internal BrowserTab(BrowserSettings browserSettings, WebSession session)
 {
     WebCore.DoWork(() => {
         _webView = WebCore.CreateWebView(browserSettings.WindowWidth, browserSettings.WindowHeight, session, WebViewType.Offscreen);
         return default(int);
     });
     _reloadThread = new Thread(() => {
         while (true) {
             Thread.Sleep(TimeSpan.FromHours(1));
             WebCore.QueueWork(() => {
                 _webView.Reload(true);
             });
         }
     });
     _reloadThread.Start();
 }
Пример #4
0
 public static Browser BuildBrowser(BrowserSettings browserSettings)
 {
     return new Browser(browserSettings);
 }