public void flash() { DelegaColor dColor = new DelegaColor(changeColor); while (!finish) { lock (l) { if (created && !finish) { if (displayStop) { Monitor.Wait(l); } if (!displayStop) { try { this.Invoke(dColor, tbColor); } catch (ObjectDisposedException) { return; } } } } Thread.Sleep(200); } }
public void display() { try { DelegaColor cD = new DelegaColor(displayColor); while (!finish) { if (!displayStop) { this.Invoke(cD, display_lbl); } } } catch (System.InvalidOperationException) { } }