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("未连上网络请检查设置");
}
}