Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The previous answer does not fix it completely, I had to reset the watcher not just turn it on and off. I use filesystemwatcher on a <strong>window service</strong></p> <pre><code>void NotAccessibleError(FileSystemWatcher source, ErrorEventArgs e) { int iMaxAttempts = 120; int iTimeOut = 30000; int i = 0; while ((!Directory.Exists(source.Path) || source.EnableRaisingEvents == false) &amp;&amp; i &lt; iMaxAttempts) { i += 1; try { source.EnableRaisingEvents = false; if (!Directory.Exists(source.Path)) { MyEventLog.WriteEntry("Directory Inaccessible " + source.Path + " at " + DateTime.Now.ToString("HH:mm:ss")); System.Threading.Thread.Sleep(iTimeOut); } else { // ReInitialize the Component source.Dispose(); source = null; source = new System.IO.FileSystemWatcher(); ((System.ComponentModel.ISupportInitialize)(source)).BeginInit(); source.EnableRaisingEvents = true; source.Filter = "*.tif"; source.Path = @"\\server\dir"; source.NotifyFilter = System.IO.NotifyFilters.FileName; source.Created += new System.IO.FileSystemEventHandler(fswCatchImages_Changed); source.Renamed += new System.IO.RenamedEventHandler(fswCatchImages_Renamed); source.Error += new ErrorEventHandler(OnError); ((System.ComponentModel.ISupportInitialize)(source)).EndInit(); MyEventLog.WriteEntry("Try to Restart RaisingEvents Watcher at " + DateTime.Now.ToString("HH:mm:ss")); } } catch (Exception error) { MyEventLog.WriteEntry("Error trying Restart Service " + error.StackTrace + " at " + DateTime.Now.ToString("HH:mm:ss")); source.EnableRaisingEvents = false; System.Threading.Thread.Sleep(iTimeOut); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload