定时执行某个方法

mac2022-06-30  17

            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();

转载于:https://www.cnblogs.com/LYunF/archive/2012/08/11/2633597.html

最新回复(0)