private void Filter_Unchecked(object sender, RoutedEventArgs e) { var purityToggleButton = sender as ToggleButton; purityToggleButton.Style = App.Current.Resources["ToggleButtonUnchecked"] as Style; UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "unchecked"); }
private void ImageDisplayCriteria_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListPickerInitialized) { ListPicker listPicker = sender as ListPicker; ListPickerItem selectedItem = listPicker.SelectedItem as ListPickerItem; string name = listPicker.Name.ToString(); string value = selectedItem.Name.ToString().ToLower(); UserPreference.UpdatePreference(name, value); } }
private void Filter_Checked(object sender, RoutedEventArgs e) { var purityToggleButton = sender as ToggleButton; switch (purityToggleButton.Name.ToString()) { case "GeneralFilter": GeneralFilter.Style = App.Current.Resources["ToggleButtonChecked"] as Style; UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "checked"); break; case "AnimeFilter": AnimeFilter.Style = App.Current.Resources["ToggleButtonChecked"] as Style; UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "checked"); break; case "PeopleFilter": PeopleFilter.Style = App.Current.Resources["ToggleButtonChecked"] as Style; UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "checked"); break; case "SFWFilter": SFWFilter.Style = App.Current.Resources["SFWFilterChecked"] as Style; UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "checked"); break; case "SketchyFilter": SketchyFilter.Style = App.Current.Resources["SketchyFilterChecked"] as Style; // Changes the first argument to use a variable instead of a literal string. UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "checked"); break; case "NSFWFilter": NSFWFilter.Style = App.Current.Resources["NSFWFilterChecked"] as Style; UserPreference.UpdatePreference(purityToggleButton.Name.ToString(), "checked"); break; } }