且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Windows Phone 7 中的启动画面加载进度动画

更新时间:2023-01-26 10:09:45

截至目前,还没有办法用动画替换显示的加载图像.虽然有解决方法:

As of right now there is no way to replace the loading image that shows up with an animation. Although there are workarounds:

  1. 一起删除图像.不过可能要小心,因为 Microsoft 要求应用程序在启动应用程序的几秒钟内向用户显示某种反馈.仅当您的应用加载速度非常快时才使用此选项.
  2. 将加载屏幕的快照显示为图像,以便在应用加载时您可以显示具有相同背景图像的动画,并且看起来与加载屏幕相同.

在您的情况下,我建议使用带有加载动画的弹出控件(选项 2).要了解如何创建弹出窗口,请转到 这里.或者,如果你想要一个有据可查的弹出窗口,我知道 Telerik 有 自己的版本 也是.

In your case I would recommend using a popup control with a loading animation inside (Option 2). To learn how to create a popup go here. Or if you want a well documented popup I know telerik has there own version as well.

接下来将加载消息放在文本块中或将您自己的图像和动画放在弹出窗口中.显然,最简单的动画是使用 Silverlight 工具包中的性能进度条.

Next place the loading message in a textblock or put your own image and animation inside of the popup. Obviously the easiest animation would be to use the Performance Progress Bar in the silverlight toolkit.

现在您要做的是设置默认打开的弹出窗口.每当您的处理完成时,您所要做的就是将弹出窗口可见性设置为隐藏在您的 C# 代码中.

Now what you'll want to do is set the popup opened by default. Whenever your processing is done all you have to do is set the popup visibility to hidden in your C# code.

可以在此处找到有关如何实现的一些示例:

Some examples of how this is implemented can be found here:

这是一个 XNA 游戏的例子:

And here's an example for an XNA game: