Example #1
0
        public SparkleBubbles()
        {
            this.controller.ShowBubbleEvent += delegate(string title, string subtext, string image_path) {
                InvokeOnMainThread(delegate {
                    if (!GrowlApplicationBridge.IsGrowlRunning())
                    {
                        NSApplication.SharedApplication.RequestUserAttention(
                            NSRequestUserAttentionType.InformationalRequest);

                        return;
                    }

                    if (NSApplication.SharedApplication.DockTile.BadgeLabel == null)
                    {
                        NSApplication.SharedApplication.DockTile.BadgeLabel = "1";
                    }
                    else
                    {
                        int events = int.Parse(NSApplication.SharedApplication.DockTile.BadgeLabel);
                        NSApplication.SharedApplication.DockTile.BadgeLabel = (events + 1).ToString();
                    }

                    if (image_path != null)
                    {
                        NSData image_data = NSData.FromFile(image_path);
                        GrowlApplicationBridge.Notify(title, subtext,
                                                      "Event", image_data, 0, false, new NSString(""));
                    }
                    else
                    {
                        GrowlApplicationBridge.Notify(title, subtext,
                                                      "Event", null, 0, false, new NSString(""));
                    }
                });
            };
        }