private void ProcessNoInstanceNodeSelected(TreeNode treeNode)
        {
            // It is not an instance node. It can be a final or an intermedia one
            List<KeyValuePair<string, Oid>> lCompleteOidPath = GetCompleteOidPath(treeNode);
            InstanceNodeInfo lInstanceInfo = null;

            // Check if it is a final one
            if (IsFinalNode(treeNode))
            {
                Oid parentNodeOid = null;
                if (treeNode.Parent != null)
                {
                    lInstanceInfo = treeNode.Parent.Tag as InstanceNodeInfo;
                }
                if (lInstanceInfo != null)
                {
                    parentNodeOid = lInstanceInfo.InstanceOid;
                }
                OnFinalNodeSelected(new FinalNodeSelectedEventArgs(treeNode.Name, parentNodeOid, lCompleteOidPath));
                return;
            }

            // It is not a final node, it is a intermedia
            OnIntermediaNodeSelected(new IntermediaNodeSelectedEventArgs(treeNode.Name, lCompleteOidPath));

            // Check if more data are required
            if (treeNode.Nodes.Count == 1 &&
                treeNode.Nodes[0].Text.Equals("..."))
            {
                // Get the related data
                Oid lOid = null;
                string lNodeName = "";
                if (treeNode.Parent != null && treeNode.Parent.Tag != null)
                {
                    lInstanceInfo = treeNode.Parent.Tag as InstanceNodeInfo;
                    if (lInstanceInfo != null)
                    {
                        lOid = lInstanceInfo.InstanceOid;
                    }
                }
                lNodeName = treeNode.Name;
                // Search more data for the IntermediaNode
                SearchIntermediaNodeDataEventArgs args = new SearchIntermediaNodeDataEventArgs(lOid, lNodeName, lCompleteOidPath);
                OnSearchIntermediaNodeData(args);
                // Add the received data to node
                AddDataToNode(treeNode, lNodeName, args.Data, args.DisplaySetInfo, args.LastBlock, true);
            }
        }
        private void ProcessInstanceNodeSelected(TreeNode treeNode)
        {
            InstanceNodeInfo lInstanceInfo = treeNode.Tag as InstanceNodeInfo;
            List<KeyValuePair<string, Oid>> lCompleteOidPath = GetCompleteOidPath(treeNode);
            List<Oid> lOidList = new List<Oid>();
            lOidList.Add(lInstanceInfo.InstanceOid);

            // Check if more data are required
            if (treeNode.Nodes.Count == 1 &&
                treeNode.Nodes[0].Text.Equals("..."))
            {
                // Search more data for the IntermediaNode
                lCompleteOidPath.Insert(0, new KeyValuePair<string, Oid>(treeNode.Nodes[0].Name, null));
                SearchIntermediaNodeDataEventArgs args = new SearchIntermediaNodeDataEventArgs(lInstanceInfo.InstanceOid, treeNode.Nodes[0].Name, lCompleteOidPath);
                OnSearchIntermediaNodeData(args);
                // Add the received data to node
                AddDataToNode(treeNode, treeNode.Nodes[0].Name, args.Data, args.DisplaySetInfo, args.LastBlock, true);
            }

            OnInstanceNodeSelected(new InstanceNodeSelectedEventArgs(lOidList, treeNode.Name, lCompleteOidPath));
        }
        /// <summary>
        /// Process the SearchIntermediaNodeData event from the Tree. Finds and returns the proper related data
        /// </summary>
        /// <param name="sender">The control that have raised the event.</param>
        /// <param name="e">Contains the necessary parameters involved in SearchIntermediaNodeData event.</param>
        protected virtual void ProcessTreeSearchIntermediaNodeData(object sender, SearchIntermediaNodeDataEventArgs e)
        {
            // Hide all the panels
            HideAllGroups();

            // If no Oid parent or Id, do nothing
            if (e.NodeId == "" || e.ParentNodeOid == null)
            {
                return;
            }

            List<KeyValuePair<string, Oid>> lOidPathList = new List<KeyValuePair<string, Oid>>(e.CompleteOidPath);
            lOidPathList.Reverse();

            // Find the corresponfing ExchangeInfo with the Complete Oid Path
            // Add the last NodeId to the list
            IUQueryContext queryContext = GetQueryContextFromPath(lOidPathList);

            if (queryContext == null)
            {
                return;
            }

            TreeNodeController treeNodeController = this.GetNodeById(e.NodeId);
            DisplaySetInformation lDisplaySetInfo = treeNodeController.DisplaySetInfo;
            // Get the data
            DataTable lData = null;
            lData = GetPopulationRelatedWith(e.ParentNodeOid, queryContext);

            e.DisplaySetInfo = lDisplaySetInfo;

            e.Data = lData;
            e.LastBlock = IsLastBlock(queryContext);
        }
        /// <summary>
        /// Raises the SearchIntermediaNodeData event
        /// </summary>
        /// <param name="args"></param>
        private void OnSearchIntermediaNodeData(SearchIntermediaNodeDataEventArgs args)
        {
            if (!mRaiseEventsFlag)
            {
                return;
            }

            EventHandler<SearchIntermediaNodeDataEventArgs> handler = SearchIntermediaNodeData;

            if (handler != null)
            {
                handler(this, args);
            }
        }
 /// <summary>
 /// Executes actions related with the IntermediaNode data researchment.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleTreeSearchIntermediaNodeData(object sender, SearchIntermediaNodeDataEventArgs e)
 {
     ProcessTreeSearchIntermediaNodeData(sender, e);
 }