/// <summary> /// Loads the currentBucket list properties into the VM properties for display in UI /// </summary> private void LoadPillboxState() { //get all medicines in the morning var compartmentMorning = compartmentsService.GetCompartment("Morning").Result; //bind IEnumerable<Bucket> to the ListView's ItemSource MedicinesInMorning = null; //Important! ensure the list is empty first to force refresh! MedicinesInMorning = new ObservableCollection <CompartmentDetail>(compartmentMorning.Details); //get all medicines in the noon var compartmentNoon = compartmentsService.GetCompartment("Noon").Result; MedicinesInNoon = null; MedicinesInNoon = new ObservableCollection <CompartmentDetail>(compartmentNoon.Details); //get all medicines in the evening var compartmentEvening = compartmentsService.GetCompartment("Evening").Result; MedicinesInEvening = null; MedicinesInEvening = new ObservableCollection <CompartmentDetail>(compartmentEvening.Details); //get all medicines in the night var compartmentNight = compartmentsService.GetCompartment("Night").Result; MedicinesInNight = null; MedicinesInNight = new ObservableCollection <CompartmentDetail>(compartmentNight.Details); }