]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - SuperPolarityMac/Program.cs
Consolidates windows project
[rbdr/super-polarity] / SuperPolarityMac / Program.cs
index 6c3f6141a1eec6053e0f6656d4fb98bfb6513489..e6ab5cfcff83cbcb2c0c837749b0a4bbd918c271 100644 (file)
@@ -1,26 +1,44 @@
-#region Using Statements
 using System;
 using System.Collections.Generic;
 using System.Linq;
-#endregion
+using MonoMac.AppKit;
+using MonoMac.Foundation;
 
 namespace SuperPolarity
 {
-#if WINDOWS || LINUX
-    /// <summary>
-    /// The main class.
-    /// </summary>
-    public static class Program
-    {
-        /// <summary>
-        /// The main entry point for the application.
-        /// </summary>
-        [STAThread]
-        static void Main()
-        {
-            using (var superPolarity = new SuperPolarity())
-                superPolarity.Run();
-        }
-    }
-#endif
+       static class Program
+       {
+               /// <summary>
+               /// The main entry point for the application.
+               /// </summary>
+               static void Main (string[] args)
+               {
+                       NSApplication.Init ();
+
+                       using (var p = new NSAutoreleasePool ()) {
+                               NSApplication.SharedApplication.Delegate = new AppDelegate ();
+                               NSApplication.Main (args);
+                       }
+
+
+               }
+       }
+
+       class AppDelegate : NSApplicationDelegate
+       {
+               SuperPolarity superPolarity;
+
+               public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+               {
+                       superPolarity = new SuperPolarity();
+                       superPolarity.Run ();
+               }
+
+               public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
+               {
+                       return true;
+               }
+       }
 }
+
+