private void ShowInfoForNode(ExperimentNode node, ExperimentNodeInfo info) { m_inactiveInfo.Remove(node); m_activeInfoLookup.Add(node, info); NodeInfo.Add(info); node.IsInfoPaneExpanded = true; }
/// <summary> /// Fills the items with next nodes labels. /// </summary> /// <param name="comboBox">The combo box.</param> private void FillItemsWithNextNodesLabels(ComboBox comboBox) { comboBox.Items.Clear(); ExperimentNodeInfo decisionNodeInfo = DataContext as ExperimentNodeInfo; ExperimentNode currentNode = decisionNodeInfo.Node; foreach (ExperimentNodeConnection outEdge in m_experiment.OutEdges(currentNode)) { comboBox.Items.Add(outEdge.Target.Data.Metadata.Label); } }
/// <summary> /// Handles the DataContextChanged event of the DecisionNodeInfoControl control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private void DecisionNodeInfoControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { ExperimentNodeInfo newInfo = e.NewValue as ExperimentNodeInfo; if (newInfo != null && (newInfo is DecisionNodeInfo || newInfo is LoopDecisionNodeInfo)) { IDecision metadata = (IDecision)newInfo.Node.Data.Metadata; m_experiment = newInfo.Node.Owner; metadata.RequestLatestCode += metadata_RequestLatestCode; } ExperimentNodeInfo oldInfo = e.NewValue as ExperimentNodeInfo; if (oldInfo != null && (newInfo is DecisionNodeInfo || newInfo is LoopDecisionNodeInfo)) { IDecision metadata = (IDecision)oldInfo.Node.Data.Metadata; metadata.RequestLatestCode -= metadata_RequestLatestCode; } }
/// <summary> /// Fills the items with incoming outputs from previous nodes. /// </summary> /// <param name="comboBox">The combo box.</param> private void FillItemsWithIncomingOutputsFromPreviousNodes(ComboBox comboBox) { comboBox.Items.Clear(); ExperimentNodeInfo decisionNodeInfo = DataContext as ExperimentNodeInfo; ExperimentNode currentNode = decisionNodeInfo.Node; Dictionary <string, string> predeccessorsOutputsNameTypeLookup; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(m_experiment); if (availableInputMappingsPerNode.TryGetValue(currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary <string, string>(); //return empty - there is not path from start node to decision } foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { comboBox.Items.Add(workspaceUnitName); } }
private void ToggleInfoPaneForNodeFunc(object param) { var vertexControl = param as GraphSharp.Controls.VertexControl; if (vertexControl != null) { ExperimentNode node = vertexControl.Vertex as ExperimentNode; if (node != null) { // First check if this is currectly visibleList ExperimentNodeInfo info; bool showInfo = false; if (!m_activeInfoLookup.TryGetValue(node, out info)) { // If it's not currently active, then check if we've shown it before. if (!m_inactiveInfo.TryGetValue(node, out info)) { // If we haven't shown this before, then create the info object. info = ExperimentNodeInfo.CreateInfo(vertexControl); Point suggestedLocation = FindOptimalLocation(vertexControl); info.X = suggestedLocation.X; info.Y = suggestedLocation.Y; } // It was either inactive or not previously shown - show it now. showInfo = true; } // Show the info if (showInfo) { ShowInfoForNode(node, info); } else { HideInfoForNode(node, info); } } } }