示例#1
0
        public void DisplayNotification(TestResults results)
        {
            Notification notification;

            if (IsSuccess(results))
            {
                notification = new Notification(ApplicationName, Success, "1", "Pass", BuildSuccessDisplayText(results))
                                   {
                                       Priority = Priority.Normal
                                   };
            }
            else if(IsFail(results))
            {
                notification = new Notification(ApplicationName, Failed, "2", "Fail", BuildFailDisplayText(results))
                                   {
                                       Priority = Priority.High
                                   };
            }
            else
            {
                notification = new Notification(ApplicationName, Inconclusive, "3", "Inconclusive", BuildInconclusiveDisplayText(results))
                                   {
                                       Priority = Priority.VeryLow
                                   };
            }

            _growl.Notify(notification);
        }
        /// <summary>
        /// Sends a Torrent started notification.
        /// </summary>
        /// <param name="torrent">Started Torrent to notify.</param>
        public void sendOnTorrentStarted(Torrent torrent)
        {
            /*
            // torrent has been queued
            if (torrent.status_message.Equals("Queued"))
            {
                // format language
                StringBuilder body = new StringBuilder("[torrent_name]");
                body.Replace("[torrent_name]", torrent.name);
                
                // notify
                GC.Notification notification = new GC.Notification(Configuration.application_name, "STARTED", null, "Queued", body.ToString());
                Configuration.growl.Notify(notification);
                
                torrent.notified_started = true;
            }
             */

            // torrent has started
            if (torrent.status_message.Equals("Downloading"))
            {
                // format language
                StringBuilder body = new StringBuilder("[torrent_name]");
                body.Replace("[torrent_name]", torrent.name);

                // notify
                GC.Notification notification = new GC.Notification(Configuration.application_name, "STARTED", null, "Downloading", body.ToString());
                Configuration.growl.Notify(notification);
                
                torrent.notified_started = true;
            }
        }
        /// <summary>
        /// Sends a notification to Growl
        /// </summary>
        /// <param name="notificationType">The <see cref="NotificationType">type</see> of notification to send</param>
        /// <param name="title">The notification title</param>
        /// <param name="text">The notification text</param>
        /// <param name="imageUrl">The notification image as a url</param>
        public static void Notify(NotificationType notificationType, string title, string text, string imageUrl)
        {
            Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title, text);
            notification.Icon = imageUrl;

            growl.Notify(notification);
        }
示例#4
0
 public void DisplayResult(ExecutionResult result)
 {
     var title = result.ExitCode == 0 ? "Success!" : "Failures!";
     Resource icon = result.ExitCode == 0 ? LoadImage(successImage) : LoadImage(failureImage);
     var notification = new Notification(application.Name, notificationType.Name, DateTime.Now.Ticks.ToString(), title, result.Output) { Icon = icon };
     growl.Notify(notification);
 }
        public static void Notify(Account account)
        {
            string title = Localization.Locale.Current.Growl.NewMessage;
            string message;

            if (account.Emails.Count < 0) {
                return;
            }
            else if (account.Emails.Count == 1) {
                Email email = account.Emails[0];
                message = string.Format(
                    Localization.Locale.Current.Growl.NewMessageFrom,
                    email.Title, email.From);
            }
            else {
                message = string.Format(
                    Localization.Locale.Current.Growl.HasNewMessages,
                    account.Name, account.Emails.Count);
            }
            Notification notification = new Notification(
                Resources.WindowTitle,
                MessageTypes.NEWMESSAGE.ToString(),
                null,
                title,
                message
            );
            Growl.Notify(notification);
        }
示例#6
0
        private void button2_Click(object sender, EventArgs e)
        {
            CallbackContext callbackContext = new CallbackContext("some fake information", "fake data");

            Notification notification = new Notification(this.application.Name, this.notificationType.Name, DateTime.Now.Ticks.ToString(), this.textBox2.Text, this.textBox3.Text);
            this.growl.Notify(notification, callbackContext);
        }
