diff options
author | Pavel Yakovlev <v-payako@microsoft.com> | 2020-05-28 02:29:07 +0300 |
---|---|---|
committer | Pavel Yakovlev <v-payako@microsoft.com> | 2020-05-28 02:29:07 +0300 |
commit | f739fde5983bcc775a3e0b223fb2b27fe05e1b7c (patch) | |
tree | 9b0ee239c6c91e2f161019f552b4a1f85962a07b | |
parent | 8f6a160f83fcb893dd99e898c1021206cae71af0 (diff) |
[mac] fixed always canceled result in the collection windowfix-mac-save-collections
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/CollectionEditorWindow.cs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorWindow.cs b/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorWindow.cs index c215e1e..9b7c16f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorWindow.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorWindow.cs @@ -38,7 +38,7 @@ namespace Xamarin.PropertyEditing.Mac Title = Properties.Resources.OK, TranslatesAutoresizingMaskIntoConstraints = false }; - this.ok.Activated += OnOked; + this.ok.Activated += OnOkedOrCanceled; ContentView.AddSubview (this.ok); this.cancel = new FocusableButton { @@ -49,7 +49,7 @@ namespace Xamarin.PropertyEditing.Mac Title = Properties.Resources.Cancel, TranslatesAutoresizingMaskIntoConstraints = false }; - this.cancel.Activated += OnCanceled; + this.cancel.Activated += OnOkedOrCanceled; ContentView.AddSubview (this.cancel); ContentView.AddConstraints (new[] { @@ -68,29 +68,13 @@ namespace Xamarin.PropertyEditing.Mac }); } - public NSModalResponse ModalResponse - { - get; - private set; - } = NSModalResponse.Cancel; - private CollectionEditorControl collectionEditor; private NSButton ok, cancel; - private void OnOked (object o, EventArgs e) - { - ModalResponse = NSModalResponse.OK; - CloseWindow (); - } - - private void OnCanceled (object o, EventArgs e) - { - ModalResponse = NSModalResponse.Cancel; - CloseWindow (); - } - - private void CloseWindow () + private void OnOkedOrCanceled (object button, EventArgs e) { + ((ModalWindowCloseDelegate)Delegate).Response = + button == this.ok ? NSModalResponse.OK : NSModalResponse.Cancel; this.collectionEditor.ViewModel = null; Close (); } |