Esempio n. 1
0
        private void ShowNotificationBalloon(int timeout, string title, string message, ToolTipIcon icon)
        {
            BalloonParameters parms = new BalloonParameters(timeout, title, message, icon);

            BackgroundWorker background_BalloonTip = new BackgroundWorker();

            background_BalloonTip.WorkerSupportsCancellation = true;
            background_BalloonTip.DoWork             += background_BalloonTip_DoWork;
            background_BalloonTip.RunWorkerCompleted += background_BalloonTip_RunWorkerCompleted;
            background_BalloonTip.RunWorkerAsync(parms);
        }
Esempio n. 2
0
        private void background_BalloonTip_DoWork(object sender, DoWorkEventArgs e)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "BalloonTip";
            }

            if (_settings != null &&
                _settings.Options != null &&
                _settings.Options.Rows.Count > 0 &&
                !_settings.Options.FirstOrDefault().ShowNotifications)
            {
                return;
            }

            BalloonParameters bparms = (BalloonParameters)e.Argument;

            if (bparms.Timeout == 0)
            {
                bparms.Timeout = int.MaxValue;
            }

            if (bparms.Timeout < 0)
            {
                return;
            }

            if (bparms.Icon == ToolTipIcon.Warning || bparms.Icon == ToolTipIcon.Error)
            {
                settingsNotifyIcon.BalloonTipClicked += settingsNotifyIcon_BalloonTipClicked;
            }

            settingsNotifyIcon.ShowBalloonTip(bparms.Timeout, bparms.Title, bparms.Message, bparms.Icon);

            Thread.Sleep(bparms.Timeout);
        }
Esempio n. 3
0
        private void ShowNotificationBalloon(int timeout, string title, string message, ToolTipIcon icon)
        {
            BalloonParameters parms = new BalloonParameters(timeout, title, message, icon);

            BackgroundWorker background_BalloonTip = new BackgroundWorker();
            background_BalloonTip.WorkerSupportsCancellation = true;
            background_BalloonTip.DoWork += background_BalloonTip_DoWork;
            background_BalloonTip.RunWorkerCompleted += background_BalloonTip_RunWorkerCompleted;
            background_BalloonTip.RunWorkerAsync(parms);
        }