Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:54:07+00:00 2026-06-14T03:54:07+00:00

C# WPF Application I have a SplashScreen being displayed at startup for a minimum

  • 0

C# WPF Application

I have a SplashScreen being displayed at startup for a minimum amount of time by using

Thread.Sleep(int); //int = milliseconds to display splash screen

When that sleep time is reached, the code resumes and the SplashScreen fades out to close by using

SplashScreen.Close(Timespan.FromMilliseconds(int)); //int = milliseconds fade-out

I would like to pause at this point to wait until the SplashScreen has become 100% transparent and is fully closed, then continue with other tasks, I.E. Writiting to the Console or displaying a MainWindow.

Is there an event fired when the (TimeSpan.FromMilliseconds(int)) is complete?
Any other suggestions?

namespace StartupSplash
{
    public class SplashScreenStartup
    {
        //IMPORTANT:set image property to Resource and NOT Splash Screen
        private SplashScreen Splash = new SplashScreen("Resources/SplashScreen.png");

        public void SplashScreenStartUp()
        {
            Splash.Show(false, true);
            Thread.Sleep(3000); // Pause code, display splash screen 3 seconds
            Splash.Close(TimeSpan.FromMilliseconds(3000)); // 3 second splash fade-out
            // I want to wait until splash screen fadeOut has completed before
            // this next console output is performed.
            Console.WriteLine("Executes before Splash fadeOut completes.");
        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:54:09+00:00Added an answer on June 14, 2026 at 3:54 am

    I never did find an event to listen for upon completion of the TimeSpan. Also, after deciding to Not stop the threads, I chose to use DispatcherTimers instead.

    (I have thinned and contained the logic into this one class for reference purposes)

    using System;
    using System.Windows;
    using System.Windows.Threading;
    
    
    namespace StartupSplash2
    {
    
    public partial class MainWindow : Window
    {
        private DispatcherTimer visibleTimer;
        private DispatcherTimer fadeoutTimer;
        private SplashScreen splash;
        private int visibleTime = (4000); //milliseconds of splash visible time
        private int fadeoutTime = (1500); //milliseconds of splash fadeout time
    
        public MainWindow()
        {   
            //hide this MainWindow window until splash completes
            this.Visibility = Visibility.Hidden; 
            InitializeComponent();
            splashIn(); //start the splash
        }
    
        private void splashIn()
        {
            splash = new SplashScreen("Resources/SplashScreen.png"); //ensure image property is set to Resource and not screen saver
            visibleTimer = new DispatcherTimer(); //timer controlling how long splash is visible
            visibleTimer.Interval = TimeSpan.FromMilliseconds(visibleTime);
            visibleTimer.Tick += showTimer_Tick; //when timer time is reached, call 'showTimer_Tick" to begin fadeout
            splash.Show(false, true); //display splash
            visibleTimer.Start();
        }
    
        private void showTimer_Tick(object sender, EventArgs e)
        {
            visibleTimer.Stop();
            visibleTimer = null; //clear the unused timer
            fadeoutTimer = new DispatcherTimer();
            fadeoutTimer.Interval = TimeSpan.FromMilliseconds(fadeoutTime); //a timer that runs while splash fades out and controlls when main window is displayed
            fadeoutTimer.Tick += fadeTimer_Tick; //when fadeout timer is reached, call 'fadeTimer_Tick' to show main window
            splash.Close(TimeSpan.FromMilliseconds(fadeoutTime)); //begin splash fadeout to close
            fadeoutTimer.Start();
        }
    
        private void fadeTimer_Tick(object sender, EventArgs e)
        {
            fadeoutTimer.Stop();
            fadeoutTimer = null; //clear the unused timer
            splash = null; //clear the splash var
            MainWindowReady(); //call method to display main window
        }
    
        public void MainWindowReady()
        {
            this.Visibility = Visibility.Visible;
            //Here is the start of the Main Window Code
            this.Content = "Ok, the app is ready to roll";
        }
    
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my WPF application I have some drawing functionality. I have solved this using
All, We are using ClickOnce to deploy our WPF application and have the need
My application is build in C#4, using Prism (CAL) and WPF. We have the
Suppose I have a WPF application where I have the following architecture: [Worker Thread]
I have a WPF application using Aero Glass. When using the application under a
In my WPF application I have a Canvas in which I do some drawing.
In my WPF application I have a CheckBox whose IsChecked value is bound to
In a WPF application I have a ListView: <ListView Name=ItemSelList ItemsSource={Binding ItemColl} SelectionChanged=ItemSelList_SelectionChanged> <ListView.View>
In my WPF application I have a View that is given a ViewModel, and
I want my WPF application to have a ToggleButton that contains an image of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.