C# (WinRT): タイマーを実行

TimerPage

xaml: TimerPage.xaml

<Page
    x:Class="Snippets.DispatcherTimerPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Snippets"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid x:Name="grid" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Button Content="StartTimer" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="45,25,0,0" Click="Button_Click_1"/>
        <Button Content="StopTimer" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="164,25,0,0" Click="Button_Click_2"/>
        <TextBlock x:Name="label" HorizontalAlignment="Left" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Margin="45,91,0,0" FontSize="48"/>

    </Grid>
</Page>

C#: TimerPage.xaml.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace Snippets
{
    public sealed partial class DispatcherTimerPage : Page
    {
        protected DispatcherTimer _timer;

        public DispatcherTimerPage()
        {
            this.InitializeComponent();
        }

        void startTimer()
        {
            stopTimer();

            _timer = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromSeconds(1);
            _timer.Tick += dispatcherTimer_Tick;
            _timer.Start();
        }

        void stopTimer()
        {
            if (_timer != null)
            {
                _timer.Stop();
                _timer = null;
            }
        }

        void dispatcherTimer_Tick(object sender, object e)
        {
            this.label.Text = DateTime.Now.ToString();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            startTimer();
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            stopTimer();
        }
    }
}