public static void Notify(this EventHandlerVoid handler) { if (handler != null) { handler(); } }
private void TimerShowForm() { JobProgress.threadActive = true; TimeSpan timeSpan = new TimeSpan(0, 0, 2); do { //Log.Write((DateTime.Now - JobProgress.lastMessageTime).ToString(), this, "TimerShowForm", Log.LogType.DEBUG); if ((DateTime.Now - JobProgress.lastMessageTime) > timeSpan) { if (this.InvokeRequired) { //this.BeginInvoke(new EventHandler(ShowMe)); EventHandlerVoid method = new EventHandlerVoid(JobProgress.form.ShowMe); this.Invoke(method); Log.Write("Invoke", this, "TimerShowForm", Log.LogType.DEBUG); //object result = Invoke(method); } else { Log.Write("Starting form", this, "TimerShowForm", Log.LogType.DEBUG); this.Show(); Application.DoEvents(); } break; } Application.DoEvents(); Thread.Sleep(500); } while (true); JobProgress.threadActive = false; }