none
Duda con el webkit.net para visual basic 2010 RRS feed

  • Pregunta

  • Estoy comenzado a trabajar con este motor de búsqueda y encontré un pequeño inconveniente que por ejemplo en el código JavaScript o HTML hay un Alert(""); este no se muestre y me gustaria saber como hacer para mostrarlo

    De antemano Gracias

    martes, 23 de abril de 2013 0:52

Todas las respuestas

  • La version de webkit.net actual que se descarga no tiene esa opcion pero si recompilas el proyecto podrias llegar a hacerlo, encontre esta informacion que resolveria tu problema:

    Apparently, WebKit.NET guise did not implement methods for displaying message boxes… 

    To fix this, you would have to rebuild the WebKit.NET project. First, get theWebKit.NET-0.5-src.zip from here, extract it, and open the contained solution in Visual Studio.

    Then in Solution Explorer find WebUIDelegate.cs, and locate these 3 methods:

    runJavaScriptAlertPanelWithMessage
    runJavaScriptConfirmPanelWithMessage
    runJavaScriptTextInputPanelWithPrompt
    

    First one gets called when javascript:alert() gets executed in the browser. So, if you modify runJavaScriptAlertPanelWithMessage to look like this (do not put System.Windows.Forms in usages!):

    public void runJavaScriptAlertPanelWithMessage(WebView sender, string message)
            {
                System.Windows.Forms.MessageBox.Show(message, "Alert", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
    

    Browser will show a .NET information MessageBox titled "Alert" which holds the given message.

    To imeplement confirm(), do this:

    public int runJavaScriptConfirmPanelWithMessage(WebView sender, string message)
            {
                return System.Windows.Forms.MessageBox.Show(message, "Confirm", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes ? 1 : 0;
            }
    

    You may want to use OK and Cancel buttons…

    Prompt is a bit difficult since you must design a form that would allow the user to enter a string… but, this is the way to do it.

    Rebuild all, and voila! :D

    fuente : http://sourceforge.net/p/webkitdotnet/discussion/939856/thread/2252d21c/

    martes, 25 de febrero de 2014 10:46