728x90 AdSpace

Latest News

Tuesday, 5 August 2014

Windows 8/ Windows Phone Progress Ring 8 on timer.

Video tutorial of Windows 8 progress ring or progress bar running on timer.










Progress Ring on Timer by imam-yemina

You can also change the progress ring into progress bar. The whole process for progress bar is same.
The code of MainPage.Xaml.cs is:


 public sealed partial class MainPage : Page
    {

        int time = 0;
        DispatcherTimer dispatch;
        public MainPage()
        {
            this.InitializeComponent();
            dispatch = new DispatcherTimer();
            if(!dispatch.IsEnabled)
            {
                dispatch.Tick += dispatch_Tick;   //press double here!
                dispatch.Interval = new TimeSpan(0, 0, 1);
                dispatch.Start();

            }
        }

        void dispatch_Tick(object sender, object e)
        {
            //throw new NotImplementedException();

            time++;
            if(time>9)
            {
                ProgRing.IsActive = false;
                dispatch.Stop();
            }

        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ProgRing.IsActive = true;
            dispatch.Start();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ProgRing.IsActive=false;
        }
    }


The code of MainPage.Xaml is:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="109*"/>
            <RowDefinition Height="659*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="44*"/>
            <ColumnDefinition Width="639*"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="1" TextWrapping="Wrap" Text="Progress Ring" VerticalAlignment="Center" FontSize="48"/>
        <ProgressRing x:Name="ProgRing" Grid.Column="1" HorizontalAlignment="Left" Margin="485,209,0,0" Grid.Row="1" VerticalAlignment="Top" Height="113" Width="131" Background="#FF575757" Foreground="#FFFF0C00"/>
        <Button Content="Start" Grid.Column="1" HorizontalAlignment="Left" Margin="242,365,0,0" Grid.Row="1" VerticalAlignment="Top" Height="80" Width="182" FontSize="48" Click="Button_Click"/>
        <Button Content="stop" Grid.Column="1" HorizontalAlignment="Left" Margin="695,365,0,0" Grid.Row="1" VerticalAlignment="Top" Height="80" Width="182" FontSize="48" Click="Button_Click_1"/>
       

    </Grid>







Yemina Imam

Create Your Badge
Windows 8/ Windows Phone Progress Ring 8 on timer.
  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top