public async Task LoadCounters() { Counters.Clear(); var counters = await _service.GetAllCounters(); foreach (var counter in counters) { var viewModel = new CounterViewModel(_service, _navigationService); viewModel.Prepare(counter); Counters.Add(viewModel); } }
public async Task LoadCounters() { Counters.Clear(); var counters = await service.GetAllCounters(); Console.WriteLine("Tatiana: inside LoadCounters() in CountersViewModel.cs; counters number = " + counters); foreach (var counter in counters) { var viewModel = new CounterViewModel(service, navigationService); viewModel.Prepare(counter); Counters.Add(viewModel); } }
public async Task LoadCounters() { var newCounters = new ObservableCollection <CounterViewModel>(); var counters = await service.GetAllCounters(); foreach (var counter in counters) { var viewModel = new CounterViewModel(service, navigationService); viewModel.Prepare(counter); newCounters.Add(viewModel); } Counters = newCounters; }