diff options
author | Marko B. Ludolph <MarkoBL@users.noreply.github.com> | 2017-07-24 23:12:09 +0200 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-07-24 17:12:09 -0400 |
commit | 578a1d1821ab394d8b28426d0e288b927b30b4c2 (patch) | |
tree | 98b8a4fd6e51d881706a8cdfe9d19ada9bc97fe3 /Xamarin.Forms.Platform.MacOS/Platform.cs | |
parent | e828fa6fa5455b9700bf5169a9868851f18e17ea (diff) | |
download | xamarin-forms-578a1d1821ab394d8b28426d0e288b927b30b4c2.tar.gz xamarin-forms-578a1d1821ab394d8b28426d0e288b927b30b4c2.tar.bz2 xamarin-forms-578a1d1821ab394d8b28426d0e288b927b30b4c2.zip |
[macOS] Page.Alert return value fix (#1062)
* [macOS] Page.Alert return value fix
* Use the views window
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Platform.cs')
-rw-r--r-- | Xamarin.Forms.Platform.MacOS/Platform.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Platform.cs b/Xamarin.Forms.Platform.MacOS/Platform.cs index 74c1e0e9..7e853ac4 100644 --- a/Xamarin.Forms.Platform.MacOS/Platform.cs +++ b/Xamarin.Forms.Platform.MacOS/Platform.cs @@ -31,8 +31,11 @@ namespace Xamarin.Forms.Platform.MacOS MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) => { var alert = NSAlert.WithMessage(arguments.Title, arguments.Cancel, arguments.Accept, null, arguments.Message); - var result = alert.RunModal(); - arguments.SetResult(result == 1); + var result = alert.RunSheetModal(PlatformRenderer.View.Window); + if (arguments.Accept == null) + arguments.SetResult(result == 1); + else + arguments.SetResult(result == 0); }); MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) => @@ -44,7 +47,7 @@ namespace Xamarin.Forms.Platform.MacOS alert.Layout(); } - var result = (int)alert.RunSheetModal(NSApplication.SharedApplication.MainWindow); + var result = (int)alert.RunSheetModal(PlatformRenderer.View.Window); var titleResult = string.Empty; if (result == 1) titleResult = arguments.Cancel; |