private void AddNewCity(object arg) { if (string.IsNullOrEmpty(_cityName) || _cities.FirstOrDefault((string city) => { return(string.Equals(city, _cityName, System.StringComparison.OrdinalIgnoreCase)); }) != null) { return; } try { _client.DownloadString(CurrentWeatherUrl.Replace("@LOC@", _cityName)); } catch { return; } _cities.Add(_cityName); }
public void ListBoxSelectionChanged(object arg) { if (_selectedCity != null) { _displayedPage = new View.CurrentWeatherPage(); _displayedPage.DataContext = new CurrentWeatherPageViewModel(GetXmlDocument(CurrentWeatherUrl .Replace("@LOC@", _selectedCity))); Utils.Navigator.NavigationService.Navigate(_displayedPage); } }