Windows 8 utility tip series: 7. Three progress bars and two timers in Windows 8

Source: Internet
Author: User

The default progress bar in Windows 8 also keeps pace with the times, different from the previous in Silverlight. This article describes three different progress bars. In addition, this article also describes two timers.

ProgressEntries

Main attributes:

Value: The current progress value.

Maximum: maximum progress value.

Isindeterminate: Specifies whether the progress bar is determined.

  Confirm progress bar: Progress bar with clear progress. The progress is displayed in another color.

Key code:

  <ProgressBar Maximum="100" Value="0"  Height="20" Name="probar1"                     IsIndeterminate="False" Margin="275,167,966,581"></ProgressBar>

 

  Uncertain progress bar: Progress bar with unclear progress, unpredictable current progress

Key code:

 <ProgressBar IsIndeterminate="True" Width="80" Height="10" Margin="600,167,566,591"/>

 

  Uncertain progress Ring: Progress ring with unclear progress; unpredictable current progress

Key code:

   <ProgressRing IsActive="True" Height="58" Margin="1000,167,299,543" Width="67"/>

 

Timer

  Latency Timer: A timer with a latency of X milliseconds.

Key code:

Private void button_click_1 (Object sender, routedeventargs e) {delaytimer () ;}/// <summary> /// delay timer /// </Summary> private void delaytimer () {// set the delay timer threadpooltimer tptimer = threadpooltimer. createtimer (async (timer) =>{ await dispatcher. runasync (coredispatcherpriority. high, () => {This. probar1.value + = 20;}) ;}, timespan. frommilliseconds (3000 ));}

  Cyclic Timer: A timer that runs cyclically for n times with a latency of X milliseconds.

Key code:

Private void button_click_2 (Object sender, routedeventargs e) {periodictimer () ;}/// <summary >/// cyclic timer /// </Summary> private void periodictimer () {// loop timer threadpooltimer tptimer = threadpooltimer. createperiodictimer (async (timer) => {await dispatcher. runasync (coredispatcherpriority. high, () => {This. probar1.value = This. probar1.value + 1 ;}) ;}, timespan. frommilliseconds (100 ));}

Click win8progress.rar to download the runtime and desired source code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.