示例#7
0
 public void DisplayMessage(string message, params object[] parameters)
 {
     const string title = "Giles says...";
     var text = string.Format(message.ScrubDisplayStringForFormatting(), parameters);
     var notification = new Notification(application.Name, notificationType.Name, DateTime.Now.Ticks.ToString(), title, text);
     growl.Notify(notification);
 }
示例#8
0
 public static void simpleGrowl(string title, string message = "")
 {
     GrowlConnector simpleGrowl = new GrowlConnector();
     global::Growl.Connector.Application thisApp = new global::Growl.Connector.Application("Forseti");
     NotificationType simpleGrowlType = new NotificationType(GrowlType, "JavaScript test/spec result");
     simpleGrowl.Register(thisApp, new NotificationType[] { simpleGrowlType });
     Notification myGrowl = new Notification("Forseti", GrowlType, title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
示例#9
0
 public void Notify(string title, string message = "", NotificationType notificationType = NotificationType.None)
 {
     var simpleGrowl = new GrowlConnector();
     var thisApplication = new Growl.Connector.Application("Jubilee");
     var simpleGrowlType = new Growl.Connector.NotificationType("SIMPLEGROWL");
     simpleGrowl.Register(thisApplication, new Growl.Connector.NotificationType[] { simpleGrowlType });
     var myGrowl = new Notification("Jubilee", "SIMPLEGROWL", title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
示例#10
0
 public void Pester()
 {
     while(_messages.Count > 0) {
     var message = _messages.Dequeue();
     Notification growlMessage = new Notification(
       _application, "SIMPLEGROWL", Guid.NewGuid().ToString(), message.Title, message.Content);
     _growl.Notify(growlMessage);
       }
 }
示例#11
0
 public static void simpleGrowl(string title, string message = "")
 {
     var simpleGrowl = new GrowlConnector();
     var thisApp = new Growl.Connector.Application(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
     var simpleGrowlType = new NotificationType("SIMPLEGROWL");
     simpleGrowl.Register(thisApp, new NotificationType[] { simpleGrowlType });
     var myGrowl = new Notification(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, "SIMPLEGROWL", title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
		private void Monitor_Polled(object sender, MonitorPolledEventArgs args)
		{
			if (lastStatus != monitor.SummaryStatusString)
			{
				lastStatus = monitor.SummaryStatusString;
				Notification notification = new Notification(ApplicationName, "Message", null, "CCTray", monitor.SummaryStatusString);
				growl.Notify(notification);
			}
		}
示例#13
0
 public static void simpleGrowl(string title, string message = "")
 {
     GrowlConnector simpleGrowl = new GrowlConnector();
     Growl.Connector.Application thisApp = new Growl.Connector.Application(System.Windows.Forms.Application.ProductName);
     NotificationType simpleGrowlType = new NotificationType("SIMPLEGROWL");
     simpleGrowl.Register(thisApp, new NotificationType[] { simpleGrowlType });
     Notification myGrowl = new Notification(System.Windows.Forms.Application.ProductName, "SIMPLEGROWL", title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
示例#14
0
        public void SendNotification(string title, string message, string notificationTypeName, string hostname, int port, string password)
        {
            var notificationType = _notificationTypes.Single(n => n.Name == notificationTypeName);
            var notification     = new GrowlNotification("NzbDrone", notificationType.Name, DateTime.Now.Ticks.ToString(), title, message);

            _growlConnector = new GrowlConnector(password, hostname, port);

            Logger.Debug("Sending Notification to: {0}:{1}", hostname, port);
            _growlConnector.Notify(notification);
        }
示例#15
0
        public void SendNotification(string title, string message, string notificationTypeName, string hostname, int port, string password)
        {
            var notificationType = _notificationTypes.Single(n => n.Name == notificationTypeName);
            var notification = new GrowlNotification("NzbDrone", notificationType.Name, DateTime.Now.Ticks.ToString(), title, message);

            _growlConnector = new GrowlConnector(password, hostname, port);

            _logger.Debug("Sending Notification to: {0}:{1}", hostname, port);
            _growlConnector.Notify(notification);
        }
        public override void ForwardNotification(Growl.Connector.Notification notification, Growl.Connector.CallbackContext callbackContext, Growl.Connector.RequestInfo requestInfo, bool isIdle, ForwardedNotificationCallbackHandler callbackFunction)
        {
            Forwarder growl = new Forwarder(this.Password, this.IPAddress, this.Port, requestInfo);

            growl.KeyHashAlgorithm    = this.HashAlgorithm;
            growl.EncryptionAlgorithm = this.EncryptionAlgorithm;
#if DEBUG
            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
#endif
            growl.ForwardedNotificationCallback += callbackFunction;
            growl.Notify(notification, callbackContext);
        }
示例#17
0
        public void SendNotification(string title, string message, string notificationTypeName, string hostname, int port, string password)
        {
            _logger.Debug("Sending Notification to: {0}:{1}", hostname, port);

            var notificationType = _notificationTypes.Single(n => n.Name == notificationTypeName);
            var notification = new GrowlNotification(_growlApplication.Name, notificationType.Name, DateTime.Now.Ticks.ToString(), title, message);

            var growlConnector = GetGrowlConnector(hostname, port, password);

            var requestState = new GrowlRequestState();
            growlConnector.Notify(notification, requestState);
            requestState.Wait(5000);
        }
示例#18
0
        public void SendNotification()
        {
            // TODO: deal with the situation when Growl is not running by adding a timeout for every notification.
            if (!_isNotificationActive)
            {
                CallbackContext callbackContext = new CallbackContext("some fake information", "fake data");

                Notification notification = new Notification(this.application.Name, this.notificationType.Name,
                                                             DateTime.Now.Ticks.ToString(), "usb",
                                                             "Knock, Knock");
                _isNotificationActive = true;
                this.growl.Notify(notification, callbackContext);
            }
        }
示例#19
0
        public void SendNotification(string title, string message, string notificationTypeName, string hostname, int port, string password)
        {
            _logger.Debug("Sending Notification to: {0}:{1}", hostname, port);

            var notificationType = _notificationTypes.Single(n => n.Name == notificationTypeName);
            var notification     = new GrowlNotification(_growlApplication.Name, notificationType.Name, DateTime.Now.Ticks.ToString(), title, message);

            var growlConnector = GetGrowlConnector(hostname, port, password);

            var requestState = new GrowlRequestState();

            growlConnector.Notify(notification, requestState);
            requestState.Wait(5000);
        }
示例#20
0
 public void Notify(string title, string message, bool success)
 {
     Notification notification = null;
     if (success)
         notification = new Notification(_application.Name, _notificationTypeSucces.Name,
                                         DateTime.Now.Ticks.ToString(),
                                         title, message);
     else
     {
         notification = new Notification(_application.Name, _notificationTypeFailure.Name, DateTime.Now.Ticks.ToString(),
                          title, message);
     }
     _growl.Notify(notification);
 }
示例#21
0
        public void Notify(string applicationName, Notification notification, CallbackContext callbackContext)
        {
            if (String.IsNullOrEmpty(applicationName))
            {
                throw new ArgumentException("The application name cannot be null or empty", "applicationName");
            }
            if (notification == null)
            {
                throw new ArgumentException("The notification cannot be null");
            }

            Growl.Connector.Notification    n   = notification.UnderlyingNotification;
            Growl.Connector.CallbackContext cbc = (callbackContext != null ? callbackContext.UnderlyingCallbackContext : null);
            this.growl.Notify(n, cbc);
        }
        /// <summary>
        /// Sends a Torrent completion notification.
        /// </summary>
        /// <param name="torrent">Completed Torrent to notify.</param>
        public void sendOnTorrentCompletion(Torrent torrent)
        {
            // torrent has finished
            if (torrent.status_message.Equals("Finished") || torrent.status_message.Equals("Seeding"))
            {
                // format language
                StringBuilder body = new StringBuilder("[torrent_name]");
                body.Replace("[torrent_name]", torrent.name);

                // notify
                GC.Notification notification = new GC.Notification(Configuration.application_name, "COMPLETED", null, "Completed", body.ToString());
                Configuration.growl.Notify(notification);
                
                torrent.notified_completed = true;
            }
        }
        public void sendNotification(string track, string artist)
        {
            string CoverUrl = getAlbumArt(track, artist);

            //Notification specific icon.
            Growl.CoreLibrary.Resource Icon = !String.IsNullOrEmpty(CoverUrl) ? CoverUrl : getCurrentWorkingDirectory();
            Priority priority = 0;

            //If no artist metadata is found set Artist=UNKNOWN
            if(String.IsNullOrEmpty(artist))
                artist = "UNKNOWN";

            Notification notification = new Notification("Spotify", "SPOTIFYNOTIFICATION", null, artist, track,Icon,false,priority,null);

            //Notify growl.
            growl.Notify(notification);
        }
        /// <summary>
        /// Sends a notification to Growl that specifies callback information and allows for additional request data.
        /// </summary>
        /// <param name="notification">The <see cref="Notification"/> to send.</param>
        /// <param name="callbackContext">The <see cref="CallbackContext"/> containing the callback information.</param>
        /// <param name="requestData">The <see cref="RequestData"/> containing the additional information.</param>
        /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
        public virtual void Notify(Notification notification, CallbackContext callbackContext, RequestData requestData, object state)
        {
            bool waitForCallback = false;
            HeaderCollection notificationHeaders = notification.ToHeaders();
            MessageBuilder mb = new MessageBuilder(RequestType.NOTIFY, this.GetKey());
            foreach (Header header in notificationHeaders)
            {
                mb.AddHeader(header);
            }

            if (callbackContext != null)
            {
                string url = callbackContext.CallbackUrl;
                if (!String.IsNullOrEmpty(url))
                {
                    mb.AddHeader(new Header(Header.NOTIFICATION_CALLBACK_TARGET, url));
                }
                else
                {
                    mb.AddHeader(new Header(Header.NOTIFICATION_CALLBACK_CONTEXT, callbackContext.Data));
                    mb.AddHeader(new Header(Header.NOTIFICATION_CALLBACK_CONTEXT_TYPE, callbackContext.Type.ToString()));
                    waitForCallback = true;
                }
            }

            // handle any additional request data
            if (requestData != null)
            {
                HeaderCollection requestDataHeaders = requestData.ToHeaders();
                foreach (Header header in requestDataHeaders)
                {
                    mb.AddHeader(header);
                }
            }

            Send(mb, OnResponseReceived, waitForCallback, state);
        }
 /// <summary>
 /// Sends a notification to Growl that specifies callback information.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 /// <param name="callbackContext">The <see cref="CallbackContext"/> containing the callback information.</param>
 /// <param name="requestData">The <see cref="RequestData"/> containing the additional information.</param>
 public virtual void Notify(Notification notification, CallbackContext callbackContext, RequestData requestData)
 {
     Notify(notification, callbackContext, requestData, null);
 }
 /// <summary>
 /// Sends a notification to Growl that specifies callback information.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 /// <param name="callbackContext">The <see cref="CallbackContext"/> containing the callback information.</param>
 /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
 public virtual void Notify(Notification notification, CallbackContext callbackContext, object state)
 {
     Notify(notification, callbackContext, null, state);
 }
 /// <summary>
 /// Sends a notification to Growl that specifies callback information.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 /// <param name="callbackContext">The <see cref="CallbackContext"/> containing the callback information.</param>
 public virtual void Notify(Notification notification, CallbackContext callbackContext)
 {
     Notify(notification, callbackContext, null, null);
 }
 /// <summary>
 /// Sends a notification to Growl and allows for additional request data.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 /// <param name="requestData">The <see cref="RequestData"/> containing the additional information.</param>
 /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
 public virtual void Notify(Notification notification, RequestData requestData, object state)
 {
     Notify(notification, null, requestData, state);
 }
		private void Monitor_BuildOccurred(object sender, MonitorBuildOccurredEventArgs e)
		{
			if (e.BuildTransition.ErrorLevel.NotifyInfo < this.configuration.MinimumNotificationLevel)
			    return;

			string projectName = e.ProjectMonitor.Detail.ProjectName;

			
			CaptionAndMessage captionAndMessage = GetCaptionAndMessageForBuildTransition(e.BuildTransition);
			string caption = string.Format(System.Globalization.CultureInfo.CurrentCulture,"{0}: {1} ",
			                               projectName, captionAndMessage.Caption);

            Notification notification = new Notification(ApplicationName, caption, null, projectName, captionAndMessage.Message);
			growl.Notify(notification);
		}
 /// <summary>
 /// Sends a notification to Growl.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 public virtual void Notify(Notification notification)
 {
     Notify(notification, null, null);
 }
 internal abstract void ForwardNotification(Growl.Connector.Notification notification, Growl.Daemon.CallbackInfo callbackInfo, Growl.Daemon.RequestInfo requestInfo, bool isIdle, Forwarder.ForwardedNotificationCallbackHandler callbackFunction);
 /// <summary>
 /// Called when a notification is received by GfW.
 /// </summary>
 /// <param name="notification">The notification information</param>
 /// <param name="callbackContext">The callback context.</param>
 /// <param name="requestInfo">The <see cref="Growl.Connector.RequestInfo"/> associated with the notification request</param>
 /// <param name="isIdle"><c>true</c> if the user is currently idle;<c>false</c> otherwise</param>
 /// <param name="callbackFunction">The function GfW will run if this notification is responded to on the forwarded computer</param>
 /// <remarks>
 /// Unless your forwarder is going to handle socket-style callbacks from the remote computer, you should ignore
 /// the <paramref name="callbackFunction"/> parameter.
 /// </remarks>
 public abstract void ForwardNotification(Growl.Connector.Notification notification, Growl.Connector.CallbackContext callbackContext, Growl.Connector.RequestInfo requestInfo, bool isIdle, ForwardedNotificationCallbackHandler callbackFunction);
		private void Monitor_MessageReceived(string projectName, Message message)
		{
			Notification notification = new Notification(ApplicationName, "Message", null, projectName, message.ToString());
			growl.Notify(notification);
		}
 /// <summary>
 /// Sends a notification to Growl.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
 public virtual void Notify(Notification notification, object state)
 {
     Notify(notification, null, null, state);
 }
示例#35
0
        void device_values_DeviceValueDataChangedEvent(object sender, device_values.ValueDataChangedEventArgs args)
        {
            if (IsReady)
            {
                using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
                {
                    device_values dv = db.device_values.FirstOrDefault(v => v.id == args.device_value_id);
                    if (dv != null)
                    {

                        string[] deviceTypeValuespairs = GetSettingValue("NOTIFICATIONS").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string deviceTypeValuespair in deviceTypeValuespairs)
                        {
                            string thisEvent = dv.device.device_types.name + ":" + dv.label_name;

                            if (thisEvent.Equals(deviceTypeValuespair.Trim()))
                            {
                                Notification notification = new Notification("zVirtualScenes", NOTIFY_DEVICE_VALUE_CHANGE, "0", dv.device.friendly_name + " " + dv.label_name, "Changed to " + dv.value + " from " + args.previousValue + ".");
                                GrowlConnector.Notify(notification);
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Sends a notification to Growl and allows for additional request data.
 /// </summary>
 /// <param name="notification">The <see cref="Notification"/> to send.</param>
 /// <param name="requestData">The <see cref="RequestData"/> containing the additional information.</param>
 public virtual void Notify(Notification notification, RequestData requestData)
 {
     Notify(notification, null, requestData, null);
 }