private void Window_Loaded(object sender, RoutedEventArgs e) { categoryText.Text = food.Category; var config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); var option = config.AppSettings.Settings["DisplayOption"].Value; switch (option) { case "Order by name A-Z": { AtoZ.IsSelected = true; recipeList = recipeList.SortByName(); ChangeBindingList(recipeList); break; } case "Order by name Z-A": { ZtoA.IsSelected = true; recipeList = recipeList.SortByNameDescending(); ChangeBindingList(recipeList); break; } case "Order by date descending": { DateDescending.IsSelected = true; recipeList = recipeList.SortByDateDescending(); ChangeBindingList(recipeList); break; } case "Order by date ascending": { DateAscending.IsSelected = true; recipeList = recipeList.SortByDate(); ChangeBindingList(recipeList); break; } } ChangeBindingList(recipeList); }
private void Page_Loaded(object sender, RoutedEventArgs e) { var config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); var option = config.AppSettings.Settings["DisplayOption"].Value; Console.WriteLine(option); switch (option) { case "Sort By Name A-Z": { AtoZ.IsSelected = true; recipeList = recipeList.SortByName(); ChangeBindingList(recipeList); break; } case "Sort By Name Z-A": { ZtoA.IsSelected = true; recipeList = recipeList.SortByNameDescending(); ChangeBindingList(recipeList); break; } case "Sort By Date Descending": { DateDescending.IsSelected = true; recipeList = recipeList.SortByDateDescending(); ChangeBindingList(recipeList); break; } case "Sort By Date Ascending": { DateAscending.IsSelected = true; recipeList = recipeList.SortByDate(); ChangeBindingList(recipeList); break; } } }