private void Window_Loaded(object sender, RoutedEventArgs e) { splashData = SplashDataDAO.GetAll(); Random _rng = new Random(); int indexRandom = _rng.Next(splashData.Count); nameCakeTextBlock.Text = splashData[indexRandom].Name; IntroAccessText.Text = splashData[indexRandom].Description; var isShowSplash = bool.Parse(ConfigurationManager.AppSettings["ShowSplashScreen"]); if (isShowSplash == false) { var listCakeScreen = new ListCakesScreen(); listCakeScreen.Show(); this.Close(); } else { timer = new System.Timers.Timer(); timer.Elapsed += Timer_Elapsed; timer.Interval = 1000; timer.Start(); } }
private void listCakeListViewItem_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var listCakesScreen = new ListCakesScreen(); listCakesScreen.Show(); this.Close(); }
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { count++; if (count == target) { timer.Stop(); Dispatcher.Invoke(() => { var listCakeScreen = new ListCakesScreen(); listCakeScreen.Show(); this.Close(); }); } Dispatcher.Invoke(() => { splashProgress.Value = count; }); }