Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created October 2, 2012 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DinisCruz/3817500 to your computer and use it in GitHub Desktop.
Save DinisCruz/3817500 to your computer and use it in GitHub Desktop.
O2 Script - Simple File Viewer
var treeView = "C# files in a a path".popupWindow()
.add_TreeView();
var codeViewer = treeView.insert_Right("Source Code")
.add_TextArea();
treeView.afterSelect<string>((file) => codeViewer.set_Text(file))
.onDrop((path)=>{
treeView.clear();
foreach(var file in path.files("*.cs",true))
treeView.add_Node(file.fileName(),file);
});
treeView.add_Node("Drop path here to load files");
var treeView = "C# files in a a path".popupWindow()
.add_TreeView();
var codeViewer = treeView.insert_Right("Source Code")
.add_SourceCodeViewer();
treeView.afterSelect<string>((file) => codeViewer.open(file))
.onDrop((path)=>{
treeView.clear();
foreach(var file in path.files("*.cs",true))
treeView.add_Node(file.fileName(),file);
});
treeView.add_Node("Drop path here to load files");
var treeView = "C# files in a a path".popupWindow()
.add_TreeView();
var codeViewer = treeView.insert_Right("Source Code")
.add_TextArea();
treeView.afterSelect<string>((file) => codeViewer.set_Text(file))
.onDrop((path)=>{
treeView.clear();
foreach(var file in path.files("*.cs",true))
treeView.add_Node(file.fileName(),file);
});
treeView.mainMenu()
.add_Menu("REPL")
.add_MenuItem("REPL treeView", ()=> treeView.script_Me())
.add_MenuItem("REPL codeViewer",()=> treeView.script_Me("codeViewer"))
.add_MenuItem("REPL form", ()=> treeView.parentForm().script_Me("form"));
treeView.add_Node("Drop path here to load files");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment