public Bubbles() { Controller.ShowBubbleEvent += delegate(string title, string subtext, string image_path) { InvokeOnMainThread(delegate { 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("")); } }); }; }
partial void startStopAction(NSButton sender) { if (sender.Title == "Start") { counter.Start(); sender.Title = "Stop"; GrowlApplicationBridge.Notify("The two-minute rule is magic.", "You now have two minutes to Get Your Things Done.", "Start", null, 0, false, null); } else { counter.Stop(); sender.Title = "Start"; if (counter.TimerMark.Minutes > 0 && counter.TimerMark.Seconds > 0) { GrowlApplicationBridge.Notify("Action Completed", String.Format("You still have {0} left. Step back and breath. " + "Take a second and contemplate what you have achieved. " + "You'll be suprised how many two-minute actions you can " + "perform even on your most critical projects", counter.TimeLeft), "Stop", null, 0, true, null); } } }
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("")); } }); }; }
/// <summary> /// Notification thu Growl. See MonoMac.Growl.GrowlApplicationBridge.Notify /> /// </summary> /// <param name="title"> /// Title /// </param> /// <param name="description"> /// Description /// </param> /// <param name="notification"> /// Notification id /// </param> /// <param name="iconData"> /// the icon data - use NSIMage.AsTiff to get it or Growl.DefaultIcon for the default icon /// </param> /// <param name="priority"> /// Priority /// </param> /// <param name="isSticky"> /// Is Sticky /// </param> /// <param name="clickContext"> /// Callback context /// </param> public void Notify(string title, string description, TNotifications notification, NSData iconData, int priority, bool isSticky, NSObject clickContext) { GrowlApplicationBridge.Notify(title, description, notification.ToString(), iconData, priority, isSticky, clickContext); }