• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IBrowser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IBrowser的典型用法代码示例。如果您正苦于以下问题:C# IBrowser类的具体用法?C# IBrowser怎么用?C# IBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IBrowser类属于命名空间,在下文中一共展示了IBrowser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Form

        void IDisplayHandler.OnFullscreenModeChange(IWebBrowser browserControl, IBrowser browser, bool fullscreen)
        {
            var chromiumWebBrowser = (ChromiumWebBrowser)browserControl;

            chromiumWebBrowser.InvokeOnUiThreadIfRequired(() =>
            {
                if (fullscreen)
                {
                    parent = chromiumWebBrowser.Parent;

                    parent.Controls.Remove(chromiumWebBrowser);

                    fullScreenForm = new Form();
                    fullScreenForm.FormBorderStyle = FormBorderStyle.None;
                    fullScreenForm.WindowState = FormWindowState.Maximized;

                    fullScreenForm.Controls.Add(chromiumWebBrowser);

                    fullScreenForm.ShowDialog(parent.FindForm());
                }
                else
                {
                    fullScreenForm.Controls.Remove(chromiumWebBrowser);

                    parent.Controls.Add(chromiumWebBrowser);

                    fullScreenForm.Close();
                    fullScreenForm.Dispose();
                    fullScreenForm = null;
                }
            });
        }
开发者ID:Creo1402,项目名称:CefSharp,代码行数:32,代码来源:DisplayHandler.cs


示例2: PageNavigationSteps

	    /// <summary>
	    /// Initializes a new instance of the <see cref="PageNavigationSteps" /> class.
	    /// </summary>
	    /// <param name="browser">The browser.</param>
	    /// <param name="pageMapper">The page mapper.</param>
	    /// <param name="scenarioContext">The scenario context.</param>
	    /// <param name="actionPipelineService">The action pipeline service.</param>
	    public PageNavigationSteps(IBrowser browser, IPageMapper pageMapper, IScenarioContextHelper scenarioContext, IActionPipelineService actionPipelineService)
            : base(scenarioContext)
		{
			this.browser = browser;
			this.pageMapper = pageMapper;
			this.actionPipelineService = actionPipelineService;
		}
开发者ID:kristerbone,项目名称:specbind,代码行数:14,代码来源:PageNavigationSteps.cs


示例3: OnJSDialog

 public bool OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, string acceptLang, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage)
 {
     switch (dialogType)
     {
         case CefJsDialogType.Alert:
             MessageBox.Show(messageText);
             suppressMessage = true;
             return false;
         case CefJsDialogType.Confirm:
             var dr = MessageBox.Show(messageText, "提示", MessageBoxButton.YesNo);
             if (dr == MessageBoxResult.Yes)
                 callback.Continue(true);
             else
                 callback.Continue(false);
             suppressMessage = false;
             return true;
         case CefJsDialogType.Prompt:
             MessageBox.Show("系统不支持prompt形式的提示框", "UTMP系统提示");
             break;
     }
     //如果suppressMessage被设置为true,并且函数返回值为false,将阻止页面打开JS的弹出窗口。
     //如果suppressMessage被设置为false,并且函数返回值也是false,页面将会打开这个JS弹出窗口。
     suppressMessage = true;
     return false;
 }
开发者ID:MagicWang,项目名称:WYJ,代码行数:25,代码来源:Window3.xaml.cs


示例4: FrameLoadStartEventArgs

 public FrameLoadStartEventArgs(IBrowser browser, IFrame frame)
 {
     Browser = browser;
     Frame = frame;
     Url = frame.Url;
     IsMainFrame = frame.IsMain;
 }
开发者ID:bjarteskogoy,项目名称:CefSharp,代码行数:7,代码来源:FrameLoadStartEventArgs.cs


