• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

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

  • Temp.zip
    33.6 KB · Views: 215
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.21/day)
Location
Cheeseland (Wisconsin, USA)
Use the BeginTime property of the DoubleAnimation class to delay the animations start.
 

MrSeanKon

New Member
Joined
Nov 14, 2006
Messages
267 (0.04/day)
Location
Athens in love with Anna :)
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

  • Temp.zip
    62.9 KB · Views: 148

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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).
 

MrSeanKon

New Member
Joined
Nov 14, 2006
Messages
267 (0.04/day)
Location
Athens in love with Anna :)
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:
Top