Game Development Reference
In-Depth Information
Resource. If the assembly is called SplashTest , and the image is called Splash.bmp ,
the following code will return a bitmap from the data embedded in the assembly.
using System.Reflection;
Assembly mainAssembly = Assembly.GetExecutingAssembly();
splash.SplashImage = new Bitmap(mainAssembly.GetManifestResourceStream
This approach is generally superior to loading the bitmap from the file system
because the user cannot easily modify or remove the image, and there is one less
file that you have to worry about deploying with your tool.
This chapter provided a reusable and customizable component, suitable for dis-
playing splash screens or loading screens that prohibit users from accessing the
application until processing has finished.
One area that could be improved is where a method is passed into each job to han-
dle refreshing of the status text. This approach was used to decouple the interface
from a lot of the implementation specifics, but it would be an improvement to
refactor the framework where this method invocation is unnecessary.
The full source code to this component can be found on the Companion Web site
in the Chapter 40 folder.
Search Nedrilad ::

Custom Search