-
October 12th, 2013, 04:45 PM
#1
Storyboard II
Hi All,
Thanks for the help on my previous storyboard quest!!
The following;
I start the storyboard using
board.Begin();
I use this in
Windows_Activated (object sender, EventArgs e)
So Far so good.
When
Windows_Deactivated(object sender, EventArgs e)
Is called I use
board.Stop();
And of course it stops BUT I want to stop it at a certain point.
Instead off right away.
How can I do this?
Regards,
Ger
Last edited by TBBW; October 12th, 2013 at 04:50 PM.
Reason: editorial
-
October 13th, 2013, 12:44 AM
#2
Re: Storyboard II
Try calling SeekAlignedToLastTick(TimeSpan offset) either right before or right after you call Stop();
-
October 13th, 2013, 04:42 PM
#3
Re: Storyboard II
why does this not work?
board.Pause();
board.RepeatBehavior = new RepeatBehavior(1);
board.Resume();
regards,
ger
-
October 13th, 2013, 05:07 PM
#4
Re: Storyboard II
You should read up on Storyboard in msdn and try some different properties and methods to get the behavior you are looking for.
-
October 15th, 2013, 02:58 PM
#5
Re: Storyboard II
hi Arjay,
MSDN is my homepage already...
I'm overlooking something but I do not know what...
for instance;
Code:
board.Pause();
Time = board.GetCurrentTime();
board.Resume();
for (int i = 0; i < 1000000; i++)
;
board.Pause();
Time1 = board.GetCurrentTime();
board.Resume();
both Time and Time1 have the same value, why?
regards,
Ger
Last edited by TBBW; October 15th, 2013 at 02:58 PM.
Reason: editorial
-
October 15th, 2013, 03:42 PM
#6
Re: Storyboard II
I'm looking for something like
board.stop(at time 4 || 8 || 12 || 16 || 20 etc. sec.);
regards,
Ger
-
October 15th, 2013, 04:19 PM
#7
Re: Storyboard II
Originally Posted by TBBW
both Time and Time1 have the same value, why?
When I read Msdn, it tells me that a timer is used when the story board is started and then the timer is stopped when board.Stop() is called.
In terms of your problem, it could be that the timer is run in the same thread as your other code.
If so, that would explain why you are seeing the Time and Time1 as having the same values. The reason for this is that even though you call Resume() and use a for loop to wait by spinning the cpu (something you should never do in a real program btw), Time1 is the same time because the timer in the story board never got a chance to run.
Well, I suspect this is the case anyway. One thing I did notice when looking up my previous answer of SeekAlignedToLastTick() is that several of the methods in msdn are marked as synchronous or asynchronous. You need to understand how some of these return immediately (and their effect is performed at a later clock tick) vs. the asynchronous ones where the effect is performed immediately.
Btw, is there a way that you can respond to a post directly? I posted that you could try using SeekAlignedToLastTick() and you respond with a different question. I have no idea if you tried using SeekAlignedToLastTick() or you tried using it but it didn't work. It would be nice to get some feedback from my posts letting me know if something worked or not. That way, we both could be on the same page in coming up with a solution.
-
October 17th, 2013, 02:51 AM
#8
Re: Storyboard II
hi all,
To get everybody on the same page.
I have a storyboard which starts when the window is activated.
using board.begin();
In the XAML I set the duration to forever, because I do not know how long the window will be active.
when the window loses focus iow is deactivated the storyboard is stopped using board.stop();
The problem with this is, it's stop right away.
What I want, that the current cycle is finished, and when the cycle is finished it has to stop
the cycle duration is 4 sec. (it is a drop shadow from 0% to 100% and back to 0%) taking 4 sec.
As Arjay is suggesting I should use
SeekAlignedToLastTick(TimeSpan offset)
But I do not see how...
reading the MSDN info does not give me the aha moment, sorry.
regards,
ger
Last edited by TBBW; October 17th, 2013 at 02:52 AM.
Reason: edit
-
October 17th, 2013, 02:04 PM
#9
Re: Storyboard II
Have you tried to use SeekAlignedToLastTick(TimeSpan offset) in code? Did it synchronously set the correct position?
I'm not saying this would be the final answer, but it would be useful for me helping you to know if it able to work at all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|