Reputation: 5002
public MainWindow()
{
Thread.Sleep(4000);
InitializeComponent();
}
In my main window, I put Thread.Sleep
and set it for 4 seconds to create a 4 second delay before my application can run the rest of the code. In essence, I did this so that my Splash Screen is guaranteed to show for 4 seconds, rather than just how long the application spends loading (which is less than a second so far). I just attempted this while fooling around, so I'm just wondering if there are any drawbacks to this method.
I ask because there are a ton of questions out there asking people how to make their Splash Screens display longer. Is there a particular reason I shouldn't do this or why some other people haven't tried this?
Upvotes: 0
Views: 355
Reputation: 34519
Some things to think about:
work-time + 4s
.A better way to do this would probably be to use a timer to close the splash screen instead.
However, slash screens are meant to appear when you're doing some work during initial load. If you don't have any work maybe showing a splash screen in the 1st place is the wrong idea?
Upvotes: 5