• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Execution must freeze between animations (C# WPF)

MrSeanKon

New Member
Joined
Nov 14, 2006
Messages
267 (0.04/day)
Location
Athens in love with Anna :)
Well pressing the button both cards are animated. Sometimes it is necessary, but other not.
How can I freeze the code execution? :rolleyes:
I mean that during 2 of Clubs animation the King of Hearts "must wait" for completation and then starts.
One solution I think is by adding a timer but this is not supported in WPF.
Any other ideas?
Using threads, but this is a bigger headache?
 

Attachments

Last edited:
It'll be something in the form Dispatcher. I've never done much with WPF animations so I can't offer much more than that.
 
Use the BeginTime property of the DoubleAnimation class to delay the animations start.
 
Before testing your solution Kreij I made a code based on Ford's idea.
But needs improvements!
It is impossible to create different timers & timer event handlers for each card. I think it is simple for both of you to rewrite a smaller code :)
 

Attachments

I think WPF all runs on one thread--the dispatcher. The system works by invalidating a control and then it redraws that control and all children in the next refresh. If there's nothing invalidated, it keeps displaying what was there previously. This is what allows WPF to be resource friendly (only updates when necessary), flexible (it can draw literally anything), and fast (runs mostly on GPU).
 
Kreij means something like this but the problem is XMAL usage. To be more specific sometimes the same cards must be animated in order (separately during deal) and other times not (when you pick cards from green baize all grabbed cards must be animated simultaneously).
This cannot be written in XMAL. Or am I wrong? :rolleyes:
That's why I uploaded the attachment on my previous post.
BTW the thread is continued ==> link <== please don't post here anymore.
 
Last edited:
Back
Top