Game Development Reference
In-Depth Information
return SplashScreenLibrary.LoadingResult.Success;
}
public string StatusText
{
get
{
return String.Format(“Processing Sample Job 3 : Task {0} of 100”,
_currentTask);
}
}
}
The component is ready, and we now have some sample jobs at our disposal to
work with. The last step is to instantiate the settings and launcher class, configure
it appropriately (splash screen or loading dialog), and finally activate it. The fol-
lowing code shows how to configure and launch a splash screen.
SplashScreen splash = new SplashScreen();
splash.BackgroundImage = new System.Drawing.Bitmap(@”PathToSplash.bmp”);
splash.DisplayStatus = false;
splash.DisplayVersion = true;
splash.VersionText = Application.ProductVersion;
splash.DisplayTime = 3000;
splash.Launch();
The code to launch the loading dialog is quite similar to the splash screen, except
the display time is not set, and the job objects are bound to the job manager for
processing. The following code shows how to configure and launch a loading dialog.
SplashScreen splash = new SplashScreen();
splash.BackgroundImage = new System.Drawing.Bitmap(@”PathToSplash.bmp”);
splash.DisplayStatus = true;
splash.DisplayVersion = true;
splash.VersionText = Application.ProductVersion;
splash.LoadingJobs.Add(new SampleLoadingJob1());
splash.LoadingJobs.Add(new SampleLoadingJob2());
splash.LoadingJobs.Add(new SampleLoadingJob3());
splash.Launch();
The background image can also be loaded from the assembly if it has been com-
piled as an embedded resource. Simply add the appropriate bitmap image to the
project, right-click on it, select Properties, and set the Build Action to Embedded
Search Nedrilad ::




Custom Search