Esempio n. 1
0
        internal void get_nsu_current_temp(WeatherInfo w)
        {
            string st = _sitereader.temperature();

            if (st != null || !st.Contains("°"))
            {
                CultureInfo culture = new CultureInfo("en");
                double      t       = double.Parse(st.Substring(0, st.IndexOf("°")), culture);
                w.TemperatureLow = w.TemperatureHigh = t;
            }
            else
            {
                throw new Exception("incorrect NSU current temperature");
            }
        }
Esempio n. 2
0
        private void read_nsu_current_temp(WeatherInfo w)
        {
            bool success = false;

            try
            {
                string st = _sitereader.temperature();
                if (st != null || !st.Contains("°"))
                {
                    success = true;
                    CultureInfo culture = new CultureInfo("en");
                    double      t       = double.Parse(st.Substring(0, st.IndexOf("°")), culture);
                    lock (_locker)
                    {
                        w.TemperatureLow = w.TemperatureHigh = t;
                        _succeeded       = true;
                    }
                }
            }
            catch (Exception e)
            {
                success      = false;
                _error_descr = e.Message;
            }
            finally
            {
                if (!success)
                {
                    lock (_locker)
                    {
                        _succeeded = false;
                    }
                }
            }

            try
            {
                _sitereader.getrest();
            }
            catch (Exception)
            {
            }
        }