示例5: using

        bool IGeolocationHandler.OnRequestGeolocationPermission(IWebBrowser browserControl, IBrowser browser, string requestingUrl, int requestId, IGeolocationCallback callback)
        {
            //You can execute the callback inline
            //callback.Continue(true);
            //return true;

            //You can execute the callback in an `async` fashion
            //Open a message box on the `UI` thread and ask for user input.
            //You can open a form, or do whatever you like, just make sure you either
            //execute the callback or call `Dispose` as it's an `unmanaged` wrapper.
            var chromiumWebBrowser = (ChromiumWebBrowser)browserControl;
            chromiumWebBrowser.Dispatcher.BeginInvoke((Action)(() =>
            {
                //Callback wraps an unmanaged resource, so we'll make sure it's Disposed (calling Continue will also Dipose of the callback, it's safe to dispose multiple times).
                using (callback)
                {
                    var result = MessageBox.Show(String.Format("{0} wants to use your computer's location.  Allow?  ** You must set your Google API key in CefExample.Init() for this to work. **", requestingUrl), "Geolocation", MessageBoxButton.YesNo);

                    //Execute the callback, to allow/deny the request.
                    callback.Continue(result == MessageBoxResult.Yes);
                }
            }));

            //Yes we'd like to hadle this request ourselves.
            return true;
        }
开发者ID:xeronith,项目名称:CefSharp,代码行数:26,代码来源:GeolocationHandler.cs


示例6:

 bool ILifeSpanHandler.DoClose(IWebBrowser browserControl, IBrowser browser)
 {
     //The default CEF behaviour (return false) will send a OS close notification (e.g. WM_CLOSE).
     //See the doc for this method for full details.
     //return true here to handle closing yourself (no WM_CLOSE will be sent).
     return true;
 }
开发者ID:intuilab,项目名称:CefSharp,代码行数:7,代码来源:LifeSpanHandler.cs


示例7: OnKeyEvent

 /// <inheritdoc/>>
 public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey)
 {
     bool result = false;
     Debug.WriteLine(String.Format("OnKeyEvent: KeyType: {0} 0x{1:X} Modifiers: {2}", type, windowsKeyCode, modifiers));
     // TODO: Handle MessageNeeded cases here somehow.
     return result;
 }
开发者ID:klkn,项目名称:CefSharp,代码行数:8,代码来源:KeyboardHandler.cs


示例8: NewTabEventArgs

 bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
 {
     newBrowser = null;
     //browserControl.Load(targetUrl);
     OpenInNewTab?.Invoke(this, new NewTabEventArgs(targetUrl)); //this breaks when there are multiple window.open calls from JS.
     return true;
 }
开发者ID:joe-williams-cccu,项目名称:OSIRTv2,代码行数:7,代码来源:LifespanHandler.cs


示例9: AddChar

 public void AddChar(IBrowser browser, char chr)
 {
     char newChar = Char.ToLower(chr);
     curString += newChar;
     IBrowserItem cur = browser.Cursor;
     if (cur.State.HasFlag(BrowserItemState.UnMarkable) == false && cur.showName.ToLower().StartsWith(curString)) return;
     List<IBrowserItem> items = browser.Items;
     foreach (IBrowserItem item in items)
     {
         if (item.State.HasFlag(BrowserItemState.UnMarkable) == false && item.showName.ToLower().StartsWith(curString))
         {
             browser.SelectItem(item);
             return;
         }
     }
     curString = new string(newChar, 1);
     foreach (IBrowserItem item in items)
     {
         if (item.State.HasFlag(BrowserItemState.UnMarkable) == false && item.showName.ToLower().StartsWith(curString))
         {
             browser.SelectItem(item);
             return;
         }
     }
     curString = "";
 }
开发者ID:blmarket,项目名称:filehatchery,代码行数:26,代码来源:StupidSearcher.cs


