Count of open screens in Platform V7.x

Hi
What is the proper code for getting number of open screen in platform version 7.x where the following codes used to work in the legacy version?

@Override
    public void ready() {
        super.ready();
        WindowManager windowManager = this.getWindowManager();
        windowManager.getOpenWindows();
        if(windowManager.getOpenWindows().size()>1){
            showMessageDialog("WARNING","Please Close All Windows Before Changing Company", MessageType.WARNING_HTML);
            close(CLOSE_ACTION_ID);
        }
    }

Hello @mortozakhan

You should use OpenedScreens helper that can be obtained from Screens component:

@Inject
private Screens screens;

private void foo() {
    // returns amount of all opened screens excluding the root screen
    screens.getOpenedScreens().getAll().size();

    // returns amount of all opened screens excluding the root screen and dialogs
    screens.getOpenedScreens().getWorkAreaScreens().size();
}

Regards,
Daniil

Awesome, thank you Daniil.