private void DropStream(DragEventArgs e)
        {
            StreamTreeNode streamTreeNode = e.Data.GetData(DragDropDataName.StreamTreeNode) as StreamTreeNode;

            if (streamTreeNode != null)
            {
                // Get the mouse position
                Point mousePosition = e.GetPosition(this.Items);

                // Get the visualization panel (if any) that the mouse is above
                VisualizationPanel visualizationPanel = this.GetVisualizationPanelUnderMouse(mousePosition);

                // Get the type of messages in the stream
                Type dataType = VisualizationContext.Instance.GetDataType(streamTreeNode.NodeTypeName);

                // Get the list of commands that are compatible with the user dropping the stream here
                var visualizers = VisualizationContext.Instance.PluginMap.GetCompatibleVisualizers(
                    streamTreeNode, visualizationPanel, isUniversal: false, isInNewPanel: false);

                // If there's any compatible visualization commands, select the most appropriate one and execute it
                if (visualizers.Any())
                {
                    VisualizationContext.Instance.VisualizeStream(streamTreeNode, VisualizerMetadata.GetClosestVisualizerMetadata(dataType, visualizers), visualizationPanel);
                }
            }
        }
示例#2
0
        private void DropStream(DragEventArgs e)
        {
            StreamTreeNode streamTreeNode = e.Data.GetData(DragDropDataName.StreamTreeNode) as StreamTreeNode;

            if (streamTreeNode != null)
            {
                // Get the mouse position
                Point mousePosition = e.GetPosition(this.Items);

                // Get the visualization panel (if any) that the mouse is above
                VisualizationPanel visualizationPanel = this.GetVisualizationPanelUnderMouse(mousePosition);

                // Get the type of messages in the stream
                Type dataType = VisualizationContext.Instance.GetDataType(streamTreeNode);

                // Get the list of commands that are compatible with the user dropping the stream here
                List <VisualizerMetadata> metadatas = this.GetStreamDropCommands(dataType, visualizationPanel);

                // If there's any compatible visualization commands, select the most appropriate one and execute it
                if (metadatas.Count > 0)
                {
                    VisualizationContext.Instance.VisualizeStream(streamTreeNode, VisualizerMetadata.GetClosestVisualizerMetadata(dataType, metadatas), visualizationPanel);
                }
            }
        }