private void graphContextMenuStrip_Opening(object sender, CancelEventArgs e) { viewToolStripMenuItem.Enabled = false; breakpointToolStripMenuItem.Enabled = false; breakpointToolStripMenuItem.Checked = false; if (graphTreeView.SelectedNode != null) { IOperator op = GetOperatorTag(graphTreeView.SelectedNode); if (op != null) { Type viewType = MainFormManager.GetDefaultViewType(op.GetType()); if (viewType != null) { viewToolStripMenuItem.Enabled = true; viewToolStripMenuItem.Tag = op; } breakpointToolStripMenuItem.Enabled = !Locked; breakpointToolStripMenuItem.Tag = op; if (op.Breakpoint) { breakpointToolStripMenuItem.Checked = true; } } } }
public IContentView ShowContent(IContent content) { if (content == null) { throw new ArgumentNullException("Content cannot be null."); } Type viewType = MainFormManager.GetDefaultViewType(content.GetType()); if (viewType != null) { return(ShowContent(content, viewType)); } return(null); }
protected override void OnContentChanged() { viewContextMenuStrip.Item = Content; //change ViewType if view of ViewType can not show content or is null if (Content != null) { if (!ViewCanShowContent(viewType, Content)) { Type defaultViewType = MainFormManager.GetDefaultViewType(Content.GetType()); if (cachedView != null && cachedView.GetType() == defaultViewType) { ActiveView = cachedView; } else if (defaultViewType != null) { ViewType = defaultViewType; } else if (viewContextMenuStrip.Items.Count > 0) // create first available view if no default view is available { ViewType = (Type)viewContextMenuStrip.Items[0].Tag; } else { ViewType = null; ActiveView = null; } } if (ActiveView != null) { ActiveView.Content = Content; } } else { ActiveView = null; } UpdateLabels(); UpdateActiveMenuItem(); }