コード例 #1
0
        // ReSharper disable once MemberCanBePrivate.Global
        internal void ShowDefaultBalloonTip(object sender, MouseEventArgs e)
        {
            if (string.IsNullOrEmpty(DefaultTipText) || string.IsNullOrEmpty(DefaultTipTitle))
            {
                return;
            }
            lock (this)
            {
                if (HaveRegisteredClickHandlers())
                {
                    return;
                }
                if (_showingDefaultBalloonTip)
                {
                    return;
                }
                _showingDefaultBalloonTip = true;
            }

            ShowBalloonTipFor(
                DefaultBalloonTipTimeout,
                DefaultTipTitle,
                DefaultTipText,
                ToolTipIcon.Info,
                DefaultBalloonTipClickedAction,
                () =>
            {
                _showingDefaultBalloonTip = false;
                _balloonTipClickHandlers  = null;
                var closedAction          = DefaultBalloonTipClosedAction;
                closedAction?.Invoke();
            });
        }
コード例 #2
0
ファイル: TrayIcon.cs プロジェクト: tammylotter/PeanutButter
 /// <inheritdoc />
 public void ShowBalloonTipFor(int timeoutInMilliseconds, string title, string text, ToolTipIcon icon,
                               Action clickAction = null, Action closeAction = null)
 {
     lock (this)
     {
         _balloonTipClickHandlers = new BalloonTipClickHandlerRegistration(clickAction, closeAction);
     }
     NotificationIcon.ShowBalloonTip(timeoutInMilliseconds, title, text, icon);
 }