private void watcher_Changed(object sender, FileSystemEventArgs e)
        {
            if (FunctionNotifier == null || !HandleChange(e.FullPath))
            {
                return;
            }

            lock (_lock)
            {
                var timeSpan = DateTime.Now - _lastUpdateTime;
                if (!(timeSpan.TotalMilliseconds > 100))
                {
                    return;
                }

                Thread.Sleep(50);

                using (ThreadDataManager.EnsureInitialize())
                {
                    FunctionNotifier.FunctionsUpdated();
                }

                _lastUpdateTime = DateTime.Now;
            }
        }
Beispiel #2
0
 public FormBuilderFunctionProvider()
 {
     ModelsFacade.FormChanges += (sender, args) =>
     {
         if (FunctionNotifier != null)
         {
             FunctionNotifier.FunctionsUpdated();
         }
     };
 }
        public void ReloadFunctions()
        {
            Thread.Sleep(FunctionReloadDelayMilliseconds);

            try
            {
                FunctionNotifier.FunctionsUpdated();
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Log.LogError(LogTitle, "Failed to reload functions");
                Log.LogError(LogTitle, ex);
            }
        }