定时执行某个方法
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(interval);
timer.Tick += (s, e) =>
{
LayoutRoot.Background = new ImageBrush()
{
ImageSource = new BitmapImage(new Uri("Animation/Loading/0" + imageIndex + ".png", UriKind.Relative)),AlignmentX= AlignmentX.Center,AlignmentY = AlignmentY.Center
};
imageIndex = imageIndex < 8 ? imageIndex + 1 : 1;
};
timer.Start();