问题描述:
我在做模拟的过程中,会有一个文件是一直存在的,但是,模拟做完了它会自动消失,所以想求一个每半小时去判断一下他是不是还在的程序,如果他不在了,就触发一个弹窗的操作。
我会写判断是不是存在指定文件,但是,不会做十分钟检查一次和弹窗~
要C#哦~
可以给出大致用到些什么也成~灰常感谢~C#弹窗

解决方案 »

  1.   

    c#中有个timer 控件百度下..能实现你要的
      

  2.   

    定时用Timer控件,弹窗用MessageBox
      

  3.   

    FileSystemWatcher可以实时监控
      

  4.   


    System.Timers.Timer tm = null;
     tm = new System.Timers.Timer(1800000);
                tm.Elapsed += new System.Timers.ElapsedEventHandler(ExecuteWork);
                tm.AutoReset = true;
                tm.Enabled = true;
    void ExecuteWork(object sender, ElapsedEventArgs e)
    {
        if (!File.Exists("路径"))
        {
           // 弹窗
         }
    }
      

  5.   

    正解 不过可以双击Timer控件 在里面写方法
      

  6.   

    用FileSystemWatcher实时监控是更好吗?
      

  7.   

    一共有三种定义Timer的方法,5#说的可以在控件里面写,和4楼不一样的哇~~
      

  8.   

    不好意思,上面说的应该分别是6#和5#,有个问题是,我直接用了5#的代码,但是,提示
    tm =new System.Timers.timer(1800000);以及下面的三行
    invalid token'+=' in class, struct, or interface member declaration
    invalid token')' in class, struct, or interface member declaration
    invalid token'(' in class, struct, or interface member declaration
    invalid token'=' in class, struct, or interface member declaration
    invalid token'=' in class, struct, or interface member declaration
      

  9.   

     windows系统里面有个计划日志,你写一个程序判断有没有这个文件,那个系统日志每10分钟检查一下就好