Handling CLR events

Hi,

I’ve created this module to implement INotifyPropertyChanged in classes
for
databinding with WPF, but the way I’m handling the event seems a bit
awkward. So I’m just checking if I’m doing it right. The lines of
interest
would be around line 76 of the link below

http://gist.github.com/316765#file_app.rb

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C. - Mob: +32.486.787.582
Web: http://whiterabbitconsulting.eu - http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
Microsoft IronRuby/C# MVP

It looks good, but I think it’s somethign that should be implemented on
a
rubyism (irubysm?) like attr_*, so we can call a method “event x” to add
the
add_x, remove_x and raise_x methods to that class.

On Thu, Mar 4, 2010 at 10:39 PM, Ivan Porto C. <

http://gist.github.com/321705

http://gist.github.com/321705class Person

include ClrEvents
include ILotteryWinner

attr_event :won_lottery #implements the CLR event WonLottery

end


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Web: http://whiterabbitconsulting.eu - http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
Microsoft IronRuby/C# MVP

 return unless @__handlers__
 @__handlers__.each do |ev|

Look out! Someone snuck in and put python in your nice ruby code!

Unless Ivan objects, I’m going to add this to a sample library I’m
including in rc3. We can discuss moving it to core after post 1.0 plans
are final.

JD

Enuce work. Could this become part of IR?

On Friday, March 5, 2010, Ivan Porto C.
[email protected] wrote:

Web: http://whiterabbitconsulting.eu - http://flanders.co.nz

Web: http://whiterabbitconsulting.eu - http://flanders.co.nz http://flanders.co.nz/

http://rubyforge.org/mailman/listinfo/ironruby-core


Miguel A. Madero Reyes
www.miguelmadero.com (blog)
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs