3
using System.Collections.Generic;
5
using MonoMac.Foundation;
9
namespace TwoMinuteGrowler {
10
public partial class MainWindowController : MonoMac.AppKit.NSWindowController {
11
CountDownTimer counter;
13
public MainWindowController (IntPtr handle) : base (handle) { }
15
[Export("initWithCoder:")]
16
public MainWindowController (NSCoder coder) : base(coder) { }
18
public MainWindowController () : base("MainWindow") { }
21
public override void AwakeFromNib ()
23
GrowlApplicationBridge.WeakDelegate = this;
24
counter = new CountDownTimer ();
25
Bind ("countDown", counter, "timeLeft", null);
28
partial void startStopAction (NSButton sender)
30
if (sender.Title == "Start") {
32
sender.Title = "Stop";
33
GrowlApplicationBridge.Notify ("The two-minute rule is magic.",
34
"You now have two minutes to Get Your Things Done.", "Start", null, 0, false, null);
37
sender.Title = "Start";
38
if (counter.TimerMark.Minutes > 0 && counter.TimerMark.Seconds > 0)
39
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);
44
public string CountDown {
45
get { return countDownLabel.StringValue; }
47
countDownLabel.StringValue = counter.TimeLeft;
48
if (counter.TimerMark.Minutes == 0 && counter.TimerMark.Seconds == 0) {
49
GrowlApplicationBridge.Notify ("Time is up",
50
"Your two minutes is up. Did you get everything done? "
51
+ "You need to clarify what is next and then manage that accordingly.", "Stop", null, 0, false, null);
53
startStopButton.Title = "Start";
55
} else if (counter.TimerMark.Minutes == 1 && counter.TimerMark.Seconds == 0) {
56
GrowlApplicationBridge.Notify ("One Minute Warning", "This is your one minute warning. "
57
+ "Not to put more pressure on you but you had better get a move on!", "Info", null, 0, false, null);
62
[Export("registrationDictionaryForGrowl")]
63
NSDictionary RegistrationDictionaryForGrowl ()
65
var regPath = NSBundle.MainBundle.PathForResource ("GrowlRegistrationTicket", "plist");
66
var reg = NSDictionary.FromFile (regPath);