Esempio n. 1
0
 public void AbortWaiters()
 {
     AbortAllThreads = true;
     using (_threadLocker.Lock())
     {
         foreach (KeyValuePair <int, ManualResetEvent> manualResetEventItem in _dictionary)
         {
             manualResetEventItem.Value.Set();
         }
     }
 }
Esempio n. 2
0
        private void SettingsFileChanged(object sender, FileSystemEventArgs e)
        {
            if (_saving)
            {
                return;
            }

            _settingsFileWatcher.EnableRaisingEvents = false;
            _jsonData = null;

            AppearanceSettings.Update();

            using (ThreadLocker locker = ThreadLocker.Lock(Application.OpenForms))
            {
                if (locker.IsLocked)
                {
                    int i = 0;

                    while (i < Application.OpenForms.Count)
                    {
                        if (Application.OpenForms[i] is BaseForm form)
                        {
                            MethodInvoker mi = new MethodInvoker(((BaseForm)form).UpdateAppearance);
                            form.Invoke(mi);
                        }

                        i++;
                    }
                }
            }

            _settingsFileWatcher.EnableRaisingEvents = true;
        }
Esempio n. 3
0
        public static void PushAction(StatusAction action)
        {
            using (ThreadLocker.Lock(_actions))
            {
                if (_actions.Count == 0)
                {
                    _startTime = DateTime.Now;
                }

                _actions.Push(action);
            }
        }