Friday, 19 October 2012

Using O2 FluentSharp REPL in VisualStudio on a WinForms C# application


1) Start VisualStudio 2010

2) Create a new Project of Type 'Windows Forms Application'



3) Once the solution/project loads, open NuGet Package Manager (right click on project and chose 'Manage NuGet Dependencies') ,  search for REPL, and install the one that says "FluentSharp - C# REPL"


after the installation


there should be a number of new references in the project:




4) Change the compilation target (this might not be needed on your project) from 


to '.Net Framework 4'


5) open the Form1.cs file in Form Designer

and double click in the middle of it to open the code behind page:




6) In the Form1.cs:
  • add the using O2.DotNetWrappers.ExtensionMethods; namespace
  • add a simple O2 script like : "I'm loaded".alert();




Run the application and a message box like this should popup:


6) add a treeView to the main Form


Run the application, which should now look like this:


7) Add a Script Editor to the main Form (bellow the TreeView)


Run the application, which should now look like this:



8) Add a Menu with a couple REPL options (and change the size of the from (to 500x500)



Run the application, which should now look like this:


Here is the menu added:


Here are the 3 REPL menus in action:


The end....