protected override void OnCreate(Bundle savedInstanceState) { // TODO: Hook up data from view model to Activity base.OnCreate(savedInstanceState); InitializeView(); _requests = new List <WeatherRequest> { new WeatherRequest { City = new City { Name = "Current Location" } }, new WeatherRequest { City = new City { Name = "Bellevue" } }, new WeatherRequest { City = new City { Name = "San Francisco" } }, new WeatherRequest { City = new City { Name = "London" } } }; _listAdapter = new WeatherListAdapter(this, _requests); _listView.Adapter = _listAdapter; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); InitializeView(); _listAdapter = new WeatherListAdapter(this, ViewModel.WeatherRequests.ToList()); _listView.Adapter = _listAdapter; ViewModel.ReloadAction = () => RunOnUiThread(() => { _listAdapter.WeatherRequests = ViewModel.WeatherRequests.ToList(); _listAdapter.NotifyDataSetChanged(); }); Task.Run(async() => await ViewModel.InitAsync()); }