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); }
private void btnGo_Click(object sender, EventArgs e) { if (!_blogSelected) { MessageBox.Show("First connect to blog from File>Connect!"); return; } if (lvItems.SelectedItems.Count == 0) { MessageBox.Show("Select items to transfer!"); return; } var programOptionsFactory = new ProgramOptionsFactory(); _options = programOptionsFactory.Get(); _stopWatch = new Stopwatch(); _stopWatch.Start(); EnDisItems(false); lblDateTime.Text = "Started at " + DateTime.Now.ToLongTimeString(); 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(); _blogCache.Start(_options.BlogUrl); Application.DoEvents(); } SetStatus("Ready"); ResetBarStatus(true); barStatus.Maximum = lvItems.SelectedItems.Count; _postFactory = new PostFactory( SiteConfig, new Ftp(FtpConfiguration), _blogCache, dal, _options); var items = ItemsFromListView(lvItems.SelectedItems); _postFactory.PostCreated += PostCreated; _postFactory.PostBeingCreated += PostBeingCreated; _postFactory.PostsCreated += PostsCreated; _postFactory.PostCreationStopped += PostCreationStopped; _postFactory.Create(items); } }