What is the best way to update splash sceen labels on application startup, to inform the user what's going on ? The problem is that the splash screen is created in an override method, while updating has to be done within the static main method, which can't access "this.SplashScreen".
class SingleInstanceApplication : WindowsFormsApplicationBase
{
[STAThread]
static void Main(string[] args)
{
SetSplashInfo("Data configuration", "Applying DataDirectory");
//Can't be done, this method is static**
//Do some stuff, code removed for reading purposes
}
protected override void OnCreateSplashScreen()
{
this.SplashScreen = new TestSplash();
this.SplashScreen.TopMost = true;
base.OnCreateSplashScreen();
}
private void SetSplashInfo(string txt1, string txt2)
{
if ( this.SplashScreen == null)
return;
TestSplash splashFrm = (TestSplash)this.SplashScreen;
splashFrm.label1.Text = txt1;
splashFrm.label2.Text = txt2;
}
}