How can I update screen fields content after onResume event?


#1

Hi guys.

When I get onResume event I have to access an inner method of my class

// other imports here
import * as application from "application";
import * as frame from "ui/frame";

instance: ETAComponent;

export class ETAComponent {

    constructor(private etaService: ETAService, private routerExtensions: RouterExtensions, private router: Router) {                
        this.loadInitialValues();
        this.reload();
        instance = this; /* setting the instance reference to when it resumes */
    }

    // CLASS code here

    startTimer() { /* my code here */ }
}

// after class code:
application.on(application.resumeEvent, function (args) {
    if ( frame.topmost().currentPage != null ) {
        var viewId = frame.topmost().currentPage.getViewById( "etaPage" );
        if ( viewId != null && viewId.id === "etaPage" ) {
            console.log( "You are at ETA Page" );
            instance.startTimer();
            // I NEED SOMETHING LIKE: frame.reload() or something else
        } else {
            console.log( "You are at any other place but ETA Page" );
        }
    }
});

The method startTimer() is called perfectly and it executes as well, but the interface (screen’s list) doesn’t update its values that are changed by startTimer() results.

I need something to invoke a refresh feature of it. How can I do that?

Thank you!