/// <summary>
        /// Fills the nodes of the treeview.
        /// </summary>
        private void FillNodes()
        {
            // The nodes
            rootNode = new TreeNodeEx(SR.CertificateStores);
            rootNode.ImageIndex = STORES_IMAGE;
            rootNode.SelectedImageIndex = STORES_IMAGE;
            tvStores.Nodes.Add(rootNode);

            // 1st level: locations
            IEnumerable<CertificateStoreLocation> locations = null;
            if (ShowOtherLocations)
                locations = Capi32.GetSystemStoreLocations();
            else locations = new StoreLocation[] 
            { 
                StoreLocation.LocalMachine, 
                StoreLocation.CurrentUser 
            }.Select(l => CertificateStoreLocation.FromStoreLocation(l));

            rootNode.Nodes.AddRange(locations
                .OrderBy(location => location.Id)
                .Select(location =>
                {
                    var locationNode = new FolderTreeNode(location.ToString());
                    locationNode.CollapsedImageIndex = CLOSED_LOCATION_IMAGE;
                    locationNode.SelectedCollapsedImageIndex = CLOSED_LOCATION_IMAGE;
                    locationNode.ExpandedImageIndex = OPENED_LOCATION_IMAGE;
                    locationNode.SelectedExpandedImageIndex = OPENED_LOCATION_IMAGE;
                    locationNode.Tag = location;

                    // 2nd level: stores
                    locationNode.Nodes.AddRange(Capi32.GetSystemStores(location)
                        .Select(store =>
                        {
                            var storeNode = new FolderTreeNode(store.ToLongString());
                            storeNode.CollapsedImageIndex = CLOSED_STORE_IMAGE;
                            storeNode.SelectedCollapsedImageIndex = CLOSED_STORE_IMAGE;
                            storeNode.ExpandedImageIndex = OPENED_STORE_IMAGE;
                            storeNode.SelectedExpandedImageIndex = OPENED_STORE_IMAGE;
                            storeNode.Tag = store;

                            // 3rd level: physical stores
                            if (ShowPhysicalStores) storeNode.Nodes.AddRange(
                                Capi32.GetPhysicalStores(store.Name)
                                .Select(pstore =>
                                {
                                    var label = string.Format("{0} [{1}]", pstore, Capi32.LocalizeName(pstore));
                                    var pstoreNode = new TreeNodeEx(label);
                                    pstoreNode.ImageIndex = CLOSED_STORE_IMAGE;
                                    pstoreNode.SelectedImageIndex = OPENED_STORE_IMAGE;
                                    pstoreNode.Tag = store;

                                    return pstoreNode;
                                }).ToArray());

                            return storeNode;
                        }).ToArray());

                    return locationNode;
                }).ToArray());

            rootNode.Expand();
        }
        private FolderTreeNode CreateFolderTreeNode(string text)
        {
            var node = new FolderTreeNode(text);
            node.CollapsedImageIndex = closedFolderIndex;
            node.SelectedCollapsedImageIndex = closedFolderIndex;
            node.ExpandedImageIndex = openedFolderIndex;
            node.SelectedExpandedImageIndex = openedFolderIndex;

            return node;
        }