private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            RoyalGazetteList list = new RoyalGazetteList();
            SearchData       data = e.Argument as SearchData;

            if (data != null)
            {
                var      searcher = new RoyalGazetteOnlineSearch();
                DateTime dateStart;
                DateTime dateEnd;
                dateStart = new DateTime(Math.Max(1800, data.StartYear), 1, 1);
                dateEnd   = new DateTime(Math.Max(1800, data.EndYear), 1, 1);

                if (!String.IsNullOrEmpty(data.SearchString))
                {
                    list.AddRange(searcher.SearchString(dateStart, dateEnd, data.SearchString));
                    // Thread.Sleep(1000);  // seems the Gazette website blocks when to many requests are received
                }

                if (data.EntityTypes.Any() && data.EntityModifications.Any())
                {
                    list.AddRange(searcher.SearchNewsRangeAdministrative(dateStart, dateEnd, data.EntityTypes, data.EntityModifications));
                    // Thread.Sleep(1000);  // seems the Gazette website blocks when to many requests are received
                }
            }
            e.Result = list;
        }
Exemple #2
0
        private void btn_GazetteSearchYear_Click(Object sender, EventArgs e)
        {
            RoyalGazetteOnlineSearch searcher = new RoyalGazetteOnlineSearch();
            var gazetteList = searcher.SearchNews(new DateTime((Int32)edtYear.Value, 1, 1));

            GazetteNewsReady(gazetteList);
        }
Exemple #3
0
        private void btn_CheckForNews_Click(Object sender, EventArgs e)
        {
            RoyalGazetteOnlineSearch searcher = new RoyalGazetteOnlineSearch();

            searcher.ProcessingFinished += GazetteNewsReady;
            Thread t = new Thread(searcher.SearchNewsNow);

            t.Name = "Worker Thread Gazette News";
            t.Start();
        }
Exemple #4
0
 private void btn_GazetteSearchYear_Click(Object sender, EventArgs e)
 {
     RoyalGazetteOnlineSearch searcher = new RoyalGazetteOnlineSearch();
     var gazetteList = searcher.SearchNews(new DateTime((Int32)edtYear.Value, 1, 1));
     GazetteNewsReady(gazetteList);
 }
Exemple #5
0
 private void btn_CheckForNews_Click(Object sender, EventArgs e)
 {
     RoyalGazetteOnlineSearch searcher = new RoyalGazetteOnlineSearch();
     searcher.ProcessingFinished += GazetteNewsReady;
     Thread t = new Thread(searcher.SearchNewsNow);
     t.Name = "Worker Thread Gazette News";
     t.Start();
 }