Пример #1
0
        public void GetDataFromService(string urlCity, bool isCities)
        {
            var client = new WeatherServiceClient("BasicHttpBinding_IWeatherService");

            if (client.State == CommunicationState.Created)
            {
                if (isCities)
                {
                    this._cities = client.GetCities();
                }
                this._meteo = client.GetWeather(urlCity);
                //в случае отказа сервера в получении текущей даты
                if (this._meteo.CurrentDay == null)
                {
                    this._meteo.CurrentDay = this._meteo.Days.FirstOrDefault(day => day.Day.Contains(DateTime.Now.ToString("dd MMMM"))) ?? this._meteo.Days.FirstOrDefault(day => day.Day.Contains(DateTime.Now.AddDays(1).ToString("dd MMMM")));
                }
            }
        }