public static void InvokeIFRequired(Control control, MethodInvoker action) { // This will let you update any control from another thread - It only invokes IF NEEDED for better performance // See TextBoxLogger.Log for example if (control != null && !control.IsDisposed && !control.Disposing && control.IsHandleCreated && control.FindForm().IsHandleCreated&& !IsClosing.ReadFullFence()) { if (control.InvokeRequired) { control.Invoke(action); } else { action(); } } }
public void ClosingTIme() { // Метод для делегата, оповещающего потоки приготовления о закрытии заведения IsClosing?.Invoke(); }