Search code examples
c#binary-datagrowl-for-windows

Growl for windows, custom subscriber - How to set notification properties in code? e.g. Sound


Trying to set certain properties for an applications notifications in Growl for Windows. (Properties being: duration, sticky, priority and sound)...

So, for example, I'm creating a new application, giving it a name etc.

Application application = new Application(this.AppName)
{
   Icon = FeedSubscriptionHandler.Icon,

};

Then I create a new notification type and attempt to add a custombinary attribute (for sound).

NotificationType ntNewFeedItem; 

ntNewFeedItem.CustomBinaryAttributes.Add("Sound", new BinaryData(bytes));

The growl app doesn't seem to be picking up the custombinaryattribute, with the byte array.

And when compiling my feed subscription project and moving the feedmonitor dll into the growl appdata subscribers folder, growl crashes on runtime with this eventviewer message:

An item with the same key has already been added.

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)
at GrowlExtras.Subscriptions.FeedMonitor.FeedSubscription.Subscribe() at Growl.SubscriptionManager.Update(Subscription subscription, Boolean enabled) at Growl.Controller.AddSubscription(Subscription subscription) at Growl.AddComputer.buttonSave_Click(Object sender, EventArgs e)

So, after some playing around it seems that growl doesn't like having the "already existing" "Sound" key re-added as such.


Solution

  • Answered your question in the Growl for Windows group here: http://groups.google.com/group/growl-for-windows/browse_thread/thread/4d633f531c9451e3?hl=en