protected virtual Task Refresh() { return(Windows.Invoke(() => { this.Pages.Clear(); foreach (var section in this.Configuration.Sections.OrderBy(section => section.Id)) { if (section.Flags.HasFlag(ConfigurationSectionFlags.System)) { //System config should not be presented to the user. continue; } var sectionMatches = this.MatchesFilter(section); var elements = default(IEnumerable <ConfigurationElement>); if (sectionMatches) { elements = section.Elements; } else if (!this.MatchesFilter(section.Elements, out elements)) { continue; } var page = new ComponentSettingsPage(section.Name, elements); page.InitializeComponent(this.Core); this.Pages.Add(page); } this.SelectedPage = this.Pages.FirstOrDefault(); })); }
protected virtual Task Refresh() { if (this.Configuration == null) { #if NET40 return(TaskEx.FromResult(false)); #else return(Task.CompletedTask); #endif } return(Windows.Invoke(() => { this.Pages.Clear(); foreach (var section in this.Configuration.Sections.OrderBy(section => section.Id)) { if (section.Flags.HasFlag(ConfigurationSectionFlags.System)) { //System config should not be presented to the user. continue; } if (this.Sections != null) { if (!this.Sections.Contains(section.Id, StringComparer.OrdinalIgnoreCase)) { //Does not match section filter. continue; } } var sectionMatches = this.MatchesFilter(section); var elements = default(IEnumerable <ConfigurationElement>); if (sectionMatches) { elements = section.Elements; } else if (!this.MatchesFilter(section.Elements, out elements)) { continue; } var page = new ComponentSettingsPage(section.Name, elements); page.InitializeComponent(this.Core); this.Pages.Add(page); } this.SelectedPage = this.Pages.FirstOrDefault(); })); }