Example #1
0
 public CheckInternet1()
 {
     MyThread = new Thread(new ThreadStart(delegate
     {
         string Temp = "";
         Temp        = My.GetWebCodeByWebRequest("http://www.baidu.com/img/bdlogo.png");
         if (Temp == "")
         {
             Temp = My.GetWebCodeByWebRequest("http://www.baidu.com/img/bdlogo.png");
         }
         if (Temp == "")
         {
             Temp = My.GetWebCodeByWebRequest("http://www.baidu.com/img/bdlogo.png");
         }
         if (Temp == "")
         {
             My.LoadingForm.TopMost = true;
             My.LoadingForm.TopMost = false;
             if (MessageBox.Show("网络连接错误,请检查网络设置。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
             {
                 Application.Exit();
             }
         }
         //else { My.Show(Temp.Length); }
         //5KB
         try { My.LoadingForm.Invoke(new FormLoading.UIDelegate(DelegateMethod)); }
         catch (Exception) { }
         finally { MyThread.Abort(); }
     }
                                           ));
     MyThread.IsBackground = true;
     MyThread.Start();
 }
Example #2
0
            public CheckInternet2()
            {
                MyThread = new Thread(new ThreadStart(delegate
                {
                    string Temp = "";
                    Temp        = My.GetWebCodeByWebRequest("http://moonlordapi.sinaapp.com/%E4%B8%83%E7%89%9B%E4%BA%91%E5%AD%98%E5%82%A8%E6%89%B9%E9%87%8F%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7.php");
                    if (Temp == "")
                    {
                        Temp = My.GetWebCodeByWebRequest("http://moonlordapi.sinaapp.com/%E4%B8%83%E7%89%9B%E4%BA%91%E5%AD%98%E5%82%A8%E6%89%B9%E9%87%8F%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7.php");
                    }
                    if (Temp == "")
                    {
                        Temp = My.GetWebCodeByWebRequest("http://moonlordapi.sinaapp.com/%E4%B8%83%E7%89%9B%E4%BA%91%E5%AD%98%E5%82%A8%E6%89%B9%E9%87%8F%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7.php");
                    }
                    if (Temp != "" && Temp != "SKIP")//强制打开浏览器(返回字符串为URL)
                    {
                        if (Temp.Contains("?"))
                        {
                            //System.Diagnostics.Process.Start("IEXPLORE.EXE", Temp);
                            System.Diagnostics.Process.Start("EXPLORER.EXE", "\"" + Temp + "\"");
                        }
                        else
                        {
                            System.Diagnostics.Process.Start("EXPLORER.EXE", Temp);
                        }
                    }
                    if (Temp == "")
                    {
                        if (MessageBox.Show("更新版本信息获取失败,请联系www.moonlord.cn。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
                        {
                            Application.Exit();
                        }
                    }
                    //else { My.Show(Temp.Length); }

                    try { My.LoadingForm.Invoke(new FormLoading.UIDelegate(DelegateMethod)); }
                    catch (Exception) { }
                    finally { MyThread.Abort(); }
                }
                                                      ));
                MyThread.IsBackground = true;
                MyThread.Start();
            }