示例10: GetResourceHandler

        public IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request)
        {
            // Every time we request the main GPM page allow another JS injection
            if (Regex.Match(request.Url, @"^http[s]?://play\.google\.com/music/listen", RegexOptions.IgnoreCase).Success)
            {
                firstJSOnly = true;
            }
            if (Regex.Match(request.Url, @"\.js", RegexOptions.IgnoreCase).Success && Regex.Match(request.Url, @"http", RegexOptions.IgnoreCase).Success && firstJSOnly)
            {
                firstJSOnly = false;
                using (WebClient webClient = new WebClient())
                {
                    // These are the JS files to inject into GPM
                    string custom_interface = Properties.Resources.custom_interface;

                    return ResourceHandler.FromStream(new MemoryStream(Encoding.UTF8.GetBytes(
                        webClient.DownloadString(request.Url) + ";window.onload=function(){csharpinterface.showApp();};document.addEventListener('DOMContentLoaded', function () {" +
                            "window.OBSERVER = setInterval(function() { if (document.getElementById('material-vslider')) { clearInterval(window.OBSERVER); " +
                            Properties.Resources.gmusic_min + Properties.Resources.gmusic_theme_min + Properties.Resources.gmusic_mini_player_min +
                            this.getInitCode() +
                            custom_interface +
                        "}}, 10);});")), webClient.ResponseHeaders["Content-Type"]);
                }
            }
            return null;
        }
开发者ID:ananthonline,项目名称:Google-Play-Music-Desktop-Player-UNOFFICIAL-,代码行数:26,代码来源:ResourceHandlerFactory.cs


示例11: Uri

        CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame,
            IRequest request, IRequestCallback callback) {
            if (CommonUrls.IsWithSixUrl(request.Url)) {
                var headers = request.Headers;
                headers[Common.ClientHeader] = DomainEvilGlobal.SecretData.UserInfo.ClientId.ToString();
                headers[Common.ClientHeaderV] = Common.App.ProductVersion;
                request.Headers = headers;
            }

            return CefReturnValue.Continue;
            //Example of how to set Referer
            // Same should work when setting any header
            // For this example only set Referer when using our custom scheme
            var url = new Uri(request.Url);
            if (url.Scheme == "customscheme") // CefSharpSchemeHandlerFactory.SchemeName
            {
                var headers = request.Headers;
                headers["Referer"] = "http://google.com";

                request.Headers = headers;
            }

            //NOTE: If you do not wish to implement this method returning false is the default behaviour
            // We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.
            //callback.Dispose();
            //return false;

            //NOTE: When executing the callback in an async fashion need to check to see if it's disposed
            if (!callback.IsDisposed) {
                using (callback) {
                    if (request.Method == "POST") {
                        using (var postData = request.PostData) {
                            if (postData != null) {
                                var elements = postData.Elements;

                                var charSet = request.GetCharSet();

                                foreach (var element in elements) {
                                    if (element.Type == PostDataElementType.Bytes) {
                                        var body = element.GetBody(charSet);
                                    }
                                }
                            }
                        }
                    }

                    //Note to Redirect simply set the request Url
                    //if (request.Url.StartsWith("https://www.google.com", StringComparison.OrdinalIgnoreCase))
                    //{
                    //    request.Url = "https://github.com/";
                    //}

                    //Callback in async fashion
                    //callback.Continue(true);
                    //return CefReturnValue.ContinueAsync;
                }
            }

            return CefReturnValue.Continue;
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:60,代码来源:SixWebControlBehavior.cs


示例12: using

        CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback)
        {
            using (callback)
            {
                if (request.Method == "POST")
                {
                    using (var postData = request.PostData)
                    {
                        var elements = postData.Elements;

                        var charSet = request.GetCharSet();

                        foreach (var element in elements)
                        {
                            if (element.Type == PostDataElementType.Bytes)
                            {
                                var body = element.GetBody(charSet);
                            }
                        }
                    }
                }

                //Note to Redirect simply set the request Url
                //if (request.Url.StartsWith("https://www.google.com", StringComparison.OrdinalIgnoreCase))
                //{
                //    request.Url = "https://github.com/";
                //}

                //Callback in async fashion
                //callback.Continue(true);
                //return CefReturnValue.ContinueAsync;
            }
            
            return CefReturnValue.Continue;
        }
开发者ID:bjarteskogoy,项目名称:CefSharp,代码行数:35,代码来源:RequestHandler.cs


