Skip to content

Instantly share code, notes, and snippets.

@jstedfast
Created November 20, 2012 17:11

Revisions

  1. jstedfast created this gist Nov 20, 2012.
    15 changes: 15 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    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);