Main.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Drawing;
  3. using MonoMac.Foundation;
  4. using MonoMac.AppKit;
  5. using MonoMac.ObjCRuntime;
  6. namespace TestImplicitOrdering
  7. {
  8. class MainClass
  9. {
  10. static void Main(string[] args)
  11. {
  12. NSApplication.Init();
  13. using (var pool = new NSAutoreleasePool())
  14. {
  15. NSApplication.SharedApplication.Delegate = new AppDelegate();
  16. NSApplication.Main(args);
  17. }
  18. }
  19. }
  20. class AppDelegate : NSApplicationDelegate
  21. {
  22. private ImplicitOrderingGame _game;
  23. public override void DidFinishLaunching(NSNotification notification)
  24. {
  25. _game = new ImplicitOrderingGame();
  26. _game.Run();
  27. }
  28. public override void WillTerminate(NSNotification notification)
  29. {
  30. if (_game != null)
  31. {
  32. _game.Dispose();
  33. _game = null;
  34. }
  35. }
  36. public override bool ApplicationShouldTerminateAfterLastWindowClosed(NSApplication sender)
  37. {
  38. return true;
  39. }
  40. }
  41. }