internal void UpdateDirectoryTimer(string param, bool doCheck, string type) { if (doCheck) if (!CheckValidWindowsForDirectoryTimerQueue(string.Empty + GUIWindowManager.ActiveWindow)) return; try { if (Interlocked.CompareExchange(ref SyncPointDirectory, 1, 0) == 0 && (MyDirectoryWorker == null || (MyDirectoryWorker != null && !MyDirectoryWorker.IsBusy))) { if (MyDirectoryWorker == null) { MyDirectoryWorker = new DirectoryWorker(); MyDirectoryWorker.ProgressChanged += new ProgressChangedEventHandler(MyDirectoryWorker.OnProgressChanged); MyDirectoryWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MyDirectoryWorker.OnRunWorkerCompleted); } MyDirectoryWorker.RunWorkerAsync(new string[2] { param, type }); } else SyncPointDirectory = 0; } catch (Exception ex) { SyncPointDirectory = 0; logger.Error("UpdateDirectoryTimer: " + ex); } }
internal bool UpdateDirectoryTimer(string param, string type) { bool flag = false; try { if (Interlocked.CompareExchange(ref SyncPointDirectory, 1, 0) == 0 && (MyDirectoryWorker == null || (MyDirectoryWorker != null && !MyDirectoryWorker.IsBusy))) { if (MyDirectoryWorker == null) { MyDirectoryWorker = new DirectoryWorker(); MyDirectoryWorker.ProgressChanged += new ProgressChangedEventHandler(MyDirectoryWorker.OnProgressChanged); MyDirectoryWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MyDirectoryWorker.OnRunWorkerCompleted); } if (MyDirectoryWorker != null && !MyDirectoryWorker.IsBusy) { MyDirectoryWorker.RunWorkerAsync(new string[2] { param, type }); flag = true; } } } catch (Exception ex) { SyncPointDirectory = 0; logger.Error("UpdateDirectoryTimer: " + ex); } return flag; }