private async void button1_Click(object sender, EventArgs e) { var notifier = new Notifier(); try { var result = await new MyThreadHelper <int>().Execute(MyLongRunningFunction); notifier.ShowSuccess("Task completed", $"Result was: {result.ToString()}"); } catch (Exception ex) { notifier.ShowError("Task had error", ex.Message); } }