public void buildGui() { var topPanel = this.add_Panel(); Path = topPanel.insert_Above<TextBox>(20); sourceCode = topPanel.add_SourceCodeEditor(); dataGridView = sourceCode.insert_Above<Panel>(100).add_DataGridView(); leftPanel = topPanel.insert_Left<Panel>(300); Path.onEnter(loadFiles); Path.onDrop( (fileOrFolder)=>{ Path.set_Text(fileOrFolder); loadFiles(fileOrFolder); }); dataGridView.SelectionChanged+= (sender,e) => { if (dataGridView.SelectedRows.size() == 1) { var selectedRow = dataGridView.SelectedRows[0]; var filePath = selectedRow.Cells[0].Value.str(); var filename = selectedRow.Cells[1].Value.str(); var lineNumber = selectedRow.Cells[2].Value.str(); "opening up source code: {0}".info(filePath); sourceCode.open(filePath.pathCombine(filename)); sourceCode.gotoLine(lineNumber.toInt() + 1); dataGridView.focus(); } }; }
public void loadFiles(string filesPath, List<string> filesToLoad) { sourceCode.set_Text("Loading files from: {0}".format(filesPath)); Path.set_Text(filesPath); var filesContent = new Dictionary<string,string>(); var nonBinaryFiles = new List<string>(); foreach(var file in filesToLoad) if (file.isBinaryFormat().isFalse()) nonBinaryFiles.add(file); foreach(var file in nonBinaryFiles) filesContent.add(file.remove(filesPath),file.contents()); searchEngine = new SearchEngine(); searchEngine.loadFiles(nonBinaryFiles); //searchEngine.fixH2FileLoadingIssue(); leftPanel.clear(); treeView = leftPanel.add_TreeViewWithFilter(filesContent); treeView.afterSelect<string>( (fileContents)=>{ sourceCode.open(filesPath + treeView.selected().get_Text()); }); sourceCode.colorCodeForExtension(treeView.selected().str()); sourceCode.set_Text(""); textSearch_TextBox = leftPanel.controls<TextBox>(true)[1]; textSearch_TextBox.onEnter( (text)=>{ var searchResults = searchEngine.searchFor(text); dataGridView.loadInDataGridView_textSearchResults(searchResults); }); }
public ascx_HtmlTagViewer buildGui(bool addLoadUrlTextBox, bool addHtmlCodeViewer) { //return (ascx_HtmlTagViewer)this.invokeOnThread( // ()=>{ var TopPanel = this.add_Panel(); HtmlTags_TreeView = TopPanel.add_TreeView_for_HtmlTags() .showSelection(); if (addHtmlCodeViewer) { HtmlCodeViewer = HtmlTags_TreeView.insert_Left<Panel>(TopPanel.width()/2).add_SourceCodeViewer(); HtmlTags_TreeView.after_TagSelect_showIn_SouceCodeViewer(HtmlCodeViewer); var optionsPanel = HtmlCodeViewer.insert_Below<Panel>(50); optionsPanel.add_CheckBox("View as Xml",0,5, (value)=>{ ViewAsXml = value; reloadPage(); }) .append_Label("Search html code:") .top(5) .append_TextBox("") .onTextChange((text)=> HtmlCodeViewer.editor().invoke("searchForTextInTextEditor_findNext",text)) .onEnter((text)=> HtmlCodeViewer.editor().invoke("searchForTextInTextEditor_findNext",text)) .align_Right(optionsPanel); optionsPanel.add_Link("Refresh tags",30,0,()=> show(HtmlCodeViewer.get_Text())); } if (addLoadUrlTextBox) { PageToOpen = TopPanel.insert_Above<Panel>(20).add_TextBox().fill(); var propertyGrid = HtmlTags_TreeView.insert_Right<Panel>(150).add_PropertyGrid(); HtmlTags_TreeView.afterSelect<HtmlAgilityPack.HtmlNode>( (htmlNode)=> propertyGrid.show(htmlNode)); PageToOpen.onEnter( (text)=>{ if (text.fileExists()) show(text.fileContents()); else show(text.uri()); }); } HtmlNodeFilter = HtmlTags_TreeView.insert_Below_HtmlTagFilter((filter) => show(HtmlCode, filter) ); return this; //}); }