public MainPage() { this.InitializeComponent(); WeatherModel weatherModel = new WeatherModel(); weatherModel.InitWeather(); WeatherViewModel weatherVM = new WeatherViewModel(weatherModel); }
private void InitWeather() { //Create all necessary view models for weather CurrentWeather = new WeatherCurrentViewModel(); TodaysWeather = new WeatherDayViewModel(); TomorrowsWeather = new WeatherDayViewModel(); WeeksWeather = new WeatherWeekViewModel(); //Init the weather model and give it a reference to all view models Weather = new WeatherModel(CurrentWeather, TodaysWeather, TomorrowsWeather, WeeksWeather); Weather.InitWeather(locationService.DefaultLocation); //Set the interval, tick handler, and then start the timer. weatherTimer.Interval = TimeSpan.FromMilliseconds(WeatherRefreshRate); weatherTimer.Tick += WeatherTick; weatherTimer.Start(); todaysWeatherCounter = 0; tomorrowsWeatherCounter = 0; weeksWeatherCounter = 0; voiceControlledModules.Add(Weather); }