Getting Started with Windows 8 Development (vii) three progress bars and two timers in Windows 8

Source: Internet
Author: User

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

Related Article

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.