private void SetupViewControllerFromSelection(NSViewController viewController) { if (DetailViewController.HasChildViewController()) { if (viewController == DetailViewController.ChildViewControllers.First()) { return; } DetailViewController.RemoveFirstChildViewController(); EmbedChildViewController(viewController); } else { EmbedChildViewController(viewController); } }
private void HandleSelectionChange(NSNotification notification) { if (!(notification.Object is NSTreeController treeController)) { return; } if (OutlineViewController is LeadingContentListViewController outlineViewController) { NSTreeNode[] selectedNodes = treeController.SelectedNodes; NSViewController?viewControllerForSelection = outlineViewController.GetViewControllerForSelectedNodes(selectedNodes); if (viewControllerForSelection is null) { DetailViewController.RemoveFirstChildViewController(); return; } SetupViewControllerFromSelection(viewControllerForSelection); } }