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 Window_Loaded(object sender, RoutedEventArgs e) { splashData = SplashDataDAO.GetAll(); Random _rng = new Random(); int indexRandom = _rng.Next(splashData.Count); nameText.Text = splashData[indexRandom].Name; desText.Text = splashData[indexRandom].Description; var folder = AppDomain.CurrentDomain.BaseDirectory; var pathAbsolute = $"{folder}\\Assets\\Images\\Systems\\{splashData[indexRandom].BackgroundNameFile}"; ImageBrush myBrush = new ImageBrush(); Image image = new Image(); image.Source = new BitmapImage( new Uri( pathAbsolute, UriKind.Absolute)); myBrush.ImageSource = image.Source; container.Background = myBrush; var isShowSplash = bool.Parse(ConfigurationManager.AppSettings["ShowSplashScreen"]); if (isShowSplash == false) { var listTripScreen = new ListTripScreen(); listTripScreen.Show(); this.Close(); } else { timer = new System.Timers.Timer(); timer.Elapsed += Timer_Elapsed; timer.Interval = 1000; timer.Start(); } }