初用C#,要控制程序每隔设定好的时间查询一下服务器,需要如何写代码,其间主程序还要可以响应其他的操作.
谢谢!

解决方案 »

  1.   

    用Application或windows服务都可。使用Timer进行时间触发,执行查询方法即可。注意最好用Threading下的Timer.
      

  2.   

    如果是Windows程序,可以利用Timer, 如果是 WEB程序,可在一个地方设置一个方法过多少时间自动刷新。WEB方式如下:
    <script language="javascript">
    function ldo()
    {
    pageMessage.location="frameFile/pageMessage.aspx";
    pagersh.location = "frameFile/pagersh.aspx";
    window.setTimeout(ldo,30000);
    }
    </script>
      

  3.   

    Timer或Service程序。MSDN上有例子
      

  4.   

    看来是要用Timer了,service在98下面不能用