Exemplo n.º 1
0
        void Refresh()
        {
            List <string> entries = new List <string>();

            if (DataContext is KeyValuePair <string, IOItem> )
            {
                KeyValuePair <string, IOItem> keyValuePair = (KeyValuePair <string, IOItem>)DataContext;
                IOItem currentItem = keyValuePair.Value;

                var infoControl = TemplatedParent.GetParent <NodeInfoContainer>(null);
                var control     = infoControl != null ? infoControl.OriginElement : null;
                if (control != null)
                {
                    // We'll need to query the canvas for links
                    //NodeGraphLayout canvas = control.RootCanvas as NodeGraphLayout;
                    TraceLab.UI.WPF.Views.DockableGraph topGraph = control.GetParent <TraceLab.UI.WPF.Views.DockableGraph>(null);
                    NodeGraphLayout canvas = topGraph.graphLayout;

                    // Add the current mapping
                    entries.Add(currentItem.MappedTo);

                    // Get the current item's type so that we can limit the selection to only this type
                    string currentType = currentItem.IOItemDefinition.Type;

                    var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(canvas.Graph);

                    ExperimentNode currentNode = control.Vertex as ExperimentNode;

                    //if currentNode is a ExperimentNode, and is ioValidator has incoming outputs for this node (otherwise, it has not been connected to start node)
                    if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode(currentNode))
                    {
                        foreach (string incomingOutput in availableInputMappingsPerNode[currentNode].Keys)
                        {
                            if (string.Equals(currentType, availableInputMappingsPerNode[currentNode][incomingOutput]))
                            {
                                entries.Add(incomingOutput);
                            }
                        }
                    }
                }
            }
            this.ItemsSource = entries.Distinct();
        }
        void Refresh()
        {
            List<string> entries = new List<string>();

            if (DataContext is KeyValuePair<string, IOItem>)
            {
                KeyValuePair<string, IOItem> keyValuePair = (KeyValuePair<string, IOItem>)DataContext;
                IOItem currentItem = keyValuePair.Value;
            
                var infoControl = TemplatedParent.GetParent<NodeInfoContainer>(null);
                var control = infoControl != null ? infoControl.OriginElement : null;
                if (control != null)
                {
                    // We'll need to query the canvas for links
                    //NodeGraphLayout canvas = control.RootCanvas as NodeGraphLayout;
                    TraceLab.UI.WPF.Views.DockableGraph topGraph = control.GetParent<TraceLab.UI.WPF.Views.DockableGraph>(null);
                    NodeGraphLayout canvas = topGraph.graphLayout;

                    // Add the current mapping
                    entries.Add(currentItem.MappedTo);

                    // Get the current item's type so that we can limit the selection to only this type
                    string currentType = currentItem.IOItemDefinition.Type;
                    
                    var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(canvas.Graph);

                    ExperimentNode currentNode = control.Vertex as ExperimentNode;

                    //if currentNode is a ExperimentNode, and is ioValidator has incoming outputs for this node (otherwise, it has not been connected to start node)
                    if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode(currentNode))
                    {
                        foreach (string incomingOutput in availableInputMappingsPerNode[currentNode].Keys)
                        {
                            if (string.Equals(currentType, availableInputMappingsPerNode[currentNode][incomingOutput]))
                            {
                                entries.Add(incomingOutput);
                            }
                        }
                    
                    }

                }
            }
            this.ItemsSource = entries.Distinct();
        }