private void ResultsDataView_LoadingRow(object sender, System.Windows.Controls.DataGridRowEventArgs e)
        {
            DataGrid    theGrid = sender as DataGrid;
            DataGridRow gridRow = e.Row;
            ResultEntry result  = gridRow.DataContext as ResultEntry;

            if (result == null)
            {
                return;
            }
            if (result.Status != HttpStatusCode.OK)
            {
                gridRow.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                gridRow.Foreground = new SolidColorBrush(Colors.Black);
            }
        }
        private async Task <ResultEntry> CheckSitemapUrlAsync(string theUrl)
        {
            return(await Task.Run <ResultEntry>(() =>
            {
                ResultEntry result = new ResultEntry();
                HttpStatusCode resultCode = HttpStatusCode.OK;
                RemoteCertificateValidationCallback orgCallback = ServicePointManager.ServerCertificateValidationCallback;
                ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                try
                {
                    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(theUrl);
                    req.Accept = "text/html";
                    HttpWebResponse response = (HttpWebResponse)req.GetResponse();

                    if (CanCheckInternalLinks(theUrl))
                    {
                        var encoding = ASCIIEncoding.ASCII;
                        using (var reader = new System.IO.StreamReader(response.GetResponseStream(), encoding))
                        {
                            result.Html = reader.ReadToEnd();
                        }
                    }
                    response.Close();
                }
                catch (Exception ex)
                {
                    resultCode = GetHttpStatusCode(ex);
                }
                ServicePointManager.ServerCertificateValidationCallback = orgCallback;
                result.Url = theUrl;
                result.Status = resultCode;
                return result;
            }));
        }