async Task ExecuteRefreshCommand() { if (IsBusy) { return; } IsBusy = true; try { var identity = await cloudService.GetIdentityAsync(); if (identity != null) { var name = identity.UserClaims.FirstOrDefault(c => c.Type.Equals("name")).Value; Title = $"Tasks for {name}"; } var list = await Table.ReadAllItemsAsync(); Items.ReplaceRange(list); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Items Not Loaded", ex.Message, "OK"); } finally { IsBusy = false; } }
async Task ExecuteGetDataCommand() { if (IsBusy) { return; } IsBusy = true; try { var identity = await cloudService.GetIdentityAsync(); if (identity != null) { var name = identity.UserClaims.FirstOrDefault(c => c.Type.Equals("name")).Value; } var list = await Table.ReadAllItemsAsync(); Items.ReplaceRange(list); } catch (Exception ex) { // Handling Debug environment behaviour - need to revise //await Application.Current.MainPage.DisplayAlert("Items Not Loaded", ex.Message, "OK"); } finally { IsBusy = false; } }