private async void _button_Click(object sender, EventArgs e) { if (_isDownloading) { _model.CancelLoad(); } else { _images = 0; this._statusLabel.Text = "Képek száma: " + _images; this._progressBar.Value = 0; this._progressBar.Visible = true; this._button.Text = "Letöltés megszakítása"; _isDownloading = true; this._layoutPanel.Controls.Clear(); try { _model = new WebPage(new Uri(_textBox.Text)); _model.ImageLoaded += new EventHandler <WebImage>(Model_ImageLoaded); _model.LoadProgress += new EventHandler <int>(Model_LoadProgress); await _model.LoadImagesAsync(); } catch { } this._progressBar.Visible = false; this._button.Text = "Letöltés"; _isDownloading = false; } }