2012-02-15 132 views
0

我跟着tutorial獲得ironruby和運行,這很好。然而,當我嘗試深入研究一些,如使用按鈕單擊事件,我得到這個錯誤;開發Windows Phone 7應用程序IronRuby有多可行?

Could not load type 'System.Reflection.Emit.ModuleBuilder' from assembly 'mscorlib, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'. 

而且我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 

它是目前posisible建立專業應用與IronRuby的?

回答

0

在Windows Phone 7上使用動態語言的問題是它沒有實現System.Reflection.Emit。然而,IronRuby能夠通過它的解釋器運行大部分代碼,而不是發射IL,這使得它可以在Windows Phone 7中運行。然而,像繼承CLR類型和實現接口這樣的東西需要發射IL,所以這些.NET interop功能將會不能在Windows Phone 7

功能爲您具體的例子,而是採用了塊,請嘗試使用方法:

def on_button_click(s, e) 
    MessageBox.show("Button Click Works!") 
end 

button.click.add(method(:on_button_click)) 

但是,如果這不是爲你工作,請submit an issue

-1

可能是,但我個人認爲做專業工作的唯一方法是使用本機操作系統。這樣你就有最強大的功能

相關問題