Created
June 10, 2010 04:48
-
-
Save mattpodwysocki/432562 to your computer and use it in GitHub Desktop.
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 'System.CoreEx, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | |
require 'System.Interactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | |
require 'System.Reactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | |
require 'System.Windows.Forms' | |
include System | |
include System::Collections::Generic | |
include System::Linq | |
include System::Windows::Forms | |
class TestForm < Form | |
def initialize() | |
self.Text = 'Hello IronRuby' | |
end | |
end | |
form = TestForm.new | |
clickObservable = Observable.method(:from_event).of(EventArgs).call(form, 'Click') | |
clickObserver = Observer.method(:create).of(IEvent[EventArgs]).call( | |
lambda {|on_next| MessageBox::show('clicked') }, | |
lambda { |err| puts err.to_s }, | |
lambda { puts 'completed' }) | |
clickSubcription = clickObservable.subscribe(clickObserver) | |
Application.run(form) |
Well nevermind! Looks like you've already done it! :) Cheers!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With IronRuby 1.1, it looks like you could do something like
I haven't tried this, but it seems plausible.