public ManageGroupsPage() { InitializeComponent(); UpdateItems(GroupsDataStore.GetSaved()); MessagingCenter.Subscribe <Application, List <SavedGroup> >(this, MessageTypes.SavedGroupsChanged, (sender, newSavedGroups) => { UpdateItems(newSavedGroups); }); }
private async Task UpdateGroups(bool fromCistOnly = false) { GroupsLayout.IsEnabled = false; ProgressLayout.IsVisible = true; await Task.Factory.StartNew(() => { if (fromCistOnly) { allGroups = GroupsDataStore.GetAllFromCist(); } else { allGroups = GroupsDataStore.GetAll(); } if (allGroups == null) { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Загрузка списка групп", "Не удолось загрузить список групп. Пожалуйста, попробуйте позже.", "Ok"); }); return; } savedGroups = GroupsDataStore.GetSaved(); groups = new ObservableCollection <Group>(allGroups.OrderBy(g => g.Name)); Device.BeginInvokeOnMainThread(() => { AllGroupsList.ItemsSource = groups; Searchbar_TextChanged(new object(), new TextChangedEventArgs(null, null)); ProgressLayout.IsVisible = false; GroupsLayout.IsEnabled = true; }); }); }