private Action <Task> GenerateNotification() { return((x) => { var state = WebClientService.GetState(); switch (state) { case EnumState.Finished: MessageBox.Show("All files are downloaded", "Notification", MessageBoxButton.OK, MessageBoxImage.Information); break; case EnumState.Stop: MessageBox.Show("The process has been stopped", "Notification", MessageBoxButton.OK, MessageBoxImage.Information); Reset(); break; } }); }