Inheritance: BaseModel
Example #1
0
        /*!loads the states
         */
        private static void LoadStates()
        {
            var doc = new XmlDocument();
            doc.Load(AppSettings.GetDataPath() + "\\states.xml");
            XmlElement root = doc.DocumentElement;

            XmlNodeList statesList = root?.SelectNodes("//state");
            if (statesList != null)
                foreach (XmlElement element in statesList)
                {
                    Country country = Countries.GetCountry(element.Attributes["country"].Value);
                    string name = element.Attributes["name"].Value;
                    string shortname = element.Attributes["shortname"].Value;
                    bool overseas = false;

                    if (element.HasAttribute("overseas"))
                    {
                        overseas = Convert.ToBoolean(element.Attributes["overseas"].Value);
                    }

                    var state = new State(country, name, shortname, overseas)
                    {
                        Flag = AppSettings.GetDataPath() + "\\graphics\\flags\\states\\"
                               + element.Attributes["flag"].Value + ".png"
                    };

                    States.AddState(state);

                    if (!File.Exists(state.Flag))
                    {
                        name = "";
                    }
                }
        }
Example #2
0
 public Town(string name, Country country, State state)
 {
     Name = name;
     Country = country;
     State = state;
 }
Example #3
0
 public static void AddState(State state)
 {
     _states.Add(state);
 }
Example #4
0
 public static Town GetTown(string name, State state)
 {
     return Airports.Airports.GetAirport(a => a.Profile.Town.Name == name && a.Profile.Town.State == state).Profile.Town;
 }