Loading data and splash screen time

BitSmithy 2,141 Reputation points
2024-09-18T08:01:19.84+00:00

Hello,

I am loading data to the app using such code now:

private async void Page_Loaded(object sender, RoutedEventArgs e)         
{ 
	await CreateDataBaseIfNotExists(); //creates database if it doesn't already exists.
	await LoadData(); //loads data to DataGrid
}

But this method causes that Splash Screen is showed to long.

I would like to load data after the app is loaded or (better) start loading during splash screen time and finish it after splash screen is hidden.

Is that possible in uwp?

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,006 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 18,476 Reputation points Microsoft Vendor
    2024-09-27T08:08:09.12+00:00

    Hi @BitSmithy ,

    Let me summarize this question.

    I would like to load data after the app is loaded or (better) start loading during splash screen time and finish it after splash screen is hidden. Is that possible in uwp?

    You can try to use data binding to do this, read only the first 200 rows at the beginning, and then read the rest in the loaded event. You can use OFFSET FETCH in SQL to query.

    No need to delete events or update data, data binding will do it for you.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.