////////////////////////////////////////////////////////////////////////////
// System Pre-define Functions
// 95099372-ef3e-11ea-9c81-bf848405c62e

function OnInitializeData()
{
        INIT_PUI();
    
        PUI(()=>{
                //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
	        //The 'pui' variable is valid in all functions of this document.
	        //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
                
        });
}

function OnCloseForm()
{
}

function OnException(err)
{
        //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
}

//////////////////////////////////////////////////////////////////////////
// Callback Functions.
// 641a254c-ef3e-11ea-bc8a-379bb908bdd7


//////////////////////////////////////////////////////////////////////////
// Utils Functions.
// 6c165ad6-ef3e-11ea-987c-b761a131c2fe

var pui = false;

function PUI(cb)
{
        if(pui)cb();
}

function INIT_PUI()
{
        // if this form's parent form isn't mainfrm, please use parent form replace 'mainfrm'.
        if(unit.form.mainfrm.innerWindow)
        {
                pui = unit.form.mainfrm.ui;    
        }
}

/*Usage of BLOCK_EVENT
        BLOCK_EVENT(()=>{
                ui.[name].[var] = ...;
        });
*/

function BLOCK_EVENT(cb)
{
        ui.block_event = true;
        
        cb();
        
        ui.block_event = false;
}
