Beispiel #1
0
 public static MessageNotificationForm GetInstance()
 {
     if (instance == null || instance.IsDisposed)
     {
         lock (synObject)
         {
             if (instance == null || instance.IsDisposed)
             {
                 instance = new MessageNotificationForm();
             }
         }
     }
     return(instance);
 }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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();
            }
        }