public NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { RxApp.MainThreadScheduler.Schedule(() => shouldPersistState.OnNext(Disposable.Create(() => sender.ReplyToApplicationShouldTerminate(true)))); return(NSApplicationTerminateReply.Later); }