public static void Post(string message) { LogHelper.Notify(message); string writeString = string.Format("{0:yyyy.MM.dd HH:mm:ss} | {1}", DateTime.Now, message); if (_synchronizationContext != null) { _synchronizationContext.Send((o) => { GetMessageNotificationWindow(); MessageNotificationForm.GetInstance().Post(writeString); }, null); } else { GetMessageNotificationWindow(); MessageNotificationForm.GetInstance().Post(writeString); } }
private static void GetMessageNotificationWindow() { MessageNotificationForm msgForm = null; bool wExist = CheckFormIsOpen("MessageNotificationForm"); if (!wExist) { msgForm = MessageNotificationForm.GetInstance(); msgForm.Name = "MessageNotificationForm"; msgForm.Show(); } else { msgForm = (MessageNotificationForm)Application.OpenForms["MessageNotificationForm"]; if (msgForm.WindowState == FormWindowState.Minimized) { msgForm.WindowState = FormWindowState.Normal; } msgForm.Activate(); } }