The default progress bar in Windows 8 also evolves with the times, unlike in previous Silverlight. This article will cover three different progress bars, as well as two kinds of timers in this article.
Progress bar
Main properties:
Value: Current progress value.
Maximum: Maximum progress value.
Isindeterminate: Specifies whether the progress bar is determined.
To determine the progress bar: the progress of a clear progress bar, completed progress in another color display
Key code:
<progressbar maximum= "value=" 0 "height=" name= "Probar1"
Isindeterminate= "False" margin= "275,167,966,581" ></ProgressBar>
Indeterminate progress bar: progress bar with an ambiguous schedule, unpredictable current progress
Key code:
<progressbar isindeterminate= "True" width= "height=" margin= "600,167,566,591"/>
Uncertain progress loops: progress loops with an ambiguous schedule, unpredictable current progress
Key code:
<progressring isactive= "True" height= "1000,167,299,543" width= "margin="/>
Timer
Delay Timer: A timer that runs only once and delays x milliseconds.
Key code:
private void Button_click_1
(object sender, RoutedEventArgs e)
{
delaytimer ();
}
<summary>
///Delay timer
///</summary>
private void Delaytimer ()
{
//Set delay timer
Threadpooltimer Tptimer = Threadpooltimer.createtimer (Async (timer) =>
{await
dispatcher.runasync (
Coredispatcherpriority.high, () =>
{
This.probar1.Value = =)
;
}, Timespan.frommilliseconds (3000);
}
Loop timer: Loop run n times, each delay x millisecond timer.
Key code:
private void Button_click_2 (object sender, RoutedEventArgs e)
{
periodictimer ();
}
<summary>
///Cycle timer
///</summary>
private void Periodictimer ()
{
//cycle timer
Threadpooltimer Tptimer = Threadpooltimer.createperiodictimer (
async (timer) =>
{
await Dispatcher.runasync (
Coredispatcherpriority.high, () =>
{
This.probar1.Value = This.probar1.Value + 1;}
);
},
timespan.frommilliseconds (MB);
Finally we look at the operation of the diagram and source code, please download: Http://files.cnblogs.com/chengxingliang/Win8Progress.rar