public void SetHaspels(Haspel[] haspels) { Haspels.Clear(); foreach (Haspel h in haspels) { Haspels.Add(h); } }
public async void SetHaspels() { Haspel[] haspels = await myApiManager.HaspelApiManager.GetData(); Haspels.Clear(); foreach (Haspel h in haspels) { Haspels.Add(h); } }
public MainViewModel(INavigationService navigationService, ApiManager apiManager) { myNavigationService = navigationService; myApiManager = apiManager; Haspels.Add(new Haspel { Barcode = "Kan niet met de server verbinden!" }); Haspels.CollectionChanged += Haspels_CollectionChanged; myApiManager.Connected += (a, s) => SetHaspels(); myApiManager.Initialize(); RefreshCommand = new Command(RefreshCommandExecute); }
public MainPage(ApiManager manager) { InitializeComponent(); myApiManager = manager; Haspels.Add(new Haspel { Barcode = "Barcode", Status = Enums.EHaspelStatus.Unkown, UsedBy = "User" }); Haspels.CollectionChanged += Haspels_CollectionChanged; myApiManager.Connected += (a, s) => SetHaspels(myApiManager.HaspelApiManager.GetData().Result); myApiManager.Initialize(); }