public override void DidFinishLaunching(NSNotification notification) { // Insert code here to initialize your application storyboard = NSStoryboard.FromName("Main", null); controller = storyboard.InstantiateControllerWithIdentifier("PopupController") as ViewController; popover.ContentViewController = controller; popover.SetAppearance(NSAppearance.GetAppearance(NSAppearance.NameVibrantDark)); statusBar = new StatusBarController(popover, "StatusBarIcon.png"); //Registering the default settings loaded from the .plist file in the constructor NSUserDefaults.StandardUserDefaults.RegisterDefaults(defaultSettings); }
// Called after the application is ready to open the GUI public override void DidFinishLaunching(NSNotification notification) { // Create container for popover Container container = Container.FreshController(); // Furnish popover with content popover.ContentViewController = container; popover.Behavior = NSPopoverBehavior.Transient; popover.Delegate = new PopoverDelegate(); popover.Animates = false; popover.SetAppearance(NSAppearance.GetAppearance(NSAppearance.NameLightContent)); // Enable the tray item only after the app has launched statusItem.Button.Activated += StatusItem_Click; statusItem.Button.SendActionOn(NSEventType.OtherMouseUp); statusItem.Visible = true; Application.Current.SendStart(); }
partial void onClickThemePicker(NSObject sender) { if (_popoverViewController == null) { _popoverViewController = Storyboard.InstantiateControllerWithIdentifier("ThemePickerViewController") as ThemePickerViewController; } if (_popover == null) { _popover = new NSPopover(); _popover.ContentViewController = _popoverViewController; _popover.SetAppearance(NSAppearance.GetAppearance(NSAppearance.NameVibrantLight)); _popover.Animates = true; _popover.Behavior = NSPopoverBehavior.Transient; _popover.WeakDelegate = this; var button = sender as NSButton; _popover.Show(button.Frame, button, NSRectEdge.MaxXEdge); } }
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); }