-
-
Save panesofglass/432571 to your computer and use it in GitHub Desktop.
Rx in IronRuby
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment