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


C# WebKit.WebView类代码示例

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


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

示例1: Init

        public void Init()
        {
            try{
                var fxd = new Fixed();
                _window.Add(fxd);
                _wbkt = new WebView();
                fxd.Add(_wbkt);

                //init window
                this.SetSizeRequest(_window_width, _window_height);
                _window.AllowShrink = false;
                _window.Resizable = false;
                _window.SetPosition(WindowPosition.CenterAlways);

                //subscribe on events
                _window.DeleteEvent += OnDelete;
                _wbkt.LoadFinished += OnWindowLoaded;

                //webkit init
                _wbkt.Open(string.Format (URL, this._app_id, _scope, _display, _api_veresion));
            }
            catch(Exception ex)
            {
                this.throwError(22, "Error while window initialization: " + ex.Message);
            }
        }
开发者ID:kpasechnychenko,项目名称:oauth-vk,代码行数:26,代码来源:LoginWindow.cs

示例2: LinuxBrowserBridge

 public LinuxBrowserBridge(WebView webBrowser)
     : base()
 {
     this.webBrowser = webBrowser;
     webBrowser.LoadFinished += delegate
     {
         webBrowser.TitleChanged += delegate(object o, TitleChangedArgs titleChangeArgs)
         {
             string pendingArgs = titleChangeArgs.Title;
             JArray argsJArray = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(pendingArgs);
             string[] args = new string[argsJArray.Count];
             for (int i = 0; i < argsJArray.Count; i++)
                 args[i] = (string)argsJArray[i];
             if (args[0] == "HandleScriptPropertyChanged")
             {
                 if (args.Length == 3)
                     HandleScriptPropertyChanged(args[1], args[2], null);
                 else
                     HandleScriptPropertyChanged(args[1], args[2], args[3]);
             }
             else if (args[0] == "InvokeViewModelIndexMethod")
                 InvokeViewModelMethod(args[1], args[2], args[3]);
             else if (args[0] == "InvokeViewModelMethod")
                 InvokeViewModelMethod(args[1], args[2]);
             else if (args[0] == "HandleDocumentReady")
                 HandleDocumentReady();
             else if (args[0] == "HostLog")
                 HostLog(args[1]);
             else
                 SpinnakerConfiguration.CurrentConfig.Log(SpinnakerLogLevel.Error,"Ignoring unrecognized call from javascript for [" + args[0] + "] - this means that javascript in the view is trying to reach the host but with bad arguments");
         };
         HandleDocumentReady();
     };
 }
开发者ID:Claytonious,项目名称:spinnaker,代码行数:34,代码来源:LinuxBrowserBridge.cs

示例3: didFailLoadingWithError

 public void didFailLoadingWithError(WebView WebView, uint identifier, WebError error, IWebDataSource dataSource)
 {
     IWebURLResponse resp = null;
     resources.TryGetValue(identifier, out resp);
     if (resp != null)
        ResourceFailedLoading(resources[identifier], error);
 }
开发者ID:runt18,项目名称:open-webkit-sharp,代码行数:7,代码来源:WebResourceLoadDelegate.cs

示例4: decidePolicyForNavigationAction

 public void decidePolicyForNavigationAction(WebView WebView, CFDictionaryPropertyBag actionInformation, WebURLRequest request, webFrame frame, IWebPolicyDecisionListener listener)
 {
     if (AllowNavigation || AllowInitialNavigation)
         listener.use();
     else
         listener.ignore();
 }
开发者ID:qcjxberin,项目名称:webkitdotnet,代码行数:7,代码来源:WebPolicyDelegate.cs

示例5: decidePolicyForNewWindowAction

 public void decidePolicyForNewWindowAction(WebView WebView, CFDictionaryPropertyBag actionInformation, WebURLRequest request, string frameName, IWebPolicyDecisionListener listener)
 {
     if (AllowNewWindows)
         listener.use();
     else
         listener.ignore();
 }
开发者ID:qcjxberin,项目名称:webkitdotnet,代码行数:7,代码来源:WebPolicyDelegate.cs

示例6: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        var webView = new WebKit.WebView();
        var scrolled = new ScrolledWindow();
        var v = new VPaned();

        scrolled.Add(webView);
        v.Pack1(scrolled, true, true);
        scrolled.SetSizeRequest(-1, 50);

        var button = new Button("foo");
        v.Pack2(button, true, true);

        this.Add(v);
        this.ShowAll();

        webView.LoadString("<p>foo</p>", "text/html", "utf-8", null);

        // This won't show up until we've returned from the constructor
        // so let's do something easy that can happen after the window shows
        button.Clicked += (object sender, EventArgs e) => {
            var document = webView.DomDocument;
            var first = document.FirstChild;
            var body = document.GetElementsByTagName("body").Item(0);
            var para = document.CreateElement("p");
            para.AppendChild(document.CreateTextNode("this is some text"));
            body.AppendChild(para);
        };
    }
开发者ID:carlosmn,项目名称:webkit-dom,代码行数:30,代码来源:MainWindow.cs

示例7: didReceiveContentLength

 public void didReceiveContentLength(WebView WebView, uint identifier, uint length, IWebDataSource dataSource)
 {
     int received = (int)length;
     try
     {
         ResourceSizeAvailable(resources[identifier], received);
     }
     catch { }
 }
开发者ID:runt18,项目名称:open-webkit-sharp,代码行数:9,代码来源:WebResourceLoadDelegate.cs

