Пример #1
0
        private void HandleShowBallon(object sender, ShowBalloonEventArgs e)
        {
            _growlNotifications.AddNotification(new Notification
            {
                Title    = e.Title,
                ImageUrl = e.ToastImageResource,    //"pack://application:,,,/Wpf/Resources/bolt_32x32.png",
                Message  = e.Message
            });

            _notifyIcon.Icon = e.TrayIcon;
            //_notifyIcon.ShowBalloonTip(e.Timeout,e.Title,e.Message,ToolTipIcon.None);
        }
Пример #2
0
        private void UserStateListenerUserStateChanged(object sender, UserMessageEventArgs e)
        {
            ShowBalloonEventArgs eventArgs = null;
            var icon = _iconFactory.Get(_userStateListener.CurrentTimeWarpState);

            switch (e.UpdatedState)
            {
            case (TimeWarpStateUserMessage.TakeABreak):
                eventArgs = new ShowBalloonEventArgs(1000, "Time Warp", "Take a break!", icon, "pack://application:,,,/Wpf/Resources/moon_stroke_32x32.png");
                break;

            case (TimeWarpStateUserMessage.TimeToWork):
                eventArgs = new ShowBalloonEventArgs(1000000, "Time Warp", "time to start working", icon, "pack://application:,,,/Wpf/Resources/bolt_32x32.png");
                break;

            case (TimeWarpStateUserMessage.Working):
            {
                string message;
                if (e.TimeWarpAgent == TimeWarpAgent.Unknown || e.TimeWarpAgent == TimeWarpAgent.WindowsTrayClient)
                {
                    message = "Timer started..";
                }
                else if (e.TimeWarpAgent == TimeWarpAgent.VisualStudio)
                {
                    message = "Triggered by Visual Studio";
                }
                else
                {
                    message = "Triggered by " + e.TimeWarpAgent;
                }

                eventArgs = new ShowBalloonEventArgs(1000, "Time Warp - Work started", message, icon, "pack://application:,,,/Wpf/Resources/bolt_32x32.png");
                break;
            }
            }

            EventHandler <ShowBalloonEventArgs> handler = ShowBallon;

            if (handler != null)
            {
                handler(this, eventArgs);
            }
        }