You can do something like this (test with an Image and waiting 5 seconds to simulate a long task) :
async System.Threading.Tasks.Task MyTask()
{
await Task.Run(async () =>
{
await System.Threading.Tasks.Task.Delay(5000);
this.Dispatcher.Invoke(() =>
{
image1.Visibility = Visibility.Collapsed;
});
MessageBox.Show("Finished", "Information", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.Yes);
});
}
private async void LaunchTask()
{
image1.Visibility = Visibility.Visible;
await MyTask();
}