private void SortType_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (SortType.SelectedIndex == 0) { view.Sets = new ObservableCollection <SetView>( view.Sets.OrderByDescending(s => s.Efficiency)); view = new SetsPageView(view); DataContext = view; } if (SortType.SelectedIndex == 1) { view.Sets = new ObservableCollection <SetView>( view.Sets.OrderByDescending(s => s.Popularity)); view = new SetsPageView(view); DataContext = view; } if (SortType.SelectedIndex == 2) { view.Sets = new ObservableCollection <SetView>( view.Sets.OrderByDescending(s => s.Complexity)); view = new SetsPageView(view); DataContext = view; } if (SortType.SelectedIndex == 3) { view.Sets = new ObservableCollection <SetView>( view.Sets.OrderByDescending(s => s.AverageStudyTime)); view = new SetsPageView(view); DataContext = view; } }
private void UpdatePage() { var sets = CatLangRestClient.GetAllSets(); var setModels = new ObservableCollection <SetView>(sets.Select(s => new SetView(s)).ToList()); view = new SetsPageView(setModels); DataContext = view; LearnSet.IsEnabled = false; }
public SetsPageView(SetsPageView view) { SelectedItem = null; Sets = view.Sets; UpdIconPath = view.UpdIconPath; }