Created
July 15, 2016 14:23
-
-
Save masoo/682f4bf623797a95e6c12b909ac49c8a to your computer and use it in GitHub Desktop.
ruby-csharp_script sample #2
This file contains 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
require 'win32ole' | |
csharp_script = WIN32OLE.new('ruby.csharp_script.CsharpScript') | |
code = <<"EOS" | |
#r "PresentationFramework" | |
using System; | |
using System.Windows; | |
var result = MessageBox.Show( | |
"これはリンゴですか?", | |
"sample002", | |
MessageBoxButton.YesNo, | |
MessageBoxImage.Question | |
); | |
if (result == MessageBoxResult.Yes) | |
{ | |
Console.WriteLine("はい、それはボブです。"); | |
} | |
else | |
{ | |
Console.WriteLine("いいえ、それはアリスです。"); | |
} | |
EOS | |
csharp_script.EvaluateAsync(code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment