// a predicate to filter for ICollectionView private bool CurrenciesFilter(object item) { Currency currency = item as Currency; if (String.IsNullOrWhiteSpace(FilterString) || currency == null) { return(true); } return(currency.IssuedCountryName.ToLower().Contains(FilterString.ToLower())); }
private bool AdvertiserFilter(object item) { var l = item as Advertizer; if (string.IsNullOrWhiteSpace(FilterString)) { return(true); } return(l.Name.ToLower().Contains(FilterString.ToLower().Trim())); }
private bool ItemsFilter(object o) { if (string.IsNullOrEmpty(FilterString)) { return(true); } string filterString = FilterString.ToLower().Trim(); return(o.ToString().ToLower().Contains(filterString)); }
private bool checkIfStringIsInText(string text) { try { if (!IsRegularExpression) { return(text.ToLower().Contains(FilterString.ToLower())); } else { return(Regex.Match(text, FilterString, RegexOptions.IgnoreCase).Success); } } catch { return(false); } }
private void FilterList() { if (FilteredCompanies == null) { FilteredCompanies = new ObservableCollection <ICompany>(); } FilteredCompanies.Clear(); if (string.IsNullOrEmpty(FilterString)) { FilteredCompanies.AddRange(AllCompanies); } else { var query = AllCompanies.Where(c => c.Name.ToLower().Contains(FilterString.ToLower()) || c.City.ToLower().Contains(FilterString.ToLower())); FilteredCompanies.AddRange(query); } }
private bool AdModuleFilter(object item) { var l = item as AdModule; if (IsAdModuleMustFitThePage && CurrentPage != null && l.Grid.Id != CurrentPage.Grid.Id) { return(false); } if (IsAdModuleAdvertizerFilterOn && AdModuleAdvertizerFilter != null && l.Advertiser != AdModuleAdvertizerFilter) { return(false); } if (string.IsNullOrWhiteSpace(FilterString)) { return(true); } return(l.Name.ToLower().Contains(FilterString.ToLower().Trim())); }
private void OpenFile(object sender, EventArgs e) { if (opening) { return; } opening = true; String Filter = ""; List <String> Filters = new List <string>(); Filters.Add("all files (*.*)|*.*"); List <String> Extenstions = new List <string>(); String AllSupportedFilesA = "All Supported Files ("; String AllSupportedFilesB = "|"; foreach (Plugin p in Program.PluginManager.Plugins) { foreach (Type t in p.FileFormatTypes) { if (t.GetInterfaces().Contains(typeof(IViewable))) { dynamic d = new StaticDynamic(t); String FilterString; try { FilterString = d.Identifier.GetFileFilter(); } catch (NotImplementedException) { continue; } if (FilterString == null || FilterString.Length == 0) { continue; } if (!Filters.Contains(FilterString.ToLower())) { string[] strArray = FilterString.Split(new char[] { '|' }); if ((strArray == null) || ((strArray.Length % 2) != 0)) { continue; } string[] q = FilterString.Split('|'); for (int i = 1; i < q.Length; i += 2) { foreach (string f in q[i].Split(';')) { if (!Extenstions.Contains(f.ToLower())) { Extenstions.Add(f.ToLower()); if (!AllSupportedFilesA.EndsWith("(")) { AllSupportedFilesA += ", "; } AllSupportedFilesA += f.ToLower(); if (!AllSupportedFilesB.EndsWith("|")) { AllSupportedFilesB += ";"; } AllSupportedFilesB += f.ToLower(); } } } Filters.Add(FilterString.ToLower()); if (Filter != "") { Filter += "|"; } Filter += FilterString; } } } } if (Filter != "") { Filter = AllSupportedFilesA + ")" + AllSupportedFilesB + "|" + Filter; Filter += "|"; } Filter += "All Files (*.*)|*.*"; openFileDialog1.Filter = Filter; if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK && openFileDialog1.FileName.Length > 0) { foreach (String s in openFileDialog1.FileNames) { Program.FileManager.OpenFile(new EFEDiskFile(s)); } } opening = false; }
/// <summary> /// Filtes users for groups /// </summary> private void FilterUsersForGroups() { if (string.IsNullOrEmpty(FilterString)) { FilteredUsers = new ObservableCollection <UserViewModel>(Users); return; } FilteredUsers = new ObservableCollection <UserViewModel>(Users.Where(u => u.UserName.ToLower().Contains(FilterString.ToLower()))); }