/// <summary> /// Filters search items, if category was selected. /// </summary> internal void Filter() { var allowedCategories = SearchCategories.Where(cat => cat.IsSelected); FilteredResults = searchResults.Where(x => allowedCategories .Select(cat => cat.Name) .Contains(x.Category)); // Report selected categories to instrumentation StringBuilder strBuilder = new StringBuilder(); foreach (var category in SearchCategories) { strBuilder.Append(category.Name); strBuilder.Append(" : "); if (category.IsSelected) { strBuilder.Append("Selected"); } else { strBuilder.Append("Unselected"); } strBuilder.Append(", "); } InstrumentationLogger.LogPiiInfo("Filter-categories", strBuilder.ToString().Trim()); }
/// <summary> /// Filters search items, if category was selected. /// </summary> internal void Filter() { var allowedCategories = SearchCategories.Where(cat => cat.IsSelected); FilteredResults = searchResults.Where(x => allowedCategories .Select(cat => cat.Name) .Contains(x.Category)); }
/// <summary> /// Saves advanced find settings to isolated storage. /// </summary> public void SaveSettings() { string searchCategories = string.Empty; if (SearchCategories.Any(category => category.Selected)) { searchCategories = SearchCategories .Where(category => category.Selected) .Select(category => category.Name) .Aggregate((str1, str2) => str1 + "," + str2); } IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchText", SearchText); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchIgnoreCase", IgnoreCase.ToString()); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchUseWildcards", UseWildcards.ToString()); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchUseRegex", UseRegex.ToString()); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchCategories", searchCategories); }