void HandleAddBookmarkBtnActivated(object sender, EventArgs e) { var title = string.IsNullOrWhiteSpace(currentTitle) ? "No Title" : currentTitle; var entry = new BookmarkManager.Entry() { Name = title, Url = currentUrl, Notes = string.Empty }; AppDelegate.BookmarkManager.AddBookmark(entry); var popover = new NSPopover(); popover.Behavior = NSPopoverBehavior.Transient; popover.ContentViewController = new BookmarkPopoverController(popover, entry); popover.Show(new CGRect(0, 0, 0, 0), (NSView)sender, NSRectEdge.MinYEdge); }
public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, nint row) { NSString newNSValue = theObject as NSString; if (newNSValue == null) { return; } string newValue = newNSValue.ToString(); var columnIndex = tableView.FindColumn((NSString)tableColumn.Identifier); BookmarkManager.Entry entry = entries[(int)row]; switch (columnIndex) { case 0: if (!string.IsNullOrWhiteSpace(newValue)) { entry.Name = newValue; } break; case 1: entry.Notes = newValue; break; case 2: if (!string.IsNullOrWhiteSpace(newValue)) { entry.Url = newValue; } break; default: break; } manager.CommitBookmarkChange(entry); }
void HandleAddBookmarkBtnActivated (object sender, EventArgs e) { var title = string.IsNullOrWhiteSpace (currentTitle) ? "No Title" : currentTitle; var entry = new BookmarkManager.Entry () { Name = title, Url = currentUrl, Notes = string.Empty }; AppDelegate.BookmarkManager.AddBookmark (entry); var popover = new NSPopover (); popover.Behavior = NSPopoverBehavior.Transient; popover.ContentViewController = new BookmarkPopoverController (popover, entry); popover.Show (new RectangleF (0, 0, 0, 0), (NSView)sender, NSRectEdge.MinYEdge); }
public BookmarkPopoverController(NSPopover popover, BookmarkManager.Entry entry) : base("BookmarkPopover", NSBundle.MainBundle) { this.parentPopover = popover; this.entry = entry; Initialize(); }
public BookmarkPopoverController (NSPopover popover, BookmarkManager.Entry entry) : base ("BookmarkPopover", NSBundle.MainBundle) { this.parentPopover = popover; this.entry = entry; Initialize (); }