diff options
author | Alex Corrado <alexc@xamarin.com> | 2020-02-22 02:20:38 +0300 |
---|---|---|
committer | Alex Corrado <alexc@xamarin.com> | 2020-02-22 04:02:10 +0300 |
commit | 56c38aad77e0267b36282525aa211b30aec82950 (patch) | |
tree | 0dbc88fa0ad01f89f305820c77803f6a2b525456 /Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs | |
parent | d148a22c16ca83f86303b4fd281d721c1648071a (diff) |
[Mac] More generalized solution for restoring focus when popover is repopped up
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs index 7520f31..cb8bc44 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs @@ -22,8 +22,6 @@ namespace Xamarin.PropertyEditing.Mac if (!Popover.Shown) { Popover.Show (new CGRect (26, this.Frame.Height / 2 - 2, 2, 2), this, NSRectEdge.MinYEdge); - Window.MakeFirstResponder (this); - Window.MakeFirstResponder (Popover); } } @@ -37,33 +35,6 @@ namespace Xamarin.PropertyEditing.Mac } } - internal class ColorPopOverDelegate : NSPopoverDelegate - { - private BrushTabViewController brushTabViewController; - private CommonBrushType selectedBrushType = CommonBrushType.None; - - internal ColorPopOverDelegate (BrushTabViewController brushTabViewController) - { - if (brushTabViewController == null)
- throw new ArgumentNullException (nameof (brushTabViewController)); - - this.brushTabViewController = brushTabViewController; - } - - public override void WillShow (NSNotification notification) - { - if (this.brushTabViewController.ViewModel != null) { - var ct = new CancellationTokenSource (); - Task.Factory.StartNew (()=> { - if (this.selectedBrushType == CommonBrushType.None) - this.selectedBrushType = this.brushTabViewController.ViewModel.SelectedBrushType; - else - this.brushTabViewController.ViewModel.SelectedBrushType = this.selectedBrushType; - }, ct.Token, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext ()); - } - } - } - internal class BrushEditorControl : PropertyEditorControl<BrushPropertyViewModel> { public BrushEditorControl (IHostResourceProvider hostResources) @@ -81,8 +52,6 @@ namespace Xamarin.PropertyEditing.Mac } }; - this.popover.Delegate = new ColorPopOverDelegate (this.brushTabViewController); - this.popUpButton = new ColorPopUpButton { ControlSize = NSControlSize.Small, Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)), |