public override void ForwardNotification(Growl.Connector.Notification notification, Growl.Connector.CallbackContext callbackContext, Growl.Connector.RequestInfo requestInfo, bool isIdle, ForwardedNotificationCallbackHandler callbackFunction) { Growl.UDPLegacy.NotificationType nt = new Growl.UDPLegacy.NotificationType(notification.Name, true); Growl.UDPLegacy.MessageSender netgrowl = new Growl.UDPLegacy.MessageSender(this.IPAddress, this.Port, notification.ApplicationName, this.Password); netgrowl.Notify(nt, notification.Title, notification.Text, notification.Priority, notification.Sticky); }
public override void ForwardRegistration(Growl.Connector.Application application, List <Growl.Connector.NotificationType> notificationTypes, Growl.Connector.RequestInfo requestInfo, bool isIdle) { Growl.UDPLegacy.NotificationType[] types = new Growl.UDPLegacy.NotificationType[notificationTypes.Count]; for (int i = 0; i < notificationTypes.Count; i++) { Growl.Connector.NotificationType notificationType = notificationTypes[i]; Growl.UDPLegacy.NotificationType nt = new Growl.UDPLegacy.NotificationType(notificationType.Name, notificationType.Enabled); types[i] = nt; } Growl.UDPLegacy.MessageSender netgrowl = new Growl.UDPLegacy.MessageSender(this.IPAddress, this.Port, application.Name, this.Password); netgrowl.Register(ref types); }
/// <summary> /// Returns the associated <see cref="NotificationType"/> given the type's name /// </summary> /// <param name="name">The common name of the type of notification</param> /// <returns><see cref="NotificationType"/></returns> public static NotificationType GetByName(string name) { // TODO: NotificationType nt = new NotificationType(name, false); return nt; }
/// <summary> /// Registers the application with Growl /// </summary> /// <param name="notificationTypes">Array of <see cref="NotificationType"/>s that the application will be sending</param> /// <remarks> /// An application must register before it can send notifications. If notifications are send and the application is not /// registered, the notifications will be ignored and discarded. If an application is already registered and calls /// <c>Register</c> again, the list of notifications that the application is allowed to send will be updated. Remote /// applications can only send notifications if they register remotely, requiring the user to 'Allow Remote Registrations'. /// </remarks> public void Register(ref NotificationType[] notificationTypes) { if (notificationTypes != null && notificationTypes.Length > 0) { List<NotificationType> ntList = new List<NotificationType>(); ntList.AddRange(notificationTypes); RegistrationPacket packet = new RegistrationPacket(protocolVersion, this.applicationName, this.password, ntList); Send(packet); } }
/// <summary> /// Sends a notification, setting all available parameters /// </summary> /// <param name="notificationType">The <see cref="NotificationType">type</see> of notification</param> /// <param name="title">The title of the notification</param> /// <param name="description">The description or extended information of the notifications</param> /// <param name="priority">The <see cref="Priority"/> of the notification</param> /// <param name="sticky"><c>true</c> to request that the notification is sticky, <c>false</c> to request the notification be not sticky</param> public void Notify(NotificationType notificationType, string title, string description, Growl.Connector.Priority priority, bool sticky) { NotificationPacket packet = new NotificationPacket(protocolVersion, this.applicationName, this.password, notificationType, title, description, priority, sticky); Send(packet); }
/// <summary> /// Sends a basic notification, setting only the title /// </summary> /// <param name="notificationType">The <see cref="NotificationType">type</see> of notification</param> /// <param name="title">The title of the notification</param> /// <remarks> /// This method is <c>ComVisible(false)</c> since some COM languages do not allow method overloading. /// </remarks> public void Notify(NotificationType notificationType, string title) { Notify(notificationType, title, "", Growl.Connector.Priority.Normal, false); }
public override void ForwardRegistration(Growl.Connector.Application application, List<Growl.Connector.NotificationType> notificationTypes, Growl.Connector.RequestInfo requestInfo, bool isIdle) { Growl.UDPLegacy.NotificationType[] types = new Growl.UDPLegacy.NotificationType[notificationTypes.Count]; for (int i = 0; i < notificationTypes.Count; i++) { Growl.Connector.NotificationType notificationType = notificationTypes[i]; Growl.UDPLegacy.NotificationType nt = new Growl.UDPLegacy.NotificationType(notificationType.Name, notificationType.Enabled); types[i] = nt; } Growl.UDPLegacy.MessageSender netgrowl = new Growl.UDPLegacy.MessageSender(this.IPAddress, this.Port, application.Name, this.Password); netgrowl.Register(ref types); }