private void GettingSourceItemsFinished(object sender, EventArgs e) { ResetBarStatus(); EnDis(true); btnGo.Enabled = lvItems.Items.Count > 0; Cursor.Current = Cursors.Default; SetStatus("Getting source items finished"); var programOptionsFactory = new ProgramOptionsFactory(); _options = programOptionsFactory.Get(); if (_options.ShowMessageBoxes) { MessageBox.Show("Getting source items finished"); } _stopWatch.Stop(); var timeTook = _stopWatch.Elapsed.TotalMinutes.ToString("0.00"); lblDateTime.Text = string.Format("Took {0} mins", timeTook); _sourceItemFactory.NoSourceFound -= NoSourceFound; _sourceItemFactory.GettingSourceItemsStopped -= GettingSourceItemsStopped; _sourceItemFactory.ProcessFinished -= GettingSourceItemsFinished; _sourceItemFactory.SourceItemGot -= SourceItemGot; _sourceItemFactory.TotalResultsFound -= TotalResultsFound; _sourceItemFactory.SourceItemsGot -= SourceItemsGot; _sourceItemFactory = null; }
private void btnStart_Click(object sender, EventArgs e) { if (txtUrl.Text == "") { MessageBox.Show("Enter Keyword!"); return; } var sitesCount = chkSites.CheckedItems.Count; if (sitesCount == 0) { MessageBox.Show("Select sites!"); return; } EnDis(false); numPage_ValueChanged(null, null); Cursor.Current = Cursors.WaitCursor; ResetBarStatus(true); btnGo.Enabled = false; lblTotalResults.Text = ""; var pageStart = (int)numPage.Value; var pageEnd = chkAllPages.Checked ? (int)numPageTo.Maximum : (int)numPageTo.Value; ///barStatus.Maximum = pageEnd - pageStart; barStatus.Maximum = 0; lblDateTime.Text = ""; _stopWatch = new Stopwatch(); _stopWatch.Start(); var programOptionsFactory = new ProgramOptionsFactory(); _options = programOptionsFactory.Get(); HashSet<string> existingIds = null; if (_options.SkipSearchingPosted) { using (var dal = new Dal(MySqlConnectionString)) { _blogCache = new BlogCache(dal); if (_options.UseCache) { SetStatus("Loading present posts and tags in the blog(this may take some time)..."); Application.DoEvents(); existingIds = _blogCache.IdsPresent(_options.BlogUrl); Application.DoEvents(); } } } _sourceItemFactory = new SourceItemFactory(); _sourceItemFactory.NoSourceFound += NoSourceFound; _sourceItemFactory.GettingSourceItemsStopped += GettingSourceItemsStopped; _sourceItemFactory.ProcessFinished += GettingSourceItemsFinished; _sourceItemFactory.SourceItemGot += SourceItemGot; _sourceItemFactory.TotalResultsFound += TotalResultsFound; _sourceItemFactory.SourceItemsGot += SourceItemsGot; _sourceItemFactory.ExceptionOccured += ExceptionOccuredWhileGettingItems; var checkedSites = (from object checkedItem in chkSites.CheckedItems select checkedItem.ToString()).ToList(); _sourceItemFactory.GetSourceItems(checkedSites, txtUrl.Text, pageStart, pageEnd, lvItems.Items.Count + 1, existingIds); }