简体   繁体   中英

async calls in LoadState blocking the UI Thread

In my Windows 8app i am overriding Page´s LoadState setting it async and use it to download and parse data in a Task i await. Afterwards i bind these data to a GridView.

Although my processing should be running async all ui is blocked during my processing on that Task.

public class Example
    {
        // ...
        protected override async void LoadState( . . . )
        {
            await Task.Run(() => downloadAndParseData());
            // Update the UI with results
        }

        private async Task downloadAndParseData()
        {
            // ...
        }
        // ...
    }

Has anyone an idea why that is and how i may be able to fix it?

I used SQLite library and didnt made use of its async methods.

Therefore all db operations ended up blocking the ui thread.

I solved my issue by using the provided async methods of SQLite

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM