Example #1
0
 private static void CallNoticeWindow(string message, string caption, MessageBoxIcon?icon, string imageSource, int?intervalMs, bool canClose)
 {
     if (_noticeWindow == null && _thread == null)
     {
         if (Configurations.CreateOnNewThread)
         {
             var autoReset = new AutoResetEvent(false);
             _thread = new Thread(() =>
             {
                 _noticeWindow         = new NoticeWindow();
                 _noticeWindow.Closed += delegate
                 {
                     _noticeWindow.Dispatcher.InvokeShutdown();
                 };
                 _noticeWindow.Show();
                 _noticeWindow.AddCard(message, caption, icon, imageSource, intervalMs, canClose);
                 autoReset.Set();
                 Dispatcher.Run();
             });
             _thread.SetApartmentState(ApartmentState.STA);
             _thread.IsBackground = true;
             _thread.Start();
             autoReset.WaitOne();
         }
         else
         {
             _noticeWindow = new NoticeWindow();
             _noticeWindow.Show();
         }
     }
     else
     {
         _noticeWindow.AddCard(message, caption, icon, imageSource, intervalMs, canClose);
     }
 }
Example #2
0
 private static void CallNoticeWindow(string message, string title, double?durationSeconds, MessageBoxIcon noticeIcon)
 {
     if (NoticeWindow.Instance == null)
     {
         var window = new NoticeWindow();
         window.Show();
     }
     NoticeWindow.Instance.AddNotice(message, title, durationSeconds, noticeIcon);
 }