示例13: OpenInSystemBrowser

 bool IRequestHandler.OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request,
     bool isRedirect) {
     if (!frame.IsMain || CommonUrls.IsWithSixUrl(request.Url) || IsAuthUrl(new Uri(request.Url)))
         return false;
     OpenInSystemBrowser(request.Url);
     return true;
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:7,代码来源:SixWebControlBehavior.cs


示例14: GetResourceHandler

        public IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request)
        {
            // Every time we request the main GPM page allow another JS injection
            if (Regex.Match(request.Url, @"^http[s]?://play\.google\.com/music/listen", RegexOptions.IgnoreCase).Success)
            {
                firstJSOnly = true;
            }
            if (Regex.Match(request.Url, @"\.js", RegexOptions.IgnoreCase).Success && Regex.Match(request.Url, @"http", RegexOptions.IgnoreCase).Success && firstJSOnly)
            {
                firstJSOnly = false;
                using (WebClient webClient = new WebClient())
                {
                    // These are the JS files to inject into GPM
                    string dark_theme = Google_Play_Music.Properties.Resources.dark_theme;
                    string custom_interface = Google_Play_Music.Properties.Resources.custom_interface;
                    string mini_player = Google_Play_Music.Properties.Resources.mini_player;

                    Color c = Properties.Settings.Default.CustomColor;
                    string RGB = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
                    string custom_color = ";(function() {window.CustomColor = '" + RGB + "';})();";

                    bool controlsOnHover = Properties.Settings.Default.HoverControls;
                    string controlsOnHoverJS = ";(function() {window.hoverControls = " + controlsOnHover.ToString().ToLower() + ";})();";

                    string setInitialZoomJS = ";(function() {csharpinterface.setInitialZoom();})();";

                    return ResourceHandler.FromStream(new MemoryStream(Encoding.UTF8.GetBytes(webClient.DownloadString(request.Url) + ";" + custom_color + controlsOnHoverJS + setInitialZoomJS + dark_theme + custom_interface + mini_player)), webClient.ResponseHeaders["Content-Type"]);
                }
            }
            return null;
        }
开发者ID:hj3938,项目名称:Google-Play-Music-Desktop-Player-UNOFFICIAL-,代码行数:31,代码来源:ResourceHandlerFactory.cs


示例15:

 void IContextMenuHandler.OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
 {
     //Removing existing menu item
     model.Remove(CefMenuCommand.ViewSource); // Remove "View Source" option
     model.Remove(CefMenuCommand.Print);
     //Add new custom menu items
     model.AddItem((CefMenuCommand)ViewSource, "View Page Source");
     if (parameters.TypeFlags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents)
     {
         if(OsirtHelper.HasJpegExtension(parameters.SourceUrl))
         {
             model.AddItem((CefMenuCommand)ViewImageExifData, "View image EXIF data");
         }
         model.AddItem((CefMenuCommand)MenuSaveImage, "Save image");
         model.AddItem((CefMenuCommand)CopyImgLocation, "Copy image location to clipboard");
         model.AddItem((CefMenuCommand)ReverseImageSearch, "Reverse image search using TinEye");
     }
     if(OsirtHelper.IsOnYouTube(browserControl.Address))
     {
         model.AddItem((CefMenuCommand)SaveYouTubeVideo, "Extract YouTube video");
     }
     if (OsirtHelper.IsOnFacebook(browserControl.Address))
     {
         model.AddItem((CefMenuCommand)ViewFacebookId, "Show Facebook profile ID");
     }
     if(!string.IsNullOrEmpty(parameters.UnfilteredLinkUrl))
     {
         model.AddItem((CefMenuCommand)26501, "Open link in new tab");
     }
 }
开发者ID:joe-williams-cccu,项目名称:OSIRTv2,代码行数:30,代码来源:MenuHandler.cs


