Exemple #1
0
        private void OnGetMapsNodesCompletedNodeArgs(object sender, ReturnedNodesEventArgs e)
        {
            INodeProxy        focalNode     = FocalNode;
            List <INodeProxy> filteredNodes = FiltersResults(e.Nodes);

            CompleteRelationshipLinks(filteredNodes);
            List <INodeProxy> nodes = new List <INodeProxy>();

            foreach (INodeProxy nodeProxy in filteredNodes)
            {
                if (nodeProxy.Id == FocalNodeId)
                {
                    //Set the focal node if this is the main node in focus
                    FocalNode = nodeProxy;
                    focalNode = FocalNode;
                }
                else
                {
                    nodes.Add(nodeProxy);
                }
                if (nodeProxy.ParentMapNodeUid != FocalNodeId)
                {
                    nodeProxy.IsTransclusion = true;
                }
                else
                {
                    nodeProxy.IsTransclusion = false;
                }
            }

            NodesEventArgs nodesEventArgs = new NodesEventArgs(null, focalNode, nodes.ToArray());

            if (GetCurrentNodesCompleted != null)
            {
                GetCurrentNodesCompleted.Invoke(this, nodesEventArgs);
            }
        }
        private void OnGetRelatedNodesByIdCompleted(object sender, ReturnedNodesEventArgs e)
        {
            int count  = 0;
            int length = e.Nodes.Length - 1;

            if (Views.ContainsKey(FocalNodeId))
            {
                CurrentView = Views[FocalNodeId];
            }
            else
            {
                CurrentView = new NavigatorView();

                Views.Add(FocalNodeId, CurrentView);

                SingleDepthNodeRenderer focalNodeRenderer = null;

                foreach (INodeProxy nodeProxy in e.Nodes)
                {
                    if (nodeProxy.Id == FocalNodeId)
                    {
                        if (FocalNode == null)
                        {
                            FocalNode = nodeProxy;

                            focalNodeRenderer = new SingleDepthNodeRenderer(CurrentView, FocalNode, ThemeManagementObject, "Focal");

                            CurrentView.NodeRenderers.Add(focalNodeRenderer.Node.Id, focalNodeRenderer);

                            focalNodeRenderer.NodePositionUpdating += new EventHandler(OnNodePositionUpdating);
                            focalNodeRenderer.NodeDoubleClicked    += new EventHandler <NodeClickedArgs>(OnNodeDoubleClicked);
                        }
                    }
                    else
                    {
                        SingleDepthNodeRenderer nodeRenderer = new SingleDepthNodeRenderer(CurrentView, nodeProxy, ThemeManagementObject, "Default");

                        nodeRenderer.NodeIndex = count;
                        nodeRenderer.NodeCount = length;

                        CurrentView.NodeRenderers.Add(nodeRenderer.Node.Id, nodeRenderer);

                        nodeRenderer.NodePositionUpdating += new EventHandler(OnNodePositionUpdating);
                        nodeRenderer.NodeDoubleClicked    += new EventHandler <NodeClickedArgs>(OnNodeDoubleClicked);

                        count++;
                    }
                }

                if (focalNodeRenderer == null)
                {
                    return;
                }

                foreach (INodeRenderer nodeRenderer in CurrentView.NodeRenderers.Values)
                {
                    foreach (IDescriptorProxy descriptor in nodeRenderer.Node.Descriptors)
                    {
                        if (!CurrentView.RelationshipRenderers.ContainsKey(descriptor.Relationship.Id))
                        {
                            bool relationshipIsPresent = true;

                            foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors)
                            {
                                if (!CurrentView.NodeRenderers.ContainsKey(alternateDescriptor.Node.Id))
                                {
                                    relationshipIsPresent = false;
                                    break;
                                }
                            }

                            if (relationshipIsPresent)
                            {
                                ImprovedArrow arrow = new ImprovedArrow(CurrentView, descriptor.Relationship);

                                CurrentView.RelationshipRenderers.Add(descriptor.Relationship.Id, arrow);
                            }
                        }
                    }
                }
            }

            RendererNodesEventArgs rendererNodesEventArgs = new RendererNodesEventArgs(CurrentView);

            if (GetCurrentNodesCompleted != null)
            {
                GetCurrentNodesCompleted.Invoke(sender, rendererNodesEventArgs);
            }
        }