public void ShowBalloon(string title, string text, NotifyInfoFlags type, int timeoutInMilliSeconds) { if (timeoutInMilliSeconds < 0) { throw new ArgumentException("The parameter must be positive", "timeoutInMilliseconds"); } NotifyIconData data = new NotifyIconData(); data.cbSize = (uint)Marshal.SizeOf(data); disp.Invoke(new Action(() => { data.hWnd = m_messageSink.Handle; data.uID = m_id; data.uFlags = NotifyFlags.Info; data.dwTimeoutOrVersion = timeoutInMilliSeconds; // this value does not seem to work - any ideas? data.szInfoTitle = title; data.szInfo = text; data.dwInfoFlags = type; Shell_NotifyIcon(NotifyCommand.Modify, ref data); })); }
/* * private void statusMonitor_Polled(object sauce, PolledEventArgs e) * { * _exception = null; * * // update tray icon and tooltip * trayIcon.Text = CalculateTrayText(e.ProjectStatus); * trayIcon.Icon = GetStatusIcon(e.ProjectStatus); * } * * private void statusMonitor_BuildOccurred(object sauce, BuildOccurredEventArgs e) * { * _exception = null; * * string caption = e.BuildTransitionInfo.Caption; * string description = settings.Messages.GetMessageForTransition(e.BuildTransition); * NotifyInfoFlags icon = GetNotifyInfoFlag(e.BuildTransitionInfo.ErrorLevel); * * HandleBalloonNotification(caption, description, icon); * * // play audio, in accordance to settings * PlayBuildAudio(e.BuildTransition); * } * * Exception _exception; * * private void statusMonitor_Error(object sender, ErrorEventArgs e) * { * System.Diagnostics.Debug.WriteLine(e.Exception.ToString()); * * if (_exception==null && settings.ShowExceptions) * { * // set the exception before displaying the dialog, because the timer keeps polling and subsequent * // polls would otherwise cause multiple dialogs to be displayed * _exception = e.Exception; * * MessageBox.Show(e.Exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * * _exception = e.Exception; * * trayIcon.Text = GetErrorMessage(e.Exception); * trayIcon.Icon = GetStatusIcon(BuildStatus.Unknown); * } */ #endregion #region Balloon notification private void HandleBalloonNotification(string caption, string description, NotifyInfoFlags icon) { // show a balloon if (settings.NotificationBalloon.ShowBalloon) { trayIcon.ShowBalloon(caption, description, icon, 5000); } }
public void Project_OnError(object sender, PollingErrorEventArgs e) { Project project = e.Project; string caption = "Connection Failed for " + project.Name; string description = "URL: " + project.XmlRpcUrl; NotifyInfoFlags icon = NotifyInfoFlags.Error; HandleBalloonNotification(caption, description, icon); }
public void Project_OnBuildOccurred(object sauce, BuildOccurredEventArgs e) { string caption = e.BuildTransitionInfo.Caption + ": " + e.ProjectStatus.Name; string description = "Total time: " + e.ProjectStatus.DurationAsString; NotifyInfoFlags icon = GetNotifyInfoFlag(e.BuildTransitionInfo.ErrorLevel); HandleBalloonNotification(caption, description, icon); // play audio, in accordance to settings PlayBuildAudio(e.BuildTransition); }
public void ShowBalloon(string title, string text, NotifyInfoFlags type, uint timeoutInMilliSeconds) { NOTIFYICONDATA data = CreateNotifyStruct(NotifyFlags.NIF_INFO, true); data.uTimeoutOrVersion = timeoutInMilliSeconds; // this value does not seem to work - any ideas? data.szInfoTitle = title; data.szInfo = text; data.dwInfoFlags = type; WindowsAPI.Shell_NotifyIcon(NotifyCommand.NIM_MODIFY, ref data); }
public void ShowBalloon( string title, string text, NotifyInfoFlags type, uint timeoutInMilliSeconds ) { NOTIFYICONDATA data = CreateNotifyStruct( NotifyFlags.NIF_INFO, true ); data.uTimeoutOrVersion = timeoutInMilliSeconds; // this value does not seem to work - any ideas? data.szInfoTitle = title; data.szInfo = text; data.dwInfoFlags = type; WindowsAPI.Shell_NotifyIcon( NotifyCommand.NIM_MODIFY, ref data ); }
public void ShowBalloon(string title, string text, NotifyInfoFlags type, int timeoutInMilliSeconds) { if(timeoutInMilliSeconds < 0) throw new ArgumentException("The parameter must be positive", "timeoutInMilliseconds"); NotifyIconData data = new NotifyIconData(); data.cbSize = (uint)Marshal.SizeOf(data); data.hWnd = m_messageSink.Handle; data.uID = m_id; data.uFlags = NotifyFlags.Info; data.uTimeoutOrVersion = (uint)timeoutInMilliSeconds; // this value does not seem to work - any ideas? data.szInfoTitle = title; data.szInfo = text; data.dwInfoFlags = type; Shell_NotifyIcon(NotifyCommand.Modify, ref data); }