Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created November 21, 2012 12:39
Show Gist options
  • Select an option

  • Save DinisCruz/4124669 to your computer and use it in GitHub Desktop.

Select an option

Save DinisCruz/4124669 to your computer and use it in GitHub Desktop.
O2 Script - Visual API - Compile and display an O2 UserControl in VS
var visualStudio = new VisualStudio_2010();
var targetfile = @"E:\O2_V4\O2.FluentSharp\O2.FluentSharp.REPL\Ascx\ascx_Simple_Script_Editor.cs";
var type = "ascx_Simple_Script_Editor";
visualStudio.open_Document(targetfile);
var hostPanel = visualStudio.open_Panel("for type:" + type);
hostPanel.toolWindowPane().as_Dock();
Action compileAndShow =
()=>{
hostPanel.clear();
hostPanel.add_Label("Compiling file:\n\n {0}".format(targetfile.fileName()))
.textSize(20).fill(true).text_Center()
.insert_LogViewer();
var assembly = targetfile.compile();
if (assembly.notNull())
hostPanel.clear().add_Control(assembly.type("ascx_Simple_Script_Editor"));
};
VisualStudio_2010.on_DocumentSaved.clear().add(
(document)=>{
var savedFile = document.FullName;
"Save detected for file: {0}".info(savedFile);
if (targetfile == savedFile)
compileAndShow();
});
compileAndShow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment