public static Task <ITypeInfo> RequestAt(this TypeRequestedEventArgs self, IHostResourceProvider hostResources, NSView source, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes) { var tcs = new TaskCompletionSource <ITypeInfo> (); var vm = new TypeSelectorViewModel(assignableTypes); var selector = new TypeSelectorControl { ViewModel = vm, Appearance = source.EffectiveAppearance }; vm.PropertyChanged += (vms, ve) => { if (ve.PropertyName == nameof(TypeSelectorViewModel.SelectedType)) { tcs.TrySetResult(vm.SelectedType); } }; var popover = new NSPopover { Behavior = NSPopoverBehavior.Transient, Delegate = new PopoverDelegate <ITypeInfo> (tcs), ContentViewController = new NSViewController { View = selector, PreferredContentSize = new CoreGraphics.CGSize(360, 335) }, }; popover.SetAppearance(hostResources.GetVibrantAppearance(source.EffectiveAppearance)); tcs.Task.ContinueWith(t => { popover.PerformClose(popover); popover.Dispose(); }, TaskScheduler.FromCurrentSynchronizationContext()); popover.Show(source.Frame, source.Superview, NSRectEdge.MinYEdge); return(tcs.Task); }
void Initialize() { View.Delete += (sender, e) => { AppDelegate.BookmarkManager.DeleteBookmark(entry); parentPopover.PerformClose(this); }; View.Done += (sender, e) => { entry.Name = e.Name; entry.Notes = e.Notes; parentPopover.PerformClose(this); }; View.Name = entry.Name; View.PostInitialization(); }
public void HidePopover(NSObject sender) { popover.PerformClose(sender); eventMonitor.Stop(); }
/// <summary> /// Hides the popover /// </summary> /// <param name="sender">Sender.</param> public void Close(NSObject sender) { popOver.PerformClose(sender); eventMonitor.Stop(); }
public void closePopover(NSObject sender) { popover.PerformClose(sender); //eventMonitor.stop(); }