public void handleDirectoryTreeViewPopulationFromDirectory(string directory)
        {
            //this.operationControlCommandsDataGridView.EditingControlShowing += preloadedConfigurationCommandsDataGridView_EditingControlShowing
            //Root directory has null parent;
            FileDirectory rd = new FileDirectory(directory, null);
            if (DirectoryHandler.getInstance().directoryHasFilePattern(directory, PreloadedConfigurationGetterService.getInstance().getFilePattern(this.configFile))) {
                DirectoryTreeViewThreadHandler tvht = new DirectoryTreeViewThreadHandler(rd, this.getDirectoryTreeView());
                DirectoryThreadHandler dht = new DirectoryThreadHandler(rd, PreloadedConfigurationGetterService.getInstance().getFilePattern(this.configFile));
                Cursor.Current = Cursors.WaitCursor;
                try {
                    if (!tvht.checkNodeExists(this.getDirectoryTreeView())) {
                        Thread handleDirectory = new Thread(new ThreadStart(dht.Handle));
                        handleDirectory.Start();
                        handleDirectory.Join();

                        Thread handleTreeView = new Thread(new ThreadStart(tvht.HandleDirectoryTree));
                        handleTreeView.Start();
                        handleTreeView.Join();
                        this.getDirectoryTreeView().Nodes.Add(tvht.getRoot());
                    }
                } finally {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Пример #2
0
        private void populateTreeButton_Click(object sender, EventArgs e)
        {
            String content = directoryInput.Text.Trim();
            int res = Helper.getInstance().ValidateDirectoryInput(content);
            if (res == 0){
                //Helper.getInstance().ThrowError(HelperErrors.NOT_A_DIRECTORY_OR_COMMAND);
                return;
            }
            else if(res == 1){
                //Helper.getInstance().RunCommand(content, cmdTextBox);
                return;
            }
            //Root directory has null parent;
            FileDirectory rd = new FileDirectory(content, null);
            if(false){
                DirectoryTreeViewThreadHandler tvht = new DirectoryTreeViewThreadHandler(rd, directoryTreeView);
                DirectoryThreadHandler dht = new DirectoryThreadHandler(rd, "");
                Cursor.Current = Cursors.WaitCursor;
                try{
                    if (!tvht.checkNodeExists(directoryTreeView)) {
                        Thread handleDirectory = new Thread(new ThreadStart(dht.Handle));
                        handleDirectory.Start();
                        handleDirectory.Join();

                        Thread handleTreeView = new Thread(new ThreadStart(tvht.HandleDirectoryTree));
                        handleTreeView.Start();
                        handleTreeView.Join();
                        directoryTreeView.Nodes.Add(tvht.getRoot());
                    }
                }finally{
                    Cursor.Current = Cursors.Default;
                }
            }
        }