Example #1
0
        public void Refresh()
        {
            if (LoadedNodes == null)
            {
                LoadedNodes = new List <FileExplorerNode>();
            }
            else if (LoadedNodes.Count > 0)
            {
                ClearItems();
            }

            var nvt = NodeViewType;

            if (Path == DesktopPath)
            {
                // load the locations of the desktop items.
                nvt = NodeViewType.Medium_Icons;
            }

            string[] Files   = Directory.GetFiles(Path);
            string[] Folders = Directory.GetDirectories(Path);

            for (int i = 0; i < Files.Length; i++)
            {
                LoadedNodes.Add(FileExplorerNode.CreateNode(Files[i], NodeViewType, this, true));
            }

            for (int i = 0; i < Folders.Length; i++)
            {
                LoadedNodes.Add(FileExplorerNode.CreateNode(Folders[i], NodeViewType, this));
            }

            // get the order type!! #TODO# sort items
            int x = 0;
            int y = 19;

            int j = 0;

            for (int i = 0; i < LoadedNodes.Count; i++)
            {
                if (LoadedNodes[i] != null && LoadedNodes[i].NodeBase != null)
                {
                    jQuery.Select(LoadedNodes[i].NodeBase).
                    Css("left", x).
                    Css("top", y);
                    Element.AppendChild(LoadedNodes[i].NodeBase);
                    j++;

                    y += 70;

                    if (j > 8)
                    {
                        x += 78;
                        y  = 0;

                        j = 0;
                    }

                    y += 19;
                }
            }
        }