Strange page navigation behavior in wp 8.1

I am making a Wp 8.1 application.

I have this "reader" page. His constructor is

    public Reader()
    {
        this.InitializeComponent();
        this.NavigationCacheMode = NavigationCacheMode.Enabled;
        initalizeTimers();
        initAd();
    }

and onNvaigatedTo

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        HardwareButtons.BackPressed += Hardware_backPressedLocal;
        var x = (Tuple<int, string, Global.FileType>)e.Parameter;

        //load settings here
        loadColorSchemes();
        setStatusBarColor();

        if (e.NavigationMode == NavigationMode.Back)
        {
            readerVm.refreshWebView();
            return;
        }

        if (x != null)
        {
            initalizeReader(x);
        }
    }

initalizeReader()is an asynchronous method. The page has a grid in front to display the pending msg, and the initializeReader method hides this grid.

Problem:

When you click a button that calls a method Frame.Navigate()on the reader page, sometimes the reader page is loaded with a wait grid, which hides after some (expected), and at other times, the user interface freezes, and then the reader page loads with the wait grid already hidden. And 70-80% of the time, the user interface freezes.

Can you tell what is going wrong here? And how to fix it?

+4
1

initalizeReader(x);, Loaded . , , .

0

All Articles