Uniconta Refresh grid in master page

Date: 2022-01-12
//namespace: Uniconta.ClientTools.Page.BasePage

// override 'Utility_Refresh' in listview (page)
public override void Utility_Refresh(string screenName, object argument = null)
{
    if (screenName != nameof(GiftProjectDetailPage)) return;
    ReloadData(); // refresh
}

// call for refresh in detailview:
globalEvents.OnRefresh(NameOfControl, Editrow);



// Reference to HomePage
System.Windows.Application.Current.MainWindow as UnicontaClient.HomePage

// Reference to global session
Uniconta.API.Service.Session.GlobalSession


// Reference to MainPage
if (Application.Current.MainWindow.Content is UnicontaClient.MainPage mainPage)
{
    var dockCtrl = mainPage.dockCtrl;
    dockCtrl.globalEvents.Refresh += GlobalEvents_Refresh;
    CloseActions.Add(() => dockCtrl.globalEvents.Refresh -= GlobalEvents_Refresh);
}

private void GlobalEvents_Refresh(string screenName, object argument = null)
{
    // Console.WriteLine($"screenName: {screenName}: {argument}");
    if (StringHelper.Equals(screenName, "ContactPage2"))
    {
        UpdateContactPersons(Editrow.Debtor);
    }
}


public override void PageClosing()
{
    if (CloseActions != null)
    {
        foreach (var action in CloseActions)
            action();
    }

    base.PageClosing();
}




59240cookie-checkUniconta Refresh grid in master page