private void btnGenerate_Click(object sender, EventArgs e) { if (!MyDialog.confirm("Do you want to generate stickers?")) { return; } progressBar.Show(); ThreadUtil.InvokeAsync(this, (f) => { generateStickers(); }); }