Created
November 20, 2012 17:11
-
-
Save jstedfast/4119319 to your computer and use it in GitHub Desktop.
How to run a modal dialog & pump the main loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IntPtr session = NSApplication.SharedApplication.BeginModalSession (window); | |
NSRunResponse result = NSRunResponse.Continues; | |
// Loop until some result other than continues: | |
while (result == NSRunResponse.Continues) { | |
using (var pool = new NSAutoreleasePool ()) { | |
// Run the window modally until there are no events to process: | |
result = (NSRunResponse) NSApplication.SharedApplication.RunModalSession (session); | |
// Give the main loop some time: | |
NSRunLoop.Current.LimitDateForMode (NSRunLoopMode.Default); | |
} | |
} | |
NSApplication.SharedApplication.EndModalSession (session); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment