Exemple #1
0
 /// <summary>
 /// Determine if the current node is an L, T, or Root junction.
 /// Note: This code is essentially duplicated from the client behavior.
 /// </summary>
 /// <returns>A character defining the type of junction.</returns>
 protected char CalcJunction()
 {
     if (Parent is TreeView && GetPreviousSibling() == null)
     {
         // Get index of node and add 1 to the last value
         string strIndex  = GetNodeIndex();
         int    iIndexPos = strIndex.LastIndexOf('.');
         int    iIndexVal = Convert.ToInt32(strIndex.Substring(iIndexPos + 1)) + 1;
         strIndex = strIndex.Substring(0, iIndexPos + 1) + iIndexVal.ToString();
         // if the node exists, we're an "F" node.
         if (ParentTreeView.GetNodeFromIndex(strIndex) != null)
         {
             return('F');
         }
         else
         {
             return('R');
         }
     }
     else
     {
         TreeNodeCollection col;
         if (Parent is TreeView)
         {
             col = ((TreeView)Parent).Nodes;
         }
         else
         {
             col = ((TreeNode)Parent).Nodes;
         }
         int i = col.IndexOf(this) + 1;
         if (i < col.Count)
         {
             return('T');
         }
         return('L');
     }
 }