private void listScreen_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var listTripScreen = new ListTripScreen(); listTripScreen.Show(); this.Close(); }
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { count++; if (count == target) { timer.Stop(); Dispatcher.Invoke(() => { var listTripScreen = new ListTripScreen(); listTripScreen.Show(); this.Close(); }); } Dispatcher.Invoke(() => { splashProgress.Value = count; }); }
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(); } }