protected override void OnSessionAvailable() { outlineView.RowSizeStyle = NSTableViewRowSizeStyle.Medium; outlineViewDataSource = new CollectionOutlineViewDataSource(Session.Workbook.TreeNode); outlineViewDataSource.Reload += (sender, e) => { var selectedNode = outlineView.SelectedNode; if (e.Item == null) { outlineView.ReloadData(); } else { outlineView.ReloadItem(e.Item, e.ReloadChildren); } if (selectedNode != null) { outlineView.SelectedNode = selectedNode; } }; outlineView.DataSource = outlineViewDataSource; outlineView.ReloadData(); outlineViewDelegate = new WorkbookOutlineViewDelegate(outlineView); outlineViewDelegate.NavigateTableOfContents += toc => ((XcbWorkbookPageView)Session.EvaluationService).ScrollToElementWithId(toc.Id); outlineView.Delegate = outlineViewDelegate; }
void BindData() { if (Tree?.RootNode == null) { return; } try { var oldSource = dataSource; dataSource = new InspectorOutlineViewDataSource(Tree); dataSource.Reload += (sender, e) => { if (e.Item == null) { outlineView.ReloadData(); } else { outlineView.ReloadItem(e.Item, e.ReloadChildren); } }; outlineView.DataSource = dataSource; outlineView.ReloadData(); outlineViewDelegate = new InspectorOutlineViewDelegate(this); outlineView.Delegate = outlineViewDelegate; oldSource?.Dispose(); } catch (Exception e) { Log.Error(TAG, e); } }