Ejemplo n.º 1
0
        private void ErrorListInlineLink_Click(object sender, RoutedEventArgs e)
        {
            Hyperlink hyperLink = sender as Hyperlink;

            if (hyperLink != null)
            {
                Tuple <int, int> data = hyperLink.Tag as Tuple <int, int>;
                // data.Item1 = index of SarifErrorListItem
                // data.Item2 = id of related location to link

                SarifErrorListItem sarifResult = _errors[Convert.ToInt32(data.Item1)];

                CodeFlowLocationModel location = sarifResult.RelatedLocations.Where(l => l.Id == data.Item2).FirstOrDefault();

                if (location != null)
                {
                    // Set the current sarif error in the manager so we track code locations.
                    CodeAnalysisResultManager.Instance.CurrentSarifResult = sarifResult;

                    SarifViewerPackage.SarifToolWindow.Control.DataContext = null;

                    if (sarifResult.HasDetails)
                    {
                        // Setting the DataContext to null (above) forces the TabControl to select the appropriate tab.
                        SarifViewerPackage.SarifToolWindow.Control.DataContext = sarifResult;
                    }

                    location.NavigateTo(false);
                    location.ApplyDefaultSourceFileHighlighting();
                }
            }
        }