Exemplo n.º 1
0
        protected Weather()
        {
            UnitsSystem = UnitsSystems.Imperial;

            _skyCondition = new Sky();
            _windVector = new Wind();
        }
        private static Wind ParseSpeed(XAttribute value)
        {
            var wind = new Wind();

            if (value == null)
            {
                return wind;
            }

            string[] windInfo = value.Value.Split(' ');

            double speed;

            double.TryParse(windInfo[0], out speed);

            wind.Speed = speed;

            if (windInfo.Length == 3)
            {
                wind.Direction = (WindDirections) Enum.Parse(typeof (WindDirections), windInfo[2]);
            }

            return wind;
        }