PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/SparkleShare/Mac/SparkleAlert.cs

http://github.com/hbons/SparkleShare
C# | 53 lines | 28 code | 10 blank | 15 comment | 0 complexity | db8b482d4906c10fff7392e7146e4666 MD5 | raw file
 1//   SparkleShare, a collaboration and sharing tool.
 2//   Copyright (C) 2010  Hylke Bons <hylkebons@gmail.com>
 3//
 4//   This program is free software: you can redistribute it and/or modify
 5//   it under the terms of the GNU General Public License as published by
 6//   the Free Software Foundation, either version 3 of the License, or
 7//   (at your option) any later version.
 8//
 9//   This program is distributed in the hope that it will be useful,
10//   but WITHOUT ANY WARRANTY; without even the implied warranty of
11//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//   GNU General Public License for more details.
13//
14//   You should have received a copy of the GNU General Public License
15//   along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18using System;
19using System.Collections.Generic;
20using System.Drawing;
21using System.IO;
22
23using MonoMac.Foundation;
24using MonoMac.AppKit;
25using MonoMac.ObjCRuntime;
26using MonoMac.WebKit;
27
28namespace SparkleShare {
29
30    public class SparkleAlert : NSAlert {
31
32        public SparkleAlert () : base ()
33        {
34            MessageText     = "SparkleShare couldn't find Git on your system. Do you want to download it?";
35            InformativeText = "Git is required to run SparkleShare.";
36
37            Icon = NSImage.ImageNamed ("sparkleshare.icns");
38
39            AddButton ("Download");
40            AddButton ("Cancel");
41
42            Buttons [0].Activated += delegate {
43                NSUrl url = new NSUrl ("http://code.google.com/p/git-osx-installer/downloads/list");
44                NSWorkspace.SharedWorkspace.OpenUrl (url);
45                Environment.Exit (0);
46            };
47
48            Buttons [1].Activated += delegate {
49                Environment.Exit (-1);
50            };
51        }
52    }
53}