Move call funcntion ProcessEvents( EventManager) to main.