public override NSMenu MenuForEvent(NSEvent theEvent) { CGPoint pt = this.ConvertPointFromView(theEvent.LocationInWindow, null); selectedRow = this.GetRow(pt); NSTableViewDataSource ds = (NSTableViewDataSource)this.DataSource; NSMenu menu = new NSMenu(); if (selectedRow >= (nint)0) { if (ds is ZoneDetailsListView) { VMDNSZoneEntryNode zone = (ds as ZoneDetailsListView).Entries[(int)SelectedRow] as VMDNSZoneEntryNode; NSMenuItem properties = new NSMenuItem(VMDNSConstants.ZONE_PROPERTIES, zone.OnClickZoneProperties); menu.AddItem(properties); } else if (ds is DnsRecordListView) { VMDNSZoneEntryNode zoneNode = (ds as DnsRecordListView).ZoneNode; if (zoneNode != null) { VmDnsRecord record = (ds as DnsRecordListView).Entries[(int)selectedRow]; NSMenuItem properties = new NSMenuItem(VMDNSConstants.RECORD_PROPERTIES, (sender, e) => zoneNode.ShowRecordProperties(sender, e, record)); menu.AddItem(properties); NSMenuItem deleteRecord = new NSMenuItem(VMDNSConstants.RECORD_DELETE, (sender, e) => zoneNode.DeleteRecord(sender, e, record)); menu.AddItem(deleteRecord); } } } NSMenu.PopUpContextMenu(menu, theEvent, theEvent.Window.ContentView); return(base.MenuForEvent(theEvent)); }
public ZonePropertiesController(VMDNSZoneEntryNode zoneNode) : base("ZoneProperties") { this.zoneNode = zoneNode; }