Пример #1
0
        private void fileExplorerTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            fileExplorerTreeView.SelectedNode = e.Node;
            FileExplorerManager.LoadDirectory(form, e.Node, false);
        }
Пример #2
0
        public void InitializeExplorer()
        {
            ViewManager = new FileExplorerManager("F:\\작업공간", true);
            ViewManager.ExceptExtensions.Add(".txt");
            ViewManager.SetFilter(typeof(EvFile), ".exe");
            ViewManager.SetFilter(typeof(EvText), ".txt2");
            ViewManager.SetFilter(typeof(EvText), ".txt3");
            StatusManager.Add((int)StatusMode.None, "");
            StatusManager.Add((int)StatusMode.Checked, "pack://application:,,,/Nemont.WPF.Demo;component/Asset/status_check.png");
            StatusManager.Add((int)StatusMode.Undefined, "pack://application:,,,/Nemont.WPF.Demo;component/Asset/status_undefine.png");
            ViewManager.RefreshDirectory();
            var item1   = new EvItem("Item 1", "pack://application:,,,/Nemont.WPF.Demo;component/Asset/polyline.png");
            var item2   = new EvItem("Item 2", "pack://application:,,,/Nemont.WPF.Demo;component/Asset/polyline.png");
            var folder1 = new EvFolder("Custom Folder");

            item1.Status          = (int)StatusMode.Checked;
            folder1.IconOpenedUri = "pack://application:,,,/Nemont.WPF.Demo;component/Asset/polygon.png";
            folder1.IconClosedUri = "pack://application:,,,/Nemont.WPF.Demo;component/Asset/polygon.png";
            folder1.Sub.Add(item1);
            folder1.Sub.Add(item2);
            (ViewManager.Root[0] as EvFolder).Sub.Insert(0, folder1);

            ViewManager.Filtering(FilterMode.All);

            ViewManager.OnDoubleClick = OnDoubleClick;
            ViewManager.OnRightClick  = OnRightClick;
        }
Пример #3
0
        private void pathTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            if (e.KeyCode == Keys.Enter)
            {
                FileExplorerManager.GoToSelectedFolder(form);
            }
        }
Пример #4
0
        private void SearchWithFilters()
        {
            Form1 form = (Form1)ParentForm;

            SearchOption searchOption = SearchOption.TopDirectoryOnly;

            if (includeSubdirectoriesToolStripMenuItem.Checked)
            {
                searchOption = SearchOption.AllDirectories;
            }

            FileExplorerManager.ListFolderContentIntoFile(form, fileExplorerTreeView.SelectedNode, showSizeToolStripMenuItem.Checked, listFolderContentWithPatternValueToolStripMenuItem.Text, searchOption);
        }
Пример #5
0
        private void refreshToolStripButton_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            if (fileExplorerTreeView.SelectedNode != null)
            {
                FileExplorerManager.LoadDirectory(form, fileExplorerTreeView.SelectedNode, true);
                pathTextBox.Text = fileExplorerTreeView.SelectedNode.ToolTipText;
                pathTextBox.Select(pathTextBox.Text.Length, 0);
            }
            else
            {
                FileExplorerManager.LoadFileTree(form, true);
            }
        }
Пример #6
0
        //
        // Summary:
        //    This function takes the user's choice number (1 or 2) and the instance of the 'FilesResultManager' class,
        //    receives user information from the user,
        //    and calls the GetAllFiles() function to search for the results
        //
        // Parameters:
        //   numSelect:
        //     The requested number is 1 or 2
        //     To know whether the user wants to search from "My Computer" or a specif specific folder.
        //
        //   filesResult:
        //     An instance of the 'FilesResultManager' class
        //     containing the GetAllFiles() search function and the Event 'FileActionHandler'.
        //
        // Returns:
        //     Returns void
        //
        // Exceptions:
        //   This function contains the Event 'callback' Which creates a new show of 'SearchResultModel'.
        //
        public static void SearchFileFromDirectory(byte numSelect, FilesResultManager filesResult)
        {
            FileExplorerManager fileManager = new FileExplorerManager();
            string directoryName;
            string originalDirectory;
            bool   isDirectoryExists;
            string keyword;

            if (numSelect == 1)
            {
                originalDirectory = "My Computer";
                Console.WriteLine("Enter file name to search:");
                keyword = Console.ReadLine().Trim();

                int searchID = fileManager.AddNewSearch(new SearchDetailModel
                {
                    SearchTime    = DateTime.Now,
                    DirectoryPath = "My Computer",
                    KeyWord       = keyword
                });

                Action <string> callback = (fullPath) =>
                {
                    Console.WriteLine($"{fullPath}");
                    fileManager.UpdateDbResults(new SearchResultModel
                    {
                        FullPath = fullPath,
                        SearchId = searchID
                    });
                };

                DriveInfo[] allDrives = DriveInfo.GetDrives();

                filesResult.FileActionHandler += callback;
                foreach (var drive in allDrives)
                {
                    filesResult.GetAllFiles(originalDirectory, drive.Name, keyword);
                }
                filesResult.FileActionHandler -= callback;
            }
            else if (numSelect == 2)
            {
                Console.WriteLine(" Enter root directory to search in:");

                while (!(isDirectoryExists = Directory.Exists(directoryName = Console.ReadLine())))
                {
                    Console.Clear();
                    Console.WriteLine(" The requested folder does not exist \n" +
                                      " Please try again or select another folder");
                }

                originalDirectory = directoryName;
                Console.WriteLine(" Enter file name to search:");
                keyword = Console.ReadLine().Trim();

                int searchID = fileManager.AddNewSearch(new SearchDetailModel
                {
                    SearchTime    = DateTime.Now,
                    DirectoryPath = originalDirectory,
                    KeyWord       = keyword
                });

                Action <string> callback = (file) =>
                {
                    Console.WriteLine($"{file}");
                    fileManager.UpdateDbResults(new SearchResultModel
                    {
                        FullPath = file,
                        SearchId = searchID
                    });
                };

                filesResult.FileActionHandler += callback;
                filesResult.GetAllFiles(originalDirectory, directoryName, keyword);
                filesResult.FileActionHandler -= callback;
            }

            if (filesResult.CounterResults == 0)
            {
                Console.WriteLine(" No files containing the requested string were found.");
            }

            Console.WriteLine();
            Console.WriteLine(" Search finished !! \n Want to continue?");
            Console.WriteLine();
        }
Пример #7
0
        private void openSelectedFileToolStripButton_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.OpenSelectedNode(form);
        }
Пример #8
0
        private void fileExplorerTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.OpenSelectedNode(form);
        }
Пример #9
0
        private void fileExplorerTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.SelectNode(form);
        }
Пример #10
0
        private void openIntoWindowsExplorerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.OpenIntoWindowsExplorer(form, fileExplorerTreeView.SelectedNode);
        }
Пример #11
0
        private void listFolderContentWithLenghtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.ListFolderContentIntoFile(form, fileExplorerTreeView.SelectedNode, true);
        }
Пример #12
0
        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.LoadDirectory(form, fileExplorerTreeView.SelectedNode, true);
        }
Пример #13
0
        private void filePropertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.ShowPropertiesSelectedNode(form);
        }
Пример #14
0
        private void pathGoButton_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.GoToSelectedFolder(form);
        }
Пример #15
0
        private void hiddenToolStripButton_CheckedChanged(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.LoadFileTree(form, true);
        }
Пример #16
0
        private void refreshDriveToolStripButton_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)ParentForm;

            FileExplorerManager.LoadFileTree(form, true);
        }