/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. using System;
  17. using System.Collections.Generic;
  18. using System.Drawing;
  19. using System.IO;
  20. using MonoMac.Foundation;
  21. using MonoMac.AppKit;
  22. using MonoMac.ObjCRuntime;
  23. using MonoMac.WebKit;
  24. namespace SparkleShare {
  25. public class SparkleAlert : NSAlert {
  26. public SparkleAlert () : base ()
  27. {
  28. MessageText = "SparkleShare couldn't find Git on your system. Do you want to download it?";
  29. InformativeText = "Git is required to run SparkleShare.";
  30. Icon = NSImage.ImageNamed ("sparkleshare.icns");
  31. AddButton ("Download");
  32. AddButton ("Cancel");
  33. Buttons [0].Activated += delegate {
  34. NSUrl url = new NSUrl ("http://code.google.com/p/git-osx-installer/downloads/list");
  35. NSWorkspace.SharedWorkspace.OpenUrl (url);
  36. Environment.Exit (0);
  37. };
  38. Buttons [1].Activated += delegate {
  39. Environment.Exit (-1);
  40. };
  41. }
  42. }
  43. }