Forum: IronRuby problem with WPF animation.Duration= and TimeSpan

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Meinrad R. (Guest)
on 2009-02-16 16:55
(Received via mailing list)
Hi all,

Once again I am hitting some unexpected behavior in IronRuby. Might be a
bug
;)

>>> animation = System::Windows::Media::Animation::DoubleAnimation.new()
=> #<System::Windows::Media::Animation::DoubleAnimation:0x000005c>

>>> animation.Duration= System::Windows::Duration.new(
System::TimeSpan.FromSeconds(2))
=> #<System::Windows::Duration:0x000005e>

>>> animation.Duration= System::Windows::Duration.Forever
=> #<System::Windows::Duration:0x0000060>


So far everything works as expected. Now trying to directly set a
timespan
which should be possible in C#:

>>> animation.Duration= System::TimeSpan.FromSeconds(2)
:0: can't convert System::TimeSpan into System::Windows::Duration
(TypeError)


ok, automatic conversion seems not yet to work here ... but the next
thing
is really strange:

>>> animation.Duration= System::Windows::Duration.new(
System::TimeSpan.FromSeconds(2))
:0: can't convert System::TimeSpan into System::Windows::Duration
(TypeError)

>>> animation.Duration= System::Windows::Duration.Forever
:0: can't convert System::TimeSpan into System::Windows::Duration
(TypeError)

>>> ???

What has already worked now doesn't any more, depending on the value
that
has been set before. You will probably know what is going on.

Cheers,
-- henon
Jimmy S. (Guest)
on 2009-02-17 01:23
(Received via mailing list)
Crazy. I've opened a bug:
http://rubyforge.org/tracker/index.php?func=detail...

~js

From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Meinrad
Recheis
Sent: Monday, February 16, 2009 6:34 AM
To: ironruby-core
Subject: [Ironruby-core] problem with WPF animation.Duration= and
TimeSpan

Hi all,

Once again I am hitting some unexpected behavior in IronRuby. Might be a
bug ;)
>>> animation = System::Windows::Media::Animation::DoubleAnimation.new()
=> #<System::Windows::Media::Animation::DoubleAnimation:0x000005c>

>>> animation.Duration= System::Windows::Duration.new( System::TimeSpan.FromSeconds(2))
=> #<System::Windows::Duration:0x000005e>

>>> animation.Duration= System::Windows::Duration.Forever
=> #<System::Windows::Duration:0x0000060>

So far everything works as expected. Now trying to directly set a
timespan which should be possible in C#:
>>> animation.Duration= System::TimeSpan.FromSeconds(2)
:0: can't convert System::TimeSpan into System::Windows::Duration
(TypeError)


ok, automatic conversion seems not yet to work here ... but the next
thing is really strange:

>>> animation.Duration= System::Windows::Duration.new( System::TimeSpan.FromSeconds(2))
:0: can't convert System::TimeSpan into System::Windows::Duration
(TypeError)

>>> animation.Duration= System::Windows::Duration.Forever
:0: can't convert System::TimeSpan into System::Windows::Duration
(TypeError)

>>> ???

What has already worked now doesn't any more, depending on the value
that has been set before. You will probably know what is going on.

Cheers,
-- henon
This topic is locked and can not be replied to.