Пример #1
0
 private void JavascriptMessageReceivedEventHandler(object sender, JavascriptMessageReceivedEventArgs e)
 {
     if (Debug)
     {
         DebugLog.Message("Message: " + e.Message);
     }
     return;
 }
Пример #2
0
 private void OnJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
 {
     if (Browser.Parent == null)
     {
         return;
     }
     Browser.Parent.Invoke(new SimpleDelegate(OpenEditorWithDelay));             // Open editor on UI thread
     if (Debug)
     {
         DebugLog.Message("Message: " + e.Message);
     }
     return;
 }
Пример #3
0
        private void OnBrowserJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
        {
            //Complext objects are initially expresses as IDicionary
            //You can use dynamic to access properties (the IDicionary is an ExpandoObject)
            //dynamic msg = e.Message;
            //Alternatively you can use the built in Model Binder to convert to a custom model
            var msg      = e.ConvertMessageTo <dynamic>();
            var callback = msg.Callback;
            var type     = msg.Type;
            var property = msg.Data.Property;

            //Call a javascript function with your response data
            callback.ExecuteAsync(type);
        }
Пример #4
0
        private void _OnBrowserJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
        {
            dynamic msg = e.ConvertMessageTo <ExpandoObject>();

            switch (msg.type)
            {
            case "datazoom":
                var datazoom = e.ConvertMessageTo <DataZoomModel>();
                _VM.OnDataZoom(datazoom, new CancelEventArgs()
                {
                    Cancel = false
                });
                break;
            }
        }
Пример #5
0
        private void ChromiumWebBrowser_JavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
        {
            ConsoleLogger.Debug(nameof(ChromiumWebBrowser_JavascriptMessageReceived) + " : " + new
            {
                e.Message,
            });

            foreach (ICrawlerPlugin plugin in CrawlerPlugins.Values)
            {
                try
                {
                    plugin.ChromiumWebBrowser_JavascriptMessageReceived(sender, e);
                }
                catch (Exception ex)
                {
                    ConsoleLogger.Warn($"{plugin.Title}.{nameof(plugin.ChromiumWebBrowser_JavascriptMessageReceived)} : {ex}");
                }
            }
        }
        private void OnBrowserJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
        {
            string messageFromJavaScript = (string)e.Message;

            if (!string.IsNullOrWhiteSpace(messageFromJavaScript))
            {
                MessageBox.Show(messageFromJavaScript + "blabla!");
            }
            //Browser.RegisterAsyncJsObject("boundAsync", "hi from csharp!");
            //Replaced with


            //MessageBox.Show("DDB JavaScript button clicked! Message: " + messageFromJavaScript);

            //Browser.ConsoleMessage += OnConsoleMessage;
            //DO SOMETHING WITH THIS MESSAGE
            //This event is called on a CEF Thread, to access your UI thread
            //use Control.BeginInvoke/Dispatcher.BeginInvoke
        }
Пример #7
0
        private void OnBrowserJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
        {
            //Complext objects are initially expresses as IDicionary (in reality it's an ExpandoObject so you can use dynamic)
            if (typeof(System.Dynamic.ExpandoObject).IsAssignableFrom(e.Message.GetType()))
            {
                //You can use dynamic to access properties
                //dynamic msg = e.Message;
                //Alternatively you can use the built in Model Binder to convert to a custom model
                var msg      = e.ConvertMessageTo <PostMessageExample>();
                var callback = msg.Callback;
                var type     = msg.Type;
                var property = msg.Data.Property;

                callback.ExecuteAsync(type);
            }
            else if (e.Message is int)
            {
                e.Frame.ExecuteJavaScriptAsync("PostMessageIntTestCallback(" + (int)e.Message + ")");
            }
        }
Пример #8
0
 void IWebBrowserInternal.SetJavascriptMessageReceived(JavascriptMessageReceivedEventArgs args)
 {
     JavascriptMessageReceived?.Invoke(this, args);
 }
Пример #9
0
 void OnBrowserJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
 {
     var windowSelection = (string)e.Message;
 }
Пример #10
0
 private void DemoWindow_JavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
 {
     Console.WriteLine("JavascriptMessageReceived event called.");
 }
 void IWebBrowserInternal.SetJavascriptMessageReceived(JavascriptMessageReceivedEventArgs args)
 {
     //Run the event on the ThreadPool (rather than the CEF Thread we are currently on).
     Task.Run(() => JavascriptMessageReceived?.Invoke(this, args));
 }
 public static void DoJavascriptMessage(object sender, JavascriptMessageReceivedEventArgs e)
 => Console.WriteLine($"{e.Browser} => {e.Frame.Name} {e.Message}");
Пример #13
0
 private void Browser_JavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
 {
     OnWebMessageReceived.Invoke(this, (string)e.Message);
 }
Пример #14
0
        private void Browser_JavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
        {
            var msg = (string)e.Message;

            Bot.Log(msg);
        }
 private void cwb_JavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
 {
 }