• 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.07/day)
Likes
73
Location
Athens in love with Anna :)
#1
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:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
21,056 (6.22/day)
Likes
10,181
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#2
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.
 

MrSeanKon

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

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
21,056 (6.22/day)
Likes
10,181
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#5
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.07/day)
Likes
73
Location
Athens in love with Anna :)
#6
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: