private void FeedSearchTypes() { this.SearchTypes = new ObservableCollection <Tuple <string, SearchOn> >(); foreach (SearchOn item in Enum.GetValues(typeof(SearchOn))) { SearchTypes.Add(new Tuple <string, SearchOn>(item.Translate(), item)); } this.SelectedSearchType = (from s in this.SearchTypes where s.Item2 == Settings.Default.SearchType select s).Single(); }
void PreValidateDefaultSearchTypes() { if (SearchTypes.All(st => st.Name != "none")) { SearchTypes.Add(this.GetDefaultOf <SearchType>(st => { st.Name = "none"; st.MultiValued = false; st.Store = false; st.Index = false; })); } if (SearchTypes.All(st => st.Name != "default")) { SearchTypes.Add(this.GetDefaultOf <SearchType>(st => { st.Name = "default"; st.MultiValued = false; st.Store = true; st.Index = true; })); } }