private void RecheckUrls(object wordHyperlinks)
        {
            try // This method can still be running after the window closed
            {
                lock (lockObject)
                {
                    StopAllBackgroundThreads();

                    bool wordHyperlinks_bool = (bool)wordHyperlinks;
                    if (wordHyperlinks_bool)
                    {
                        hyperlink_urls     = WordUrlManager.GetListOfHyperlinkUrls(wordDoc);
                        hyperlink_requests = new HttpWebRequest[hyperlink_urls.Length];
                        active_urls        = hyperlink_urls;
                        active_requests    = hyperlink_requests;
                    }
                    else
                    {
                        autofind_urls     = WordUrlManager.GetListOfAllUrls(wordDoc);
                        autofind_requests = new HttpWebRequest[autofind_urls.Length];
                        active_urls       = autofind_urls;
                        active_requests   = autofind_requests;
                    }

                    Invoke(new ClearListViewDelegate(InitializeUrlViewList));

                    urlTesterThread = new Thread(VerifyURLs);
                    urlTesterThread.Start();

                    Invoke(new ReEnableControlsDelegate(ReEnableControls));
                }
            } catch (Exception e) { }
        }
        private void FindUrlInDocument(object sender, EventArgs e)
        {
            int    index = listView.SelectedItems[0].Index;
            string url   = active_urls[index];

            WordUrlManager.FindInDocument(wordDoc, url);
        }
        public UrlListForm(Word.Document doc)
        {
            InitializeComponent();

            if (doc == null)
            {
                return;
            }
            wordDoc = doc;

            hyperlink_urls     = WordUrlManager.GetListOfHyperlinkUrls(doc);
            hyperlink_requests = new HttpWebRequest[hyperlink_urls.Length];
            autofind_urls      = WordUrlManager.GetListOfAllUrls(doc);
            autofind_requests  = new HttpWebRequest[autofind_urls.Length];
            active_urls        = hyperlink_urls;
            active_requests    = hyperlink_requests;

            InitializeUrlViewList();

            progressBar.Visible = true;
            if (active_urls.Length == 0)
            {
                progressBar.Visible = false;
            }
            progressBar.Minimum = 0;
            progressBar.Maximum = active_urls.Length;
            progressBar.Step    = 1;
            progressBar.Value   = 0;

            button_RecheckEveryURL.Enabled     = false;
            radioButton_autofindUrls.Enabled   = false;
            radioButton_wordHyperlinks.Enabled = false;
            listView.BeginUpdate();

            urlTesterThread            = null;
            RestartTestingThread       = null;
            urlTesterThread_shouldStop = false;
        }
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     urlManager = new WordUrlManager(Globals.ThisAddIn.Application);
 }