I've Followed a tutorial on getting ironruby up and running and that works great. However when I try to delve a little deeper, like using button click events I get this error;
Could not load type 'System.Reflection.Emit.ModuleBuilder' from assembly 'mscorlib, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
And my MainPage.rb
include System
include System::Windows
include System::Windows::Controls
# Set the titles
Phone.find_name("ApplicationTitle").text = "this is the application title"
Phone.find_name("PageTitle").text = "and page title here"
# Create a new button and add to page
button = Button.new
button.content = "Click Me"
Phone.find_name("ContentPanel").children.add(button)
button.click do |s,e| # breaks here
MessageBox.show("Button Click Works!")
end
Is it currently posisible to build professional apps with ironruby?
The issue with using dynamic languages on Windows Phone 7 is it's omission of the System.Reflection.Emit
implementation. However, IronRuby is able to run most code through it's interpreter, rather than emitting IL, which makes it possible to run in Windows Phone 7. However, things like subclassing CLR types and implementing interfaces require emitting IL, so those .NET interop features will not be functional on Windows Phone 7.
For your specific example, instead of using a block, try using a method:
def on_button_click(s, e)
MessageBox.show("Button Click Works!")
end
button.click.add(method(:on_button_click))
However, if this is not working for you, please submit an issue.