コード例 #1
0
        public void RefreshTreeNodeIcon(FactLocation location)
        {
            string[] parts    = location.GetParts();
            TreeNode currentM = mainformTreeRootNode;
            TreeNode currentP = placesTreeRootNode;

            foreach (string part in parts)
            {
                if (part.Length == 0 && !Properties.GeneralSettings.Default.AllowEmptyLocations)
                {
                    break;
                }
                if (mainformTreeRootNode != null && currentM != null)
                {
                    TreeNode childM = currentM.Nodes.Find(part, false).FirstOrDefault();
                    currentM = childM;
                }
                if (placesTreeRootNode != null && currentP != null)
                {
                    TreeNode childP = currentP.Nodes.Find(part, false).FirstOrDefault();
                    currentP = childP;
                }
            }
            // we should now have nodes to update
            if (mainformTreeRootNode != null && currentM != null)
            {
                SetTreeNodeImage(location, currentM);
            }
            if (placesTreeRootNode != null && currentP != null)
            {
                SetTreeNodeImage(location, currentP);
            }
        }