/// <summary> /// Creates the info panel view model for the given vertex control based on its type /// </summary> /// <param name="vertexControl">The vertex control for which the info is created.</param> /// <returns>node info view model</returns> public static ExperimentNodeInfo CreateInfo(GraphSharp.Controls.VertexControl vertexControl) { var node = vertexControl.Vertex as ExperimentNode; if (node == null) { throw new ArgumentNullException("node"); } if (node.Data == null) { throw new InvalidOperationException("Cannot create info for node with invalid data."); } ExperimentNodeInfo info = null; //there are different types of node info view models depending on what vertex control type is //based on the node info type different view templates are used to render the info panel //most common is component, so check it first if (node.Data.Metadata is ComponentMetadata) { info = new ComponentNodeInfo(vertexControl); } else if (node.Data.Metadata is CompositeComponentMetadata) { info = new CompositeComponentNodeInfo(vertexControl); } else if (node.Data.Metadata is DecisionMetadata) { info = new DecisionNodeInfo(vertexControl); } else if (node.Data.Metadata is LoopScopeMetadata) { info = new LoopDecisionNodeInfo(vertexControl); } return(info); }
private void ShowInfoForNode(ExperimentNode node, ExperimentNodeInfo info) { m_inactiveInfo.Remove(node); m_activeInfoLookup.Add(node, info); NodeInfo.Add(info); node.IsInfoPaneExpanded = true; }