コード例 #1
0
ファイル: FileExplorer.cs プロジェクト: serdar2nc/WinFormsJs
 public void SetFocus(FileExplorerNode node)
 {
     for (int i = 0; i < LoadedNodes.Count; i++)
     {
         if (LoadedNodes[i] != null)
         {
             var htmlNode = LoadedNodes[i].NodeBase;
             if (htmlNode != null)
             {
                 if (LoadedNodes[i] == node)
                 {
                     if (LoadedNodes[i].NodeExplorerState == FileExplorerNode.FileExplorerState.Hover)
                     {
                         LoadedNodes[i].NodeExplorerState = FileExplorerNode.FileExplorerState.HoverFocused;
                     }
                     else
                     {
                         LoadedNodes[i].NodeExplorerState = FileExplorerNode.FileExplorerState.Focused;
                     }
                 }
                 else
                 {
                     LoadedNodes[i].NodeExplorerState = FileExplorerNode.FileExplorerState.None;
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: FileExplorer.cs プロジェクト: serdar2nc/WinFormsJs
 public void ClearSelection(FileExplorerNode DontInclude = null)
 {
     for (int i = 0; i < LoadedNodes.Count; i++)
     {
         if (LoadedNodes[i] != null && LoadedNodes[i] != DontInclude)
         {
             var htmlNode = LoadedNodes[i].NodeBase;
             if (htmlNode != null)
             {
                 LoadedNodes[i].NodeExplorerState = FileExplorerNode.FileExplorerState.None;
             }
         }
     }
 }
コード例 #3
0
ファイル: FileExplorer.cs プロジェクト: serdar2nc/WinFormsJs
        public static FileExplorerNode CreateNode(string path, NodeViewType nvt, FileExplorer parent, bool IsFile = false)
        {
            var fen = new FileExplorerNode()
            {
                IsFile = IsFile, nodeViewType = nvt
            };

            fen.parent    = parent;
            fen.Name      = Path.GetFileName(path);
            fen.Directory = Path.GetDirectoryName(path);
            fen.FullPath  = path;
            fen.Icon      = IconRepository.GetIconByFileName(fen.Name);

            fen.CreateHtmlNode();

            return(fen);
        }
コード例 #4
0
ファイル: FileExplorer.cs プロジェクト: serdar2nc/WinFormsJs
        public int GetSelectionCount(FileExplorerNode DontInclude = null)
        {
            int x = 0;

            for (int i = 0; i < LoadedNodes.Count; i++)
            {
                if (LoadedNodes[i] != null && LoadedNodes[i] != DontInclude)
                {
                    var htmlNode = LoadedNodes[i].NodeBase;
                    if (htmlNode != null)
                    {
                        if (LoadedNodes[i].NodeExplorerState == FileExplorerNode.FileExplorerState.Selected || LoadedNodes[i].NodeExplorerState == FileExplorerNode.FileExplorerState.HoverSelected)
                        {
                            x++;
                        }
                    }
                }
            }
            return(x);
        }
コード例 #5
0
ファイル: FileExplorer.cs プロジェクト: serdar2nc/WinFormsJs
        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;
                }
            }
        }