c# - ProgressRing is not showing while the app runs -
i developing 'universal app' windows 8.1 , windows phone 8.1
i need add progressring
control page, because there task takes time complete , should notify user app loading data. followed instruction on mdsn in following link:
to create indeterminate progress ring , stated need:
4. adding indeterminate progress ring
when can't estimate how work remains finish task , task block user interaction, use indeterminate progress ring. indeterminate progress ring shows animate sequence of dots moving in circle.
the problem progressring
doesn't play animation of "loading", when insert prog.isactive = true;
before code starts task
if comment task lines of code, plays.
xaml :
<progressring x:name="prog" margin="435,349,388,181" fontfamily="{staticresource fontfamily6}" fontsize="25" />
c#:
private void leveltap(object sender, tappedroutedeventargs e) { prog.isactive = true; checknav(sender); } private void checknav(object sender) { textblock tb = sender textblock; gamesetter game = new gamesetter(); game.level = (int)textdict[tb]; if (!levelsarr[game.level]) return; if (!gotoleader) { prog.isactive = false; callnav(true, game); } else { prog.isactive = false; callnav(false, game); } } private void callnav(bool b,gamesetter g) { if(b) frame.navigate(typeof(game8), g); else frame.navigate(typeof(mainpage), g); }
note: task runs uses dictionary
, windows.storage.applicationdata
, , navigation
page in end.
you can use code block in every function if progressing indeterminate mode open:
#region progress ring start await dispatcher.runasync(coredispatcherpriority.normal, () => { waiter.visibility = visibility.visible; // progress ring name waiter. }); #endregion await task.delay(1000); checknav(sender); // process #region progress ring finish await dispatcher.runasync(coredispatcherpriority.normal, () => { waiter.visibility = visibility.collapsed; // progress ring name waiter. }); #endregion
Comments
Post a Comment