protected override void OnInitialize() { base.OnInitialize(); IsLoading = true; Task.Factory.StartNew(() => { Items.Add("ACCOUNT"); Items.Add("VISITOR"); var customers = CustomerService.GetCustomers().Where(o => !o.Name.IsMatch("Cash")); var previousGroup = ""; foreach (var customer in customers) { var item = new HomeItemViewModel { Customer = customer }; if (item.Group != previousGroup) { item.IsFirstInGroup = true; previousGroup = item.Group; } Accounts.Add(item); } Visitors.AddRange(CustomerService.GetCustomers().Where(o => o.Name.IsMatch("Cash")).Select(o => new HomeItemViewModel { Customer = o })); }) .ContinueWith(task => { if (task.IsFaulted) { ScreenCoordinator.HandleFault(task.Exception); } else { Execute.OnUIThread(() => { IsLoading = false; SelectedItem = Items.First(); }); } }); }