protected override void Exit() { if (m_app != null) { // Set the flag m_app.Stop(m_app); // Post an event to trigger the exit m_app.PostEvent(NSEvent.OtherEvent(NSEventType.ApplicationDefined, new System.Drawing.PointF(0, 0), 0, 0, 0, null, 0, 0, 0), true); } }