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
diff --git a/sketchscript/sketchscript/MainWindow.xaml.cs b/sketchscript/sketchscript/MainWindow.xaml.cs | |
index 22a01f3..8e62ff1 100644 | |
--- a/sketchscript/sketchscript/MainWindow.xaml.cs | |
+++ b/sketchscript/sketchscript/MainWindow.xaml.cs | |
@@ -17,6 +17,8 @@ using System.IO; | |
using AeroGlass; | |
using System.Diagnostics; | |
using SThread = System.Threading; | |
+using Microsoft.Scripting.Hosting; | |
+using IronRuby; |
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
class Bouncer | |
def initialize xvelocity, yvelocity, canvas | |
@xvelocity = xvelocity | |
@yvelocity = yvelocity | |
@canvas = canvas | |
end | |
def update target | |
if (Canvas.get_left(target) + @xvelocity) >= (@canvas.actual_width - target.width) or (Canvas.get_left(target) + @xvelocity) <= 0 | |
@xvelocity = -@xvelocity |
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
Action eachFrame = null; | |
_scope.TryGetVariable<Action>("each_frame", out eachFrame); | |
EachFrame = eachFrame; | |
Func<object, dynamic> eachObject = null; | |
_scope.TryGetVariable<Func<object, dynamic>>("each_object", out eachObject); | |
EachObject = eachObject; |
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
// create a ScriptRuntime, the portal to the DLR Hosting API | |
// CreateFromConfiguration gets information, like languages | |
// are available, from an app.config configuration file | |
var runtime = ScriptRuntime.CreateFromConfiguration(); | |
// create a ScriptEngine for IronRuby | |
var engine = runtime.GetEngine("IronRuby"); | |
// a ScriptScope stores state between executions | |
var scope = engine.CreateScope(); |
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
<html> | |
<head> | |
<!-- one javascript block required to make Ruby work --> | |
<script type="text/javascript" src="http://mschnlnine.vo.llnwd.net/d1/dlr-20091120.js"></script> | |
</head> | |
<body> | |
<script type="text/ruby"> | |
window.alert "Hello, World -- from Ruby" | |
</script> | |
</body> |
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
import System # .NET System namespace | |
import foo # foo.py in the XAP | |
import bar.baz # bar/baz.py in the XAP |
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 setup = Silverlight.DynamicEngine.CreateRuntimeSetup(); | |
var runtime = new Hosting.ScriptRuntime(setup); |
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
using Silverlight = Microsoft.Scripting.Silverlight; | |
var runtime = Silverlight.DynamicEngine.CreateRuntime(); | |
var python = runtime.GetEngine("python"); |
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
using System; | |
using IronPython.Hosting; | |
public class dynamic_demo { | |
static void Main() { | |
var ipy = Python.CreateRuntime(); | |
dynamic mock = ipy.UseFile("mock.py"); | |
// Calls the Python Mock type's constructor | |
dynamic m = mock.Mock(); |
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
using System; | |
using IronRuby; | |
public class dynamic_demo { | |
static void Main() { | |
var rb = Ruby.CreateEngine(); | |
rb.ExecuteFile("mock.rb"); | |
dynamic globals = rb.Runtime.Globals; | |
// Call the Ruby "Mock" class constructor |