Exemplo n.º 1
0
        private void addLocationDailyWeatherToForecast(LocationForecast lf, int forecastNum)
        {
            int cnt = 0;

            foreach (LocationDailyWeather ldw in lf.ForecastDict.Values)
            {
                LocationDaylyForecasts.Add(ldw);
                if (++cnt == forecastNum)
                {
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private void daysNumber_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LocationDaylyForecasts.Clear();
            applyNumOfDaysFilter();

            HashSet <DateTime> filteredDates = filterDates(numberOfDays());

            fromDate.ItemsSource = filteredDates;
            toDate.ItemsSource   = filteredDates;

            fromDate.SelectedItem = filteredDates.First();
            toDate.SelectedItem   = filteredDates.Last();

            drawChart();
        }
Exemplo n.º 3
0
        private ObservableCollection <LocationDailyWeather> applyFilter(Nullable <DateTime> from, Nullable <DateTime> to, List <string> cities)
        {
            if (cities != null)
            {
                foreach (string city in cities)
                {
                    LocationDaylyForecasts = new ObservableCollection <LocationDailyWeather>(LocationDaylyForecasts.Where(i => cities.Any(c => c == i.Name)));
                }
            }
            if (from != null)
            {
                LocationDaylyForecasts = new ObservableCollection <LocationDailyWeather>(LocationDaylyForecasts.Where(i => from <= i.Time));
            }
            if (to != null)
            {
                LocationDaylyForecasts = new ObservableCollection <LocationDailyWeather>(LocationDaylyForecasts.Where(i => i.Time <= to));
            }
            if (from != null && to != null && from > to)
            {
                customNotifier.notifier.ShowError("You have selected invalid values ​​for filtering!");
            }

            return(LocationDaylyForecasts);
        }
Exemplo n.º 4
0
 private ObservableCollection <LocationDailyWeather> delete(string cityName)
 {
     LocationDaylyForecasts = new ObservableCollection <LocationDailyWeather>(LocationDaylyForecasts.Where(i => i.Name != StringHandler.capitalize(cityName)));
     return(LocationDaylyForecasts);
 }