示例16: MemoryHtmlPage

        /// <summary>
        /// Initializes a new instance of the <see cref="MemoryHtmlPage"/> class.
        /// </summary>
        /// <param name="browser">
        /// The browser.
        /// </param>
        /// <param name="html">
        /// The HTML.
        /// </param>
        /// <exception cref="ArgumentNullException">The <paramref name="browser"/> parameter is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">The <paramref name="html"/> parameter is <c>null</c>, empty or only contains white space.</exception>
        public MemoryHtmlPage(IBrowser browser, string html)
        {
            if (browser == null)
            {
                throw new ArgumentNullException("browser");
            }

            if (string.IsNullOrWhiteSpace(html))
            {
                throw new ArgumentException(Resources.HtmlPage_NoHtmlContentProvided, "html");
            }

            IEnumerable<HttpOutcome> outcomes = new List<HttpOutcome>
            {
                new HttpOutcome(_targetLocation, HttpMethod.Get, HttpStatusCode.OK, "OK", TimeSpan.FromMilliseconds(5))
            };
            var result = new HttpResult(outcomes);

            Initialize(browser, HttpStatusCode.OK, "OK", result);

            using (var reader = new StringReader(html))
            {
                SetContent(reader);
            }
        }
开发者ID:roryprimrose,项目名称:Headless,代码行数:36,代码来源:MemoryHtmlPage.cs


示例17: FrameLoadEndEventArgs

 public FrameLoadEndEventArgs(IBrowser browser, IFrame frame, int httpStatusCode)
 {
     Browser = browser;
     Frame = frame;
     Url = frame.Url;
     HttpStatusCode = httpStatusCode;
 }
开发者ID:ithanshui,项目名称:CefSharp,代码行数:7,代码来源:FrameLoadEndEventArgs.cs


示例18: OnBeforeDownload

        public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed) {
                using (callback) {
                    string directory = Properties.Settings.Default.StorageLocation + (GlobalVariables.CurrentUnitCode != "" ? GlobalVariables.CurrentUnitCode + "/" : "");
                    Directory.CreateDirectory(directory);

                    string filename = directory + downloadItem.SuggestedFileName;
                    if (!File.Exists(filename)) {
                        callback.Continue(filename, showDialog: false);
                        ++GlobalVariables.FilesDownloaded;

                        BlackboardFile f = new BlackboardFile(downloadItem.SuggestedFileName, downloadItem.Url);
                        f.RawURL = GlobalVariables.CurrentUrl;
                        f.FirstDownloaded = DateTime.Now;
                        f.LastDownloaded = DateTime.Now;
                        f.TimesDownloaded = 1;
                        f.LocalPath = filename;

                        //We know the unit we want exists in GlobalVariables.Units because it was created before the download started, back in Crawler.cs
                        GlobalVariables.Units.First(u => u.Name == GlobalVariables.CurrentUnitCode).Files.Add(f);
                    }
                    else {
                        //FUTURE FEATURE: Allow files to be marked for redownloading.
                        ++GlobalVariables.FilesSkipped;
                    }

                    if (DownloadHandled != null)
                        DownloadHandled(new object(), new EventArgs());
                }
            }
        }
开发者ID:Cossa6,项目名称:truffle,代码行数:32,代码来源:DownloadHandler.cs


示例19: LoadingStateChangedEventArgs

 public LoadingStateChangedEventArgs(IBrowser browser, bool canGoBack, bool canGoForward, bool isLoading)
 {
     Browser = browser;
     CanGoBack = canGoBack;
     CanGoForward = canGoForward;
     IsLoading = isLoading;
     CanReload = !isLoading;
 }
开发者ID:Creo1402,项目名称:CefSharp,代码行数:8,代码来源:LoadingStateChangedEventArgs.cs


示例20:

        bool IRequestHandler.GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
        {
            //NOTE: If you do not wish to implement this method returning false is the default behaviour
            // We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.

            callback.Dispose();
            return false;
        }
开发者ID:MagicWang,项目名称:WYJ,代码行数:8,代码来源:RequestHandler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IBrush类代码示例发布时间:2022-05-24
下一篇:
C# IBrowsableCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap