4. Parse the parameter args in main (string[] args). The main is to start the program in the console while giving the form of parameters.
// ParseArgs may set values that are used elsewhere,
// such as startFullScreen and CurrentSettingsDirectory.
ParseArgs(args);
The parameters in args may be:
"worldwind://": Load positioning to show the sphere somewhere.
"/F": Full screen start.
"/s= ...": Specifies the folder path to load "configuration".
Here to note that the main function is generally no parameters, if we want to write can be in the console to start the program to pass the parameters, you can learn from.
5. Load last used configuration information, including last used WorldWind main form usage information and last used world sphere display information
Load configuration
if(CurrentSettingsDirectory == null)
{
// load program settings from default directory
LoadSettings();
World.LoadSettings();
}
else
{
LoadSettings(CurrentSettingsDirectory);
World.LoadSettings(CurrentSettingsDirectory);
}
Here are a few knowledge points to learn:
(1) C # objects are serialized as XML files and deserialized XML files as objects, see: http://www.cnblogs.com/wuhenke/archive/2009/12/10/1621437.html
Deserialization in the Load method of the SettingsBase class:
XmlSerializer ser = new XmlSerializer(defaultSettings.GetType());
using(TextReader tr = new StreamReader(fileName))
{
settings = (SettingsBase)ser.Deserialize(tr);
settings.m_fileName = fileName; // remember where we loaded from for a later save
}