Example #1
0
        private void SysFavorite_Load(object sender, EventArgs e)
        {
            pictureBox1.Width = pictureBox1.Height = KellWebBrowser.IconWidth;
            KellWebBrowser.Favorites.Sort(new UrlComparer());
            foreach (UrlObject uo in KellWebBrowser.Favorites)
            {
                listBox1.Items.Add(uo);
                if (uo.IsHome)
                {
                    homeIndex = listBox1.Items.Count - 1;
                    home      = uo;
                }
            }
            button3.Enabled   = KellWebBrowser.HistoryUrlList.Count > 0;
            checkBox1.Checked = KellCommon.ReadIni("AppSettings", "NewWindow", KellCommon.IniFile) == "0" ? true : false;
            string search = KellCommon.ReadIni("AppSettings", "Search", KellCommon.IniFile);

            if (!string.IsNullOrEmpty(search))
            {
                int index;
                if (int.TryParse(search[0].ToString(), out index))
                {
                    comboBox1.SelectedIndex = index;
                }
            }
            if (comboBox1.Items.Count == 1 && comboBox1.Items[0] != null && comboBox1.Items[0].ToString() == NoneSearchEngine)
            {
                comboBox1.SelectedIndex = 0;
            }
            loadOver = true;
        }
Example #2
0
        public void Search(string keyword)
        {
            if (string.IsNullOrEmpty(keyword))
            {
                GoHome();
                return;
            }

            if (keyword == "about:blank")
            {
                return;
            }

            string engine = KellCommon.ReadIni("AppSettings", "Search", KellCommon.IniFile);

            if (!string.IsNullOrEmpty(engine))
            {
                string[] engEnc = engine.Split('|');
                if (engEnc.Length > 2)
                {
                    webBrowser1.Navigate(engEnc[1] + "=" + System.Web.HttpUtility.UrlEncode(keyword, Encoding.GetEncoding(engEnc[2].ToLower())));
                }
                else
                {
                    webBrowser1.Navigate(engEnc[1] + "=" + keyword);
                }
            }
        }
Example #3
0
        public void Navigate(string address)
        {
            if (string.IsNullOrEmpty(address))
            {
                GoHome();
                return;
            }
            if (address == "about:blank")
            {
                return;
            }
            if (!address.StartsWith("http://", true, null))
            {
                address = "http://" + address;
            }

            address = DnsConvert.ToPunycode(address);

            if (IsValidURL(address))
            {
                HttpWebResponse res = null;
                try
                {
                    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(address);
                    res = (HttpWebResponse)req.GetResponse();
                    webBrowser1.Navigate(address);
                }
                catch (Exception ex)
                {
                    Log("Goto", ex);
                    string engine = KellCommon.ReadIni("AppSettings", "Search", KellCommon.IniFile);
                    if (!string.IsNullOrEmpty(engine))
                    {
                        string[] engEnc = engine.Split('|');
                        if (engEnc.Length > 2)
                        {
                            webBrowser1.Navigate(engEnc[1] + "=" + System.Web.HttpUtility.UrlEncode(kellComboBox1.Text.Trim(), Encoding.GetEncoding(engEnc[2].ToLower())));
                        }
                        else
                        {
                            webBrowser1.Navigate(engEnc[1] + "=" + kellComboBox1.Text.Trim());
                        }
                    }
                }
                finally
                {
                    if (res != null)
                    {
                        res.Close();
                    }
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("网址错误!");
            }
        }
Example #4
0
        public static void MainLoadAlert()
        {
            ComputerInfo.Computer com = ComputerInfo.Computer.Instance();

            string HardDiskSN = com.DiskPhysicalSN;

            string pwd = KellCommon.GetRegCodeByHardDiskSN(HardDiskSN);

            if (KellCommon.ReadIni("AppSettings", "RegCode", KellCommon.IniFile) != pwd)
            {
                System.Windows.Forms.MessageBox.Show("该软件尚未注册!\n\n请在“帮助”菜单下点击“在线申请注册”,等待软件商回复您的邮件\n您根据邮件回复的注册申请码,在“帮助”菜单下点击“输入注册码”进行注册\n非常感谢您使用本软件!\n\n如有不清楚的请直接联系软件商 QQ:421979530", "注册提示");
            }
        }
Example #5
0
 private void webBrowser1_NewWindow(object sender, CancelEventArgs e)
 {
     try
     {
         string allNewWindow = KellCommon.ReadIni("AppSettings", "NewWindow", KellCommon.IniFile);
         if (!string.IsNullOrEmpty(allNewWindow) && allNewWindow == "0")
         {
             e.Cancel = true;
         }
     }
     catch
     { }
 }