/// <summary> /// Starts the hero image slide show. /// </summary> public void StartHeroImageSlideShow() { // Only start slideshow if we were able to get // any hero images if (HeroImages != null && HeroImages.Any()) { _heroImageScrollTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(7) }; StartHeroImageSlideshowTimer(); } }
/// <summary> /// Instantiates the hero image slideshow timer. /// </summary> public void InstantiateHeroImageSlideShowTimer() { // Only instantiate slideshow timer if we were able to get // any hero images if (HeroImages != null && HeroImages.Any()) { _heroImageScrollTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(HeroImageScrollTimerInterval) }; _heroImageScrollTimer.Tick += (s, e) => { var selectedIndex = HeroImages.IndexOf(SelectedHeroImage); selectedIndex = (selectedIndex + 1) % HeroImages.Count; SelectedHeroImage = HeroImages[selectedIndex]; }; } }