Created
November 7, 2012 15:03
-
-
Save DinisCruz/4032116 to your computer and use it in GitHub Desktop.
O2 Script - VisualStudio API - Create WinForms Control on Document save
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var targetFile = @"E:\O2_V4\O2.FluentSharp\O2.FluentSharp.REPL\Ascx\ascx_Simple_Script_Editor.cs"; | |
| var targetType = "ascx_Simple_Script_Editor"; | |
| var visualStudio = new VisualStudio_2010(); | |
| var panel = visualStudio.open_Panel("Live instance of: " + targetType) | |
| .insert_LogViewer();; | |
| Action<string> compileAndShowFile = | |
| (file)=>{ | |
| var compileEngine = new CompileEngine(false); | |
| var assembly = compileEngine.compileSourceFile(file); | |
| if (assembly.notNull()) | |
| { | |
| var type = assembly.type(targetType); | |
| panel.clear().add_Control(type); | |
| } | |
| }; | |
| visualStudio.open_Document(targetFile); | |
| VisualStudio_2010.on_DocumentSaved.clear() | |
| .add((document)=>{ | |
| var fileToCompile = document.FullName; | |
| if (fileToCompile == targetFile) | |
| compileAndShowFile(targetFile); | |
| }); | |
| compileAndShowFile(targetFile); | |
| return "done"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment