/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { NSApplication.Init(); NSApplication application = NSApplication.SharedApplication; application.Delegate = new AppDelegate(); application.Run(); }
protected override void Run(string[] args) { try { m_app.Run(); } finally { if (m_statusItem != null) { NSStatusBar.SystemStatusBar.RemoveStatusItem(m_statusItem); m_statusItem = null; m_keeper.Clear(); m_images.Clear(); } m_app = null; } }
static void Main(string[] args) { NSApplication.Init(); Logging.Log("iMessage Bridge 1.0"); NSUserDefaults.StandardUserDefaults.RegisterDefaults(NSDictionary.FromFile(NSBundle.MainBundle.PathForResource("DefaultPreferences", "plist"))); // Find out if user is logged into iMessage. NSAppleScript asConnectionStatus = new NSAppleScript("tell application \"Messages\" to get 1st service's connection status whose service type = iMessage"); NSDictionary ei; NSAppleEventDescriptor aed = asConnectionStatus.ExecuteAndReturnError(out ei); if (ei == null) { if (aed.StringValue == "dcon") // iMessage service is disconnected. { NSAlert alert = new NSAlert() { MessageText = "It appears you're not signed in to iMessage.", InformativeText = "The bridge will not work if you are not signed in. Would you like to sign in to iMessage?" }; alert.AddButton("Yes"); alert.AddButton("Not now"); NSRunningApplication.CurrentApplication.Activate(NSApplicationActivationOptions.ActivateIgnoringOtherWindows); if (alert.RunModal() == 1000) // User clicks yes. { Process.Start("/Applications/Messages.app"); } Environment.Exit(1); } } DatabaseStore.Init(); HttpServer.Start(); StreamServer.Start(); if (NSUserDefaults.StandardUserDefaults.BoolForKey("DiscoveryMode")) { Discovery.Register(); } NSApplication app = NSApplication.SharedApplication; app.Delegate = new AppDelegate(); app.Run(); }