Ejemplo n.º 1
0
        private void Awesomium_Windows_Forms_WebControl_DocumentReady(object sender, Awesomium.Core.UrlEventArgs e)
        {
            using (JSObject programInterface = webControl1.CreateGlobalJavascriptObject("programInterface"))
            {
                programInterface.Bind("openURL", false, (s, ee) =>
                {
                    string browserPath = GetBrowserPath();
                    if (browserPath == string.Empty)
                    {
                        browserPath = "iexplore";
                    }
                    Process process             = new Process();
                    process.StartInfo           = new ProcessStartInfo(browserPath);
                    process.StartInfo.Arguments = "\"" + Uri.EscapeUriString(ee.Arguments[0]) + "\"";
                    process.Start();
                });

                programInterface.Bind("getVersion", true, (s, ee) =>
                {
                    ee.Result = MainForm.Version.ToString();
                });

                programInterface.Bind("copyToClipboard", false, (s, ee) =>
                {
                    Clipboard.SetText(ee.Arguments[0]);
                });

                programInterface.Bind("closeForm", false, (s, ee) =>
                {
                    this.Close();
                });
            }
        }
Ejemplo n.º 2
0
Archivo: About.cs Proyecto: Muny/Skyply
        private void Awesomium_Windows_Forms_WebControl_DocumentReady(object sender, Awesomium.Core.UrlEventArgs e)
        {
            if (isFirstLoad)
            {
                isFirstLoad = false;
            }
            else
            {
                using (JSObject programInterface = webControl1.CreateGlobalJavascriptObject("programInterface"))
                {
                    programInterface.Bind("openURL", false, (s, ee) =>
                    {
                        string browserPath = GetBrowserPath();
                        if (browserPath == string.Empty)
                        {
                            browserPath = "iexplore";
                        }
                        Process process             = new Process();
                        process.StartInfo           = new ProcessStartInfo(browserPath);
                        process.StartInfo.Arguments = "\"" + Uri.EscapeUriString(ee.Arguments[0]) + "\"";
                        process.Start();
                    });

                    programInterface.Bind("getVersion", true, (s, ee) =>
                    {
                        ee.Result = MainForm.Version.ToString();
                    });

                    programInterface.Bind("updateProgram", false, (s, ee) =>
                    {
                        MainForm.instance.CheckForUpdate(true);
                    });
                }
            }
        }
Ejemplo n.º 3
0
        void wc_LoadingFrameComplete(object sender, Awesomium.Core.UrlEventArgs e)
        {
            //Make sure formatting works
            string scr = @"
                var s = document.createElement('style');
                s.innerHTML = 'html, body { overflow: hidden; padding:0; margin:0; }';
                document.body.appendChild(s);
            ";

            wc.ExecuteJavascript(scr);
        }
Ejemplo n.º 4
0
 private void AwesomiumWebControl_TargetURLChanged(object sender, Awesomium.Core.UrlEventArgs e)
 {
     try
     {
         TargetUrlChanged?.Invoke(e.OriginalString);
     }
     catch (Exception)
     {
         //В некоторых случаях, 1Ска подписывается на событие, хотя явного вызова ДобавитьОбработчик нет,
         //при срабатывании ком обьект просто падает, с ошибкой 0x80020003
     }
 }
Ejemplo n.º 5
0
 private void Awesomium_Windows_Forms_WebControl_DocumentReady(object sender, Awesomium.Core.UrlEventArgs urlEventArgs)
 {
     if (urlEventArgs.Url == new Uri(BotBase.GameUrl + "game.php"))
     {
         BotBase.InGame = true;
         BotBase.CcDictionary.Clear();
         string   cookies = BotFunc.JsEx("document.cookie");
         string[] cooks   = cookies.Split(";".ToCharArray());
         Regex    r       = new Regex("(.*?)=(.*)");
         foreach (string ms in cooks)
         {
             Match n = r.Match(ms);
             try
             {
                 BotBase.CcDictonaryNet.Add(new Cookie(n.Groups[1].Value, n.Groups[2].Value, "/", BotBase.GameDomain));
                 BotBase.CcDictonaryCollection.Add(new Cookie(n.Groups[1].Value, n.Groups[2].Value));
             }
             catch {}
             BotBase.CcDictionary.Add(n.Groups[1].Value, n.Groups[2].Value);
         }
     }
 }
