private void ButtonRemoveSeason_Click(object sender, RoutedEventArgs e) { SeasonDataModel item = (sender as Button).DataContext as SeasonDataModel; if (item != null) { ConfirmationWindow _popupConfirm = new ConfirmationWindow("Tens a certeza que pretendes remover a " + item.SeasonName + "?"); if (_popupConfirm.ShowDialog() == true) { new Thread(() => { UtilsNotification.StartLoadingAnimation(); if (seasonService.CanDeleteById(item.SeasonId)) { if (seasonService.RemoveSeason(item.SeasonId)) { NotificationHelper.notifier.ShowCustomMessage("Época removida com sucesso!"); LoadSeasonsGrid(); } else { NotificationHelper.notifier.ShowCustomMessage("Erro ao remover época!"); } } else { NotificationHelper.notifier.ShowCustomMessage("Não é possivel eliminar esta época!\nContacte o Admin do sistema..."); } UtilsNotification.StopLoadingAnimation(); }).Start(); } } }