private void LoadFilters() { var filters = AppHost.Settings.GetString(RegistryKey, "Filters", string.Empty); if (string.IsNullOrEmpty(filters)) { return; } var root = filters.ToXElement(); if (root == null) { return; } foreach (var element in root.Elements()) { var name = element.GetAttributeValue("name"); var filterText = element.GetAttributeValue("filter"); var rootPath = element.GetAttributeValue("root"); var customFilter = new CustomRenderingSelectorFilter(name, filterText, rootPath); RenderingSelectorFilters.Add(customFilter); } }
private void AddFilter([NotNull] object sender, [NotNull] RoutedEventArgs e) { Debug.ArgumentNotNull(sender, nameof(sender)); Debug.ArgumentNotNull(e, nameof(e)); var dialog = new AddFilterDialog { DatabaseUri = DatabaseUri }; if (!dialog.ShowDialog()) { return; } var customFilter = new CustomRenderingSelectorFilter(dialog.FilterName ?? string.Empty, dialog.FilterText ?? string.Empty, dialog.RootPath ?? string.Empty); customFilter.SetRenderings(renderings); RenderingSelectorFilters.Add(customFilter); SaveFilters(); RenderFilters(customFilter.Name); }