Example #1
0
        //req addNewMsg(newMsg)
        private void OnaddNewMsg(string obj)
        {
            MyTitle newMsg = new MyTitle();

            newMsg = JsonToTitle(obj);
            var tnParent = m_nodeDict[newMsg.path];
            var parent   = tnParent.title;

            newMsg.groupID  = parent.groupID;
            newMsg.parentID = parent.ID;
            if (parent.type == "group")
            {
                newMsg.parentID = 0;
                newMsg.groupID  = parent.ID;
            }
            //add to db
            var newObj = m_content.newTitle(newMsg);
            //update tree
            var tnChild = new Node()
            {
                id = newObj.path, name = newObj.title, title = newObj
            };

            m_nodeDict.Add(newObj.path, tnChild);
            tnParent.childs.Add(tnChild);
            updateTree(tnParent, tnChild);
            //update wb
            string jsTxt = TitleToJson(newObj);

            m_wb.Navigate("javascript:onSendChatDone('" + jsTxt + "')");
        }
Example #2
0
        protected void UpdateWB(string htmlTxt)
        {
            string filename = string.Format(@"{0}{1}", Path.GetTempPath(), "page.htm");

            File.WriteAllText(filename, htmlTxt);
#if use_rtb
            Debug.Assert(false);
#elif use_gecko
            m_wb.Navigate(filename);
#elif use_chromium
            m_wb.Load(filename);
#else
            m_wb.Navigate(filename);
#endif
            //OpenInBrowser(htmlTxt);
        }
Example #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
#if false
            //LoadHtml() throw assert
            m_wb.LoadHtml(@"<!DOCTYPE html>
             <html><head>
             <meta http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"">
             <script type=""text/javascript"">
                function fireEvent(name, data)
                {
                   var event = new MessageEvent(name,{'view': window, 'bubbles': false, 'cancelable': false, 'data': data});
                   document.dispatchEvent(event);
                }
             </script>
             </head>
             <body>fdsfsda
                <input type=""button"" onclick=""fireEvent('myFunction', 'some data');"" value=""SHOW DATA"" />
             </body></html>"
                          );

            m_wb.AddMessageEventListener("myFunction", ((string s) => MessageBox.Show(s)));
#endif

            m_wb.AddMessageEventListener("func1", onFunc1);
            m_wb.Navigate(@"C:\temp\until\KinhNikaya\testGUI\click.html");
        }
Example #4
0
        //bieu tuong kinh lup
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            Gecko.GeckoWebBrowser web = tabControl1.SelectedTab.Controls[0] as Gecko.GeckoWebBrowser;


            web.Navigate(txtUrl.Text);
        }
 private void AcceptInput(object sender, EventArgs e)
 {
     writing = false;
     if (favoriteSaving)
     {
         favoritesPanel.WriteFavoriteName(inputBox.Text);
         favoriteSaving = false;
         CloseKeyboard(null, null);
     }
     else
     {
         if (urlChanging)
         {
             browser.Navigate(inputBox.Text);
         }
         else
         {
             browser.Focus();
             for (int i = 0; i < 50; i++)
             {
                 SendKeys.Send("{BACKSPACE}");
                 SendKeys.Send("{DELETE}");
             }
             browser.Focus();
             SendKeys.Send(inputBox.Text.Replace("+", "{+}").Replace("^", "{^}").Replace("%", "{%}").Replace("(", "{(}").Replace(")", "{)}").Replace("[", "{[}").Replace("]", "{]}"));
         }
         CloseKeyboard(null, null);
     }
     writing = true;
 }
Example #6
0
 //nut home
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     Gecko.GeckoWebBrowser web = tabControl1.SelectedTab.Controls[0] as Gecko.GeckoWebBrowser;
     if (web != null)
     {
         web.Navigate("https://www.google.com");
     }
 }
Example #7
0
        //bieu tuong kinh lup
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            geckoWebBrowser1.Navigate("https://www.google.com");
            Gecko.GeckoWebBrowser web = tabControl1.SelectedTab.Controls[0] as Gecko.GeckoWebBrowser;


            web.Navigate(txtUrl.Text);
        }
Example #8
0
        //nhap url vao textbox cua cac tab
        private void txtUrl_KeyDown(object sender, KeyEventArgs e)
        {
            Gecko.GeckoWebBrowser web = tabControl1.SelectedTab.Controls[0] as Gecko.GeckoWebBrowser;


            if (e.KeyCode == Keys.Enter)
            {
                web.Navigate(txtUrl.Text);
            }
        }
Example #9
0
        public Form1()
        {
            InitializeComponent();
            Gecko.Xpcom.EnableProfileMonitoring = false;
            Gecko.Xpcom.Initialize("Firefox");
            geckoWebBrowser        = new Gecko.GeckoWebBrowser {
            };
            geckoWebBrowser.Parent = this.panel1;
            geckoWebBrowser.Dock   = DockStyle.Fill;
            string filename = @"map.html";

            geckoWebBrowser.Navigate(Path.Combine(folderpath, filename));
        }
Example #10
0
        protected void UpdateWB(string htmlTxt)
        {
#if use_gecko
            string filename = string.Format(@"{0}\{1}", Path.GetTempPath(), "page.htm");
            File.WriteAllText(filename, htmlTxt);
            m_wb.Navigate(filename);
#elif use_chromium
            m_wb.LoadHtml(htmlTxt, "http://test/page");
#else
            m_wb.DocumentText = htmlTxt;
#endif
            //OpenInBrowser(htmlTxt);
        }
Example #11
0
        private void btnNewtab_Click(object sender, EventArgs e)
        {
            TabPage tab = new TabPage();

            tab.Text = "New Tab";
            tabControl1.Controls.Add(tab);
            tabControl1.SelectTab(tabControl1.TabCount - 1);
            webTab        = new Gecko.GeckoWebBrowser();
            webTab.Parent = tab;
            webTab.Dock   = DockStyle.Fill;
            webTab.Navigate("https://www.google.com");
            txtUrl.Text = "https://www.google.com";
            webTab.DocumentCompleted += WebTab_DocumentCompleted1;
        }
Example #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.Desktop;
            fbd.Description         = "Выберите папку";
            fbd.ShowNewFolderButton = false;
            fbd.SelectedPath        = folderpath + "\\photos";
            bool sub = false;

            if (checkSub.Checked)
            {
                sub = true;
            }
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                Data.Text = fbd.SelectedPath + "\\";
                LoadImages(fbd.SelectedPath, fbd.SelectedPath, sub);
            }
            string filename = @"map.html";

            geckoWebBrowser.Navigate(Path.Combine(folderpath, filename));
        }
Example #13
0
        public void getData()
        {
            webBrowser.Navigate("http://zon.club/#/");
            regex = new Regex(regGetBlock);
            string listTai = regex.Match(webBrowser.Document.Body.InnerHtml).Value;

            regex = new Regex(regGetTai);
            MatchCollection collection = regex.Matches(listTai);

            if (collection.Count != 0)
            {
                addNewTai(collection);
                render();
            }
        }
 private void OpenFavorite1(object sender, EventArgs e)
 {
     browser.Navigate(links[page * 5]);
     CloseFavorites(null, null);
 }
Example #15
0
 void geckoWebBrowser1_CreateWindow(object sender, Gecko.GeckoCreateWindowEventArgs e)
 {
     Gecko.GeckoWebBrowser gwb = (Gecko.GeckoWebBrowser)sender;
     gwb.Navigate(e.Uri); //跳转新url
     e.Cancel = true;     //禁止弹窗
 }