using System; using System.Reflection; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using C4IT.FASD.Base; using FasdDesktopUi.Basics.Services.SupportCase.Controllers; using FasdDesktopUi.Pages.DetailsPage; using static C4IT.Logging.cLogManager; namespace FasdDesktopUi.Basics.UiActions { public class cChangeHealthCardAction : cUiActionBase { private readonly SupportCaseController _supportCaseController; public cF4sdApiSearchResultRelation ResultRelation { get; private set; } = null; public cChangeHealthCardAction(cF4sdApiSearchResultRelation resultRelation, SupportCaseController supportCaseController) { ResultRelation = resultRelation; _supportCaseController = supportCaseController; } public override async Task RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider) { var CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); try { if (dataProvider == null) return false; if (ResultRelation == null) return false; if (!(UiLocation is DetailsPageView detailsPage)) return false; Mouse.OverrideCursor = Cursors.Wait; detailsPage.NavigationHeadingUc.ResetSelectors(); await dataProvider.ExchangeCaseIdentitiesAsync(ResultRelation); _supportCaseController.UpdateFocusedCaseRelation(ResultRelation); detailsPage.UpdateHealthcardSectionVisibilities(); return true; } catch (Exception E) { LogException(E); } finally { Mouse.OverrideCursor = null; LogMethodEnd(CM); } return false; } } }