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


C# WebView.LoadHTML方法代码示例

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


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

示例1: Start

    public IEnumerator Start()
    {
        Debug.Log( "Initializing WebCore." );
        // WebCoreInitializer.Awake() initializes the WebCore
        // before any Start() function on any script is called.
        // We create a web-view here.

        //NewsManager manejaNews = NewsManager.getInstance();
        NewsManager manejaNews = new NewsManager();

        manejaNews.getBackNews(newsCategory,newsFaculty);

        yield return new WaitForSeconds (7f); //Espera unos segundos (por defecto elegimos 7) a que se complete la descarga. Sabemos que es horrible esto pero de momento queda así, todos los intentos de descarga asincrónica fallaron

        //Debug.Log("OUT "+manejaNews.isDownloadFinished()+"    #= "+ manejaNews.getCantNoticias());

        int newsAmmount= manejaNews.getCantNoticias();
        News noticia;
        html = "<html><body bgcolor=2B593D text=white> <p> <center> <h1> Noticias de " + newsCategory + " en " + newsFaculty + "</h1> </center> </p>";
        //html = "<html><body bgcolor=2B593D text=white> <p> <marquee> <h1> Noticias de " + newsCategory + " en " + newsFaculty + "</h1></marquee></p>"; //CON MARQUESINA  (decrementa muchísimo la performance)
        //Agrega las noticias
        if (newsAmmount == 0){
            html+= "<p>No hay noticias disponibles.</p>";
        }
        else{
            ArrayList noticias = manejaNews.getAllNews();
            for (int i=0; i< newsAmmount; i++){
                noticia = (News)noticias[i];
                Debug.Log (i+" - Title: "+noticia.getTitle());
        //				Debug.Log ("Content: "+noticia.getContent());
                html+="<p><h3>" + noticia.getTitle()+ "</h3>"+ noticia.getContent()+"</p>";
                html+="<p><HR></p>";
            }
        }

        html= html+ "</body></html>";

        webView = WebCore.CreateWebView( width, height );

        // Load the defined URL.
        //webView.LoadURL( initialURL );

        webView.LoadHTML(html);
        // Prepare and a assign a texture to the component.
        // The texture will display the pixel buffer of the WebView.
        texture = new Texture2D( width, height, TextureFormat.RGBA32, false );
        Pixels = texture.GetPixels32( 0 );
        PixelsHandle = GCHandle.Alloc( Pixels, GCHandleType.Pinned );

        if ( GetComponent<Renderer>() ){
            GetComponent<Renderer>().material.mainTexture = texture;
        }
        else if ( GetComponent( typeof( GUITexture ) ) )
        {
            GUITexture gui = GetComponent( typeof( GUITexture ) ) as GUITexture;
            gui.texture = texture;
        }
        else
            Debug.LogError( "Game Object has no Material or GUI Texture, we cannot render a web-page to this object!" );

        // Handle some important events.
        webView.OpenExternalLink += OnWebViewOpenExternalLink;
        webView.ShowJavascriptDialog += OnJavascriptDialog;
        webView.LoginRequest += OnLoginRequest;
    }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:65,代码来源:WebViewFromHTML.cs

示例2: InitializeView

        private void InitializeView( WebView view )
        {
            if ( view == null )
                return;

            // Create an image surface to render the
            // WebView's pixel buffer.
            surface = new ImageSurface();
            surface.Updated += OnSurfaceUpdated;

            webView = view;
            // Assign our surface.
            webView.Surface = surface;

            // Handle some important events.
            webView.CursorChanged += OnCursorChanged;
            webView.TitleChanged += OnTitleChanged;
            webView.DocumentReady += OnDocumentReady;
            webView.ShowCreatedWebView += OnShowNewView;
            webView.Crashed += OnCrashed;

            // Load a URL, if this is not a child view.
            if ( webView.Parent == null )
                webView.LoadHTML( "<h1>Opening a popup window...</h1>" );

            // Give focus to the view.
            webView.FocusView();
        }
开发者ID:MichielDeMey,项目名称:Kolibrie-Mail,代码行数:28,代码来源:WebForm.cs


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