IronRuby 开发 Windows Phone 7 应用程序的可行性如何?

发布于 2025-01-06 18:17:51 字数 871 浏览 3 评论 0原文

我已经按照教程获取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

目前是否可以使用ironruby 构建专业应用程序?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

匿名。 2025-01-13 18:17:51

在 Windows Phone 7 上使用动态语言的问题是它省略了 System.Reflection.Emit 实现。然而,IronRuby 能够通过其解释器运行大多数代码,而不是发出 IL,这使得它可以在 Windows Phone 7 中运行。但是,子类化 CLR 类型和实现接口之类的事情需要发出 IL,因此这些 .NET 互操作功能将在 Windows Phone 7 上不起作用。

对于您的具体示例,请尝试使用一种方法,而不是使用块:

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

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

但是,如果这不适合您,请提交问题

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.

情绪操控生活 2025-01-13 18:17:51

可能,但我个人认为完成专业工作的唯一方法是使用本机操作系统。这样你就拥有了你必须做的事情的最大权力

Probably BUT I personally think the only way to do a professional job is using the native OS. That way you have the most power of what you have to do

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文