/// <summary> /// Constructor /// </summary> /// <param name="sr"></param> public ScanListViewItemViewModel(A11yElement e, RuleResult sr) { this.RR = sr ?? throw new ArgumentNullException(nameof(sr)); this.Element = e; this.Header = sr.Description; this.Status = sr.Status; this.HelpUrl = sr.HelpUrl; this.HelpLinkVisibility = this.HelpUrl != null ? Visibility.Visible : Visibility.Collapsed; if (this.Status != ScanStatus.Pass && sr.MetaInfo.PropertyId != 0 && StandardLinksHelper.GetDefaultInstance().HasStoredLink(sr.MetaInfo)) { this.SnippetLink = StandardLinksHelper.GetDefaultInstance().GetSnippetQueryUrl(sr.MetaInfo); } else { this.SnippetLink = null; } this.AutomationHelpText = GetAutomationHelpText(); StringBuilder sb = new StringBuilder(); foreach (var message in sr.Messages) { sb.AppendLine(message); } this.HowToFixText = sb.ToString(); this.Source = sr.Source; }
/// <summary> /// Constructor /// </summary> /// <param name="e">A11yElement</param> /// <param name="rr">Scan result</param> public RuleResultViewModel(A11yElement e, RuleResult rr) { if (rr == null) { throw new ArgumentNullException(nameof(rr)); } this.Element = e ?? throw new ArgumentNullException(nameof(e)); var p = e.Properties.ById(rr.MetaInfo.PropertyId); if (p != null) { this.Properties = String.Format(CultureInfo.InvariantCulture, "{0}={1}", p.Name, p.TextValue); } if (StandardLinksHelper.GetDefaultInstance().HasStoredLink(rr.MetaInfo)) { this.SnippetLink = StandardLinksHelper.GetDefaultInstance().GetSnippetQueryUrl(rr.MetaInfo); } this.LoadingVisibility = System.Windows.Visibility.Collapsed; this.Description = rr.Description; this.URL = rr.HelpUrl.Url; this.Source = rr.Source; this.LoadingVisibility = System.Windows.Visibility.Collapsed; this.RuleResult = rr; // show website icon for NotSupported case this.GlyphName = rr.Status == ScanStatus.ScanNotSupported ? FabricIcon.MapDirections : FabricIcon.AlertSolid; }
private static string GetHyperlinkTarget(ScanStatus status, RuleResult rr) { if (status != ScanStatus.Pass && rr.MetaInfo.PropertyId != 0 && StandardLinksHelper.GetDefaultInstance().HasStoredLink(rr.MetaInfo)) { return(StandardLinksHelper.GetDefaultInstance().GetSnippetQueryUrl(rr.MetaInfo)); } return(rr.FrameworkIssueLink); }