进度条直到加载内容 [英] Progress bar until content is loaded

查看:88
本文介绍了进度条直到加载内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在使用Vb.Net开发Windows Phone 8.0应用程序。


我创建了一个加载页面作为控件我称之为弹出宽度函数ShowSplash()


这是我的代码:


 


Private Sub ShowSplash()



        popup.Child =新的LoadingPage

        popup.IsOpen = True



        Dim bw As New BackgroundWorker



        AddHandler bw.DoWork,AddressOf backroungWorker_DoWork

        AddHandler bw.RunWorkerCompleted,AddressOf backroungWorker_RunWorkerCompleted

        bw.RunWorkerAsync()



   结束分


    Private Sub backroungWorker_DoWork(发件人为对象,e为DoWorkEventArgs)

        Thread.Sleep(9000)

   结束分


    Private Sub backroungWorker_RunWorkerCompleted(sender As Object,e As RunWorkerCompletedEventArgs)

        Me.Dispatcher.BeginInvoke(功能()

                &NBSP ;   popup.IsOpen =假

                  结束功能)

   结束Sub


问题是:现在我使用了9秒的thread.Sleep但是我想显示加载页面,直到加载页面内容(加载时间可以每页都不同)。我该怎么办 ?!


感谢所有


卢卡(意大利)

解决方案

您好卢卡,可能是
我的文章
对你有帮助......


也许你可以使用Tasks而不是BackgroundWorker。


问候。


Hi all,

I'm developing a Windows Phone 8.0 App with Vb.Net.

I've created a loading page as control which I call as popup width the functions ShowSplash()

Here's my code:

 

Private Sub ShowSplash()

        popup.Child = New LoadingPage
        popup.IsOpen = True

        Dim bw As New BackgroundWorker

        AddHandler bw.DoWork, AddressOf backroungWorker_DoWork
        AddHandler bw.RunWorkerCompleted, AddressOf backroungWorker_RunWorkerCompleted
        bw.RunWorkerAsync()

    End Sub

    Private Sub backroungWorker_DoWork(sender As Object, e As DoWorkEventArgs)
        Thread.Sleep(9000)
    End Sub

    Private Sub backroungWorker_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
        Me.Dispatcher.BeginInvoke(Function()
                                      popup.IsOpen = False
                                  End Function)
    End Sub

Question is: now I use thread.Sleep of 9 seconds but I want to show the loading page until page content is loaded (the loading time can be different for each page). What can I do? 

Thanks all!

Luca (from Italy)

解决方案

Hi Luca, May be my article helps to you...

May be you can use Tasks instead of BackgroundWorker, too.

Regards.


这篇关于进度条直到加载内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