private async void GetCurrentWeatherData()
        {
            try
            {
                var info = await _wInfo.CurrentWeatherData();

                _weatherMainClass = info;

                DateTime d  = new DateTime(1970, 1, 1, 0, 0, 0);
                DateTime d2 = d.AddSeconds(_weatherMainClass._dt + _weatherMainClass._timezone);
                InfoRequestTime = d2;

                CloudStatus = _weatherMainClass._cloudStatus._all.ToString();
                WindDegree  = _weatherMainClass._windBase._deg;
                WindSpeed   = _weatherMainClass._windBase._speed.ToString();

                try
                {
                    ObservableCollection <WeatherDiscriptionCurrentClass> _dummyList = new ObservableCollection <WeatherDiscriptionCurrentClass>();

                    foreach (WeatherGrapicsIconInfo b in _weatherMainClass._weatherGrapicsIconInfoList)
                    {
                        _dummyList.Add(new WeatherDiscriptionCurrentClass(b._id, b._description));
                    }

                    WeatherDiscriptionCurrentClass = null;
                    WeatherDiscriptionCurrentClass = _dummyList;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    WeatherDescription = "ERROR";
                }

                SelectedCityCountry = _weatherMainClass._systemInfo._country;

                FeelsLikeTemp = _weatherMainClass._weatherInfoBase._feelsLike.ToString();
                Humidity      = _weatherMainClass._weatherInfoBase._humidity.ToString();
                Pressure      = _weatherMainClass._weatherInfoBase._pressure.ToString();
                Temp          = _weatherMainClass._weatherInfoBase._temp.ToString();
                TempMax       = _weatherMainClass._weatherInfoBase._tempMax.ToString();
                TempMin       = _weatherMainClass._weatherInfoBase._tempMin.ToString();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#2
0
        private WeatherMainClass DummyClass()
        {
            WeatherMainClass myc = new WeatherMainClass();

            myc._base       = "TEST BASE";
            myc._cod        = 8008;
            myc._dt         = 101;
            myc._id         = 202;
            myc._name       = "TEST NAME";
            myc._timezone   = 0;
            myc._visibility = 100;


            CloudStatusClass cloudStatusClass = new CloudStatusClass();

            cloudStatusClass._all = 100;
            myc._cloudStatus      = cloudStatusClass;


            CoordinationClass coordinationClass = new CoordinationClass();

            coordinationClass._lat = 10.2;
            coordinationClass._lon = 100.2;
            myc._coordination      = coordinationClass;


            SystemInfoClass systemInfoClass = new SystemInfoClass();

            systemInfoClass._country = "GERMANYY";
            systemInfoClass._id      = 101;
            systemInfoClass._sunrise = 1000;
            systemInfoClass._sunset  = 2000;
            systemInfoClass._type    = 141;
            myc._systemInfo          = systemInfoClass;

            WeatherGrapicsIconInfo weatherGrapicsIconInfo1 = new WeatherGrapicsIconInfo();

            weatherGrapicsIconInfo1._id          = 101;
            weatherGrapicsIconInfo1._description = "TEST WEATHER";
            weatherGrapicsIconInfo1._icon        = "hust";
            weatherGrapicsIconInfo1._main        = "juu";
            myc._weatherGrapicsIconInfoList      = new List <WeatherGrapicsIconInfo>();
            myc._weatherGrapicsIconInfoList.Add(weatherGrapicsIconInfo1);


            WeatherInfoBase weatherInfoBase = new WeatherInfoBase();

            weatherInfoBase._feelsLike = 10.0;
            weatherInfoBase._humidity  = 20;
            weatherInfoBase._pressure  = 1000;
            weatherInfoBase._temp      = 10.0;
            weatherInfoBase._tempMax   = 10.0;
            weatherInfoBase._tempMin   = 10.0;
            myc._weatherInfoBase       = weatherInfoBase;


            WindBaseClass windBaseClass = new WindBaseClass();

            windBaseClass._deg   = 241;
            windBaseClass._speed = 20.4;
            myc._windBase        = windBaseClass;

            return(myc);
        }