WorldWind Series II: Seizing the thief first 2

Source: Internet
Author: User

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
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.