private async void Button1_ClickAsync(object sender, EventArgs e) { crawlButton.Enabled = false; if (isCrawling == false) { isCrawling = true; if (siteAddress.Text.Length > 0) { EnsureThatProtocolIsProvided(siteAddress.Text); await PageExists(siteAddress.Text); if (pageExists) { await PageHasCertificate(siteAddress.Text); siteToCrawlMsg.Text = pageHasCerificate ? "Istnieje i ma certyfikat" : "Istnieje i nie ma certyfikatu"; crawler = new Base.Crawler(this, siteAddress.Text); crawler.StartCrawl(); crawlButton.Text = "Stop"; } } else { CustomMessages.DisplayWrongUrlMsg(); isCrawling = false; } } else { this.isCrawling = false; if (crawler != null) { this.crawlButton.Text = "Zatrzymywanie"; siteToCrawlMsg.Text = "Zatrzymywanie crawlowania"; crawler.AbortCrawl(); } this.crawlButton.Text = "Start"; } crawlButton.Enabled = true; }