void locationEventHandleAction(MvxGeoLocation location) { string lat = location.Coordinates.Latitude.ToString(); string lon = location.Coordinates.Longitude.ToString(); CityObject city = new CityObject(null, null, new CityCoordinate(lat, lon)); WeatherMainModel pageModel = new WeatherMainModel(city); _currentLocationPageView = new WeatherMainPageViewModel(pageModel); }
//Private methods // private void InitViewModels() { ViewModels = new List <WeatherMainPageViewModel>(); foreach (WeatherMainModel mainModel in _model.MainModels) { ViewModels.Add(new WeatherMainPageViewModel(mainModel)); } if (ViewModels.Count > 0) { _defaultViewModel = ViewModels[0]; } else if (_currentLocationPageView != null) { _defaultViewModel = _currentLocationPageView; } else { _defaultViewModel = new WeatherMainPageViewModel(new WeatherMainModel(new CityObject(null, null, new CityCoordinate(null, null)))); } }
void errorEventHandleAction(MvxLocationError obj) { System.Diagnostics.Debug.WriteLine("-- Error get location: {} --", obj.Code); _currentLocationPageView = null; }