Esempio n. 1
0
        public HomePageViewModel(IWeatherApiManager weatherApiManager, INavigationService navigationService, IUserDialogs userDialogs) : base(userDialogs)
        {
            _weatherApiManager         = weatherApiManager;
            _navigationService         = navigationService;
            GetCurrentWeatherCommand   = new DelegateCommand(async() => await FetchCurrentWeather());
            GetForecastCommand         = new DelegateCommand(async() => await FetchForecast());
            SelectedDateChangedCommand = new DelegateCommand(async() => await SelectedDateChanged());
            Dates = new ObservableCollection <WeatherDate>();

            var initialDate = DateTime.Now;

            SelectedDate = new WeatherDate
            {
                Date = initialDate
            };
            Dates.Add(SelectedDate);
            for (int i = 1; i < 6; i++)
            {
                Dates.Add(new WeatherDate
                {
                    Date = initialDate.AddDays(i),
                });
            }

            Chart = new LineChart
            {
                BackgroundColor       = SKColors.Transparent,
                PointMode             = PointMode.Circle,
                LineMode              = LineMode.Spline,
                PointSize             = 50,
                AnimationDuration     = TimeSpan.FromSeconds(2.3),
                LabelOrientation      = Orientation.Horizontal,
                ValueLabelOrientation = Orientation.Horizontal,
                LabelColor            = SKColors.White,
                LabelTextSize         = 40,
            };
        }
 public TemperaturesService(ISavedCitiesTemperaturesService savedCitiesTemperaturesService, IWeatherApiManager weatherApiManager, IApiCitiesTemperaturesService apiCitiesTemperaturesService)
 {
     _savedCitiesTemperaturesService = savedCitiesTemperaturesService;
     _weatherApiManager            = weatherApiManager;
     _apiCitiesTemperaturesService = apiCitiesTemperaturesService;
 }