示例8: DidCreateJavascriptContext

        public void DidCreateJavascriptContext(WebView view, JSContext context, WebFrame frame)
        {
            jsContext = context;
            jsContext.ExceptionHandler = (JSContext contextException, JSValue exception) => {
                Console.WriteLine("JavaScript Exception: {0}", exception);
            };

            nativeBridge = new MyNativeBridge(jsContext);
            jsContext[(NSString)"nativeBridge"] = JSValue.From(nativeBridge, jsContext);
        }
开发者ID:rawberg,项目名称:desktop-javascript,代码行数:10,代码来源:MyFrameLoadDelegate.cs

示例9: WebBrowser

 public WebBrowser()
     : base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     m_view = new WebView();
     browserScroll.AddWithViewport(m_view);
     m_view.LoadStarted += HandleViewLoadStarted;
     m_view.LoadProgressChanged += HandleViewLoadProgressChanged;
     m_view.LoadFinished += HandleM_viewLoadFinished;
     browserScroll.ShowAll();
     this.Maximize();
 }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:12,代码来源:WebBrowser.cs

示例10: CreateBrowser

    private void CreateBrowser()
    {
        //Создаем массив обработчиков доступных для вызова из js
        handlers = new Dictionary<string, Action<NameValueCollection>>
        {
            { "callfromjs", nv => CallJs("showMessage", new object[] { nv["msg"] + " Ответ из С#" }) }
        };

        browser = new WebView ();

        browser.NavigationRequested += (sender, args) =>
        {
            var url = new Uri(args.Request.Uri);
            if (url.Scheme != "mp")
            {
                //mp - myprotocol.
                //Обрабатываем вызовы только нашего специального протокола.
                //Переходы по обычным ссылкам работают как и прежде
                return;
            }

            var parameters = System.Web.HttpUtility.ParseQueryString(url.Query);

            handlers[url.Host.ToLower()](parameters);

            //Отменяем переход по ссылке
            browser.StopLoading();
        };

        browser.LoadHtmlString (@"
                <html>
                    <head></head>
                    <body id=body>
                        <h1>Интерфейс</h1>
                        <button id=btn>Вызвать C#</button>
                        <p id=msg></p>

                        <script>
                            function buttonClick() {
                                window.location.href = 'mp://callFromJs?msg=Сообщение из js.';
                            }
                            function showMessage(msg) {
                                document.getElementById('msg').innerHTML = msg;
                            }

                            document.getElementById('btn').onclick = buttonClick;
                        </script>
                    </body>
                </html>
            ", null);

        this.Add (browser);
    }
开发者ID:jacob-l,项目名称:BrowserLinux,代码行数:53,代码来源:MainWindow.cs

示例11: FinishedLoad

		public void FinishedLoad(WebView sender, WebFrame forFrame)
		{
			var url = sender.MainFrameUrl;

			if (!Authenticator.HasCompleted) {
				Uri uri;
				if (Uri.TryCreate (url, UriKind.Absolute, out uri)) {
					if (Authenticator.CheckUrl (uri, GetCookies (url)))
						return;
				}
			}
		}
开发者ID:jsauvexamarin,项目名称:SimpleAuth,代码行数:12,代码来源:WebAuthenticator.cs

示例12: HandleCreateWebView

 void HandleCreateWebView(object o, CreateWebViewArgs args)
 {
     Window info = new Window("");
     info.DefaultWidth = 1000;
     info.DefaultHeight = 700;
     VBox vbox2 = new VBox();
     WebView child = new WebView();
     child.NavigationRequested += HandleNavigationRequested1;
     vbox2.PackStart(child);
     info.Add (vbox2);
     info.ShowAll();
     args.RetVal = child;
 }
开发者ID:chatop,项目名称:owa_browse,代码行数:13,代码来源:MainWindow.cs

示例13: AwakeFromNib

        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            NSUserDefaults.StandardUserDefaults.SetBool(true, "WebKitDeveloperExtras");
            NSUserDefaults.StandardUserDefaults.Synchronize();

            myWebView = new WebKit.WebView(Window.ContentView.Bounds, "MainWindow", "");
            myWebView.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable;
            Window.ContentView.AddSubview(myWebView);

            myWebView.FrameLoadDelegate = new MyFrameLoadDelegate();
            myWebView.MainFrame.LoadRequest(new NSUrlRequest(new NSUrl("http://demo.desktopjavascript.com")));
        }
开发者ID:rawberg,项目名称:desktop-javascript,代码行数:14,代码来源:MainWindowController.cs

示例14: MainWindow

 public MainWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
     webView = new WebView ();
     this.scrolledWebWindow.Add(webView);
     this.text_adress.Text = HOME_PAGE;
     webView.LoadFinished += new LoadFinishedHandler (OnLoadFinished);
     webView.Open (text_adress.Text);
     pathFolderSave = Environment.GetFolderPath (Environment.SpecialFolder.MyMusic);
     downloadList = new DownloadList (this.scrolledListDownlaods);
     downloader = new Downloader (downloadList);
     downloader.SavePath = pathFolderSave;
 }
开发者ID:tifuivali,项目名称:Mp3-Youtube-Music-Downloader-Mono,代码行数:14,代码来源:MainWindow.cs

示例15: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        this.eng = new Engine(this);
        this.eng.Start();
        this.eng.Stopped += HandleApphandleStopped;

        this.webView = new WebView();
        this.mainContainer.Add(this.webView);
        this.webView.Show();
        this.webView.LoadUri("http://localhost:9999/index.html");
    }
开发者ID:dtao,项目名称:SimpleDevelop,代码行数:14,代码来源:MainWindow.cs


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