Beispiel #1
0
        /// <summary>
        /// Traverse tree nodes and assign an icon corresponding to each file status.
        /// Since each file has 2 status codes, X and Y, for index with relation to the
        /// git cache, and for current file with relation to the index, isIndex
        /// specifies which code will be used.
        /// </summary>
        public static void ViewAssignIcon(ClassStatus status, TreeNode rootNode, bool isIndex)
        {
            TreeNodeCollection nodes = rootNode.Nodes;

            foreach (TreeNode tn in nodes)
            {
                if (tn.Tag is ClassCommit)
                {
                    tn.ImageIndex = (int)Img.Changelist;
                }
                else
                {
                    string name = isIndex ? tn.Text : tn.Tag.ToString();
                    if (status.IsMarked(name) || tn.Nodes.Count == 0)
                    {
                        char icon = isIndex ? status.Xcode(name) : status.Ycode(name);
                        if (Staticons.ContainsKey(icon))
                        {
                            tn.ImageIndex = (int)Staticons[icon];
                        }
                        else
                        {
                            tn.ImageIndex = 0;
                        }
                    }
                    else
                    {
                        tn.ImageIndex = status.HasModifiedDescendants(name)
                           ? (int)Img.FolderClosedModified
                           : (int)Img.FolderClosed;
                    }
                }
                ViewAssignIcon(status, tn, isIndex);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Traverse tree nodes and assign an icon corresponding to each file status.
 /// Since each file has 2 status codes, X and Y, for index with relation to the
 /// git cache, and for current file with relation to the index, isIndex
 /// specifies which code will be used.
 /// </summary>
 public static void ViewAssignIcon(ClassStatus status, TreeNode rootNode, bool isIndex)
 {
     TreeNodeCollection nodes = rootNode.Nodes;
     foreach (TreeNode tn in nodes)
     {
         if (tn.Tag is ClassCommit)
             tn.ImageIndex = (int)Img.Changelist;
         else
         {
             string name = isIndex ? tn.Text : tn.Tag.ToString();
             if (status.IsMarked(name) || tn.Nodes.Count == 0)
             {
                 char icon = isIndex ? status.Xcode(name) : status.Ycode(name);
                 tn.ImageIndex = (int)Staticons[icon];
             }
             else
                 tn.ImageIndex = (int)Img.FolderClosed;
         }
         ViewAssignIcon(status, tn, isIndex);
     }
 }