public void Initial( )
        {
            System.IO.FileSystemWatcher fsw = new System.IO.FileSystemWatcher();
            int          timeoutMilllis     = 2000;
            WatcherTimer watcher            = new WatcherTimer(fsw_Changed, timeoutMilllis);

            fsw.Path         = @"E:\TestTmp\ISTATA";
            fsw.Filter       = @"*.*";
            fsw.NotifyFilter = NotifyFilters.FileName |
                               NotifyFilters.LastWrite |
                               NotifyFilters.CreationTime;

            // Add event handlers.
            fsw.Created += new FileSystemEventHandler(watcher.OnFileChanged);
            fsw.Changed += new FileSystemEventHandler(watcher.OnFileChanged);

            // Begin watching.
            fsw.EnableRaisingEvents = true;
        }
示例#2
0
        public void WatcherStrat(string path, string filter)
        {
            string key = Path.Combine(path, filter);
            Tuple <FileSystemWatcher, WatcherTimer> tuple;

            if (!watchers.TryGetValue(key, out tuple))
            {
                WatcherTimer timer = new WatcherTimer(OnReload);

                FileSystemWatcher watcher = new FileSystemWatcher();
                watcher.Path                = path;
                watcher.Filter              = filter;
                watcher.NotifyFilter        = NotifyFilters.LastWrite | NotifyFilters.FileName;
                watcher.Changed            += new FileSystemEventHandler(timer.OnFileChanged);
                watcher.Deleted            += new FileSystemEventHandler(timer.OnFileChanged);
                watcher.EnableRaisingEvents = true;

                tuple = new Tuple <FileSystemWatcher, WatcherTimer>(watcher, timer);
            }
            watchers[key] = tuple;
        }
示例#3
0
 public WarHandle()
 {
     //Init();
     m_watcher    = new WatcherTimer(OnProcess, 2000);
     m_orgwatcher = new WatcherTimer(OrgOnProcess, 1000);
 }
示例#4
0
 public CbHandle()
 {
     m_WarTime.dates = new List <ZcTimeDate>();
     m_watcher       = new WatcherTimer(OnProcess, 2000);
 }