文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C#1秒内判断是否已连上webservice,未连上则报错

C#1秒内判断是否已连上webservice,未连上则报错

时间:2010-09-07  来源:lanru

          private bool isopen = false;//字段       
  private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            timer1.Interval = 1000;//1秒内检查是否已连上网络
            WindowsFormsApplication1.ServiceReference1.SynWebSvrSoapClient s = new WindowsFormsApplication1.ServiceReference1.SynWebSvrSoapClient();
            isopen = s.OpenWeb();//该webservice方法为返回值为bool
        }

 

        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            if (!isopen)
            {
                MessageBox.Show("未连上网络请检查设置");
               
            }
         
        }

相关阅读 更多 +
排行榜 更多 +
终极街头格斗

终极街头格斗

休闲益智 下载
大炮轰飞机

大炮轰飞机

飞行射击 下载
像素打僵尸

像素打僵尸

飞行射击 下载