c# - UI refresh looping a Dispatcher.BeginInvoke -
i'm trying system.windows.shapes.rectangle rotation in y axis simulating card rotation, showing route.
the problem ui refreshes @ end.
simplified version of code
call of method
for (i=0; i<=180; i++) { int j = i; dispatcher.begininvoke(new a_dispatcher(() => { print_animation_of_card(card, i); }), null); }
method
private void print_animation_of_card(system.windows.shapes.rectangle card) { ... system.windows.media.planeprojection p = card.projection system.windows.media.planeprojection; p.rotationy = i; card.projection = p; }
i have tried put method, same result...
how can show rotation movement of system.windows.shapes.rectangle?
i believe problem using begininvoke()
instead of invoke
. not wait 1 angle of rotation complete before next 1 called, calls stacked on top of eachother.
try dispatcher.invoke()
or put whole loop inside 1 dispatcher.begininvoke()
, see if results more satisfaction.
Comments
Post a Comment