Ejemplo n.º 6
0
        private void Awesomium_Windows_Forms_WebControl_DocumentReady(object sender, Awesomium.Core.UrlEventArgs e)
        {
            if (isFirstLoad)
            {
                isFirstLoad = false;
            }
            else
            {
                using (JSObject programInterface = webControl1.CreateGlobalJavascriptObject("programInterface"))
                {
                    programInterface.Bind("updateSize", false, (s, ee) =>
                    {
                        this.Height = Convert.ToInt32(ee.Arguments[0].ToString());
                    });

                    programInterface.Bind("closeForm", false, (s, ee) =>
                    {
                        CloseNotification();
                    });

                    programInterface.Bind("stopHideTimer", false, (s, ee) =>
                    {
                        CloseNotificationTimer.Stop();
                    });

                    programInterface.Bind("startHideTimer", false, (s, ee) =>
                    {
                        CloseNotificationTimer.Start();
                    });

                    programInterface.Bind("sendReply", false, (s, ee) =>
                    {
                        message.Seen = true;
                        message.Chat.SendMessage(ee.Arguments[0].ToString());
                        CloseNotification();
                    });

                    programInterface.Bind("openChat", false, (s, ee) =>
                    {
                        CloseNotification();
                        message.Chat.OpenWindow();
                    });

                    programInterface.Bind("seeMessage", false, (s, ee) =>
                    {
                        message.Seen = true;
                    });

                    programInterface.Bind("openURL", false, (s, ee) =>
                    {
                        string browserPath = GetBrowserPath();
                        if (browserPath == string.Empty)
                        {
                            browserPath = "iexplore";
                        }
                        Process process             = new Process();
                        process.StartInfo           = new ProcessStartInfo(browserPath);
                        process.StartInfo.Arguments = "\"" + Uri.EscapeUriString(ee.Arguments[0]) + "\"";
                        process.Start();
                    });
                }
                try
                {
                    string avatar = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAA3CAYAAACo29JGAAAABmJLR0QAIgC7ALk59N3CAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gETFgU7T/vEnQAAAAxpVFh0Q29tbWVudAAAAAAAvK6ymQAACEBJREFUaN7lmkuPFNcVgL9bVd1VXf2a7nm/hzEGg3GUyAFMyOBxSGSBjB1HjoRkS5bi2CtWWcTZeOVNyCIrfgSJyEMZFCcL5DFDQmwvIiU4YBYDBgZmhp5Xz4Oq7qq6WUzX0N10V3fPw5DJkRDSqO+t89U5dR73XNjGIjZ7w1fGRpsMoXw4qIdP1btm3M6dsaT3wfmh4fknDu7E2Gh7SlUvdoRCuza612Q+f33OdY+MDA1PPVa4V8dG9z9jGJ8V/01Kyazr8unKCiuerLmHqQgOmiZpVUWIUnWuWdaBPw0Nf/61wp0YG92xxzDGi4GmHZex5eUNe8FQNEqbVgp61bIGR4aGb2w53BuXPvnloK6/70N9adtcsexNDwb7DJ3dur4GOW7bp89998VfbAncK2OjTbt0fVYrPC3jOIwuLW95xBuORWnRNAAcKeV1207XG3hE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P/vssqcJIeoZFUvPA9dd/V9KWA+fWIUTqloXnD9CdqSUvz5wSGnomOG6baf3GsZcVFU4GosFDiCFoiCF2JTrSPVY7GgstjYbv27b6Ya7gvNDw/NXLes5gJSmcrTGxEUIsSn/6gErnokHXdsI7DVGhoav+OE1pakci8d5nHIsHl8Du2ZZB2pd1/j/vofiy7a9QVQs2/LuV5mbbs9be8WyLe9bVrDk9rspWy3wPCl3nLe1/BeqGe4pkvkIHAAAAABJRU5ErkJggg==";

                    if (message.Chat.Type == TChatType.chatTypeDialog)
                    {
                        avatar = "data:image/jpeg;base64," + Serialize((new FileInfo(Path.GetTempFileName()).Directory).FullName + "\\" + this.message.Sender.Handle + rand + ".jpg");
                    }

                    webControl1.ExecuteJavascript("notify('" + this.Title.CleanForJavascript() + "', '" + this.HtmlDescription.CleanForJavascript() + "', '" + avatar + "');");
                }
                catch { }
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// What should we do when a document has loaded?
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void Browser_DocumentReady(object sender, Awesomium.Core.UrlEventArgs e)
 {
     btnBack.Enabled    = Browser.CanGoBack();
     btnForward.Enabled = Browser.CanGoForward();
 }
Ejemplo n.º 8
0
 private void Awesomium_Windows_Forms_WebControl_DocumentReady(object sender, Awesomium.Core.UrlEventArgs e)
 {
 }
Ejemplo n.º 9
0
 void wc_DocumentReady(object sender, Awesomium.Core.UrlEventArgs e)
 {
     XPathPickerInject();
     BindMethods();
 }