Xamarin.Forms: how to display a Lottie animation at least one time when IsBusy is true during data loading?

后端 未结 2 1535
广开言路
广开言路 2021-01-28 07:03

On my Xamarin.Forms project, I would like to display a Lottie animation during API calls or during the loading of a we

2条回答
  •  温柔的废话
    2021-01-28 07:43

    I would like to display a Lottie animation during API calls

    public async void loadData()
    {
        //Data load started
        viewModel.IsBusy = true;
    
        await methodOfLoadingData...;
    
        //Data load finished
         viewModel.IsBusy = false;
    }
    

    during the loading of a website in a WebView:

    private void MyWebView_Navigating(object sender, WebNavigatingEventArgs e)
    {
        viewModel.IsBusy = true;
    }
    
    private void MyWebView_Navigated(object sender, WebNavigatedEventArgs e)
    {
        viewModel.IsBusy = false;
    }
    

    But the loading duration is sometimes very short

    The loading duration is depending on the time you completely loading the data/webview. If you load the data/webview very fast, the loading duration should be short.

提交回复
热议问题