【WP8.1】系统控件的bug及修复方案

发表于:2015-4-07 11:04

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:h82258652    来源:51Testing软件测试网采编

  后台cs:
1 using System.Diagnostics;
2 using Windows.Phone.UI.Input;
3 using Windows.UI.Xaml;
4 using Windows.UI.Xaml.Controls;
5 using Windows.UI.Xaml.Navigation;
6
7 // “空白页”项模板在 http://go.microsoft.com/fwlink/?LinkID=390556 上有介绍
8
9 namespace BugDemo
10 {
11     /// <summary>
12     /// 可用于自身或导航至 Frame 内部的空白页。
13     /// </summary>
14     public sealed partial class ImageBugPage : Page
15     {
16         private string[] _testUrl = new string[]{
17             "http://www.bing.com/az/hprichbg/rb/DragonFlyBeijing_ZH-CN8555054089_150x150.jpg",
18             "http://www.bing.com/az/hprichbg/rb/MidAutumnFestivalHongKong_ZH-CN9020398465_150x150.jpg",
19             "http://www.bing.com/az/hprichbg/rb/MusulmokBeach_ZH-CN12849119858_150x150.jpg",
20             "http://www.bing.com/az/hprichbg/rb/BetulaVerrucosa_ZH-CN9596215235_150x150.jpg",
21             "http://www.bing.com/az/hprichbg/rb/HoluhraunVolcano_ZH-CN10866460287_150x150.jpg",
22             "http://www.bing.com/az/hprichbg/rb/SouthernElephantSeal_ZH-CN11868940461_150x150.jpg",
23             "http://www.bing.com/az/hprichbg/rb/YokoteKamakura_ZH-CN11459129782_150x150.jpg",
24             "http://www.bing.com/az/hprichbg/rb/SpottedLakeCanada_ZH-CN12374082037_150x150.jpg",
25             "http://www.bing.com/az/hprichbg/rb/StKildaBay_ZH-CN12275183653_150x150.jpg",
26             "http://www.bing.com/az/hprichbg/rb/SellinPier_ZH-CN9832633239_150x150.jpg",
27             "http://www.bing.com/az/hprichbg/rb/RNPFogVideo_ZH-CN8941485556_150x150.jpg",
28             "http://www.bing.com/az/hprichbg/rb/PaperFansRedLanterns_ZH-CN9355904288_150x150.jpg",
29             "http://www.bing.com/az/hprichbg/rb/NinthEmperorGodTemple_ZH-CN13109315006_150x150.jpg",
30             "http://www.bing.com/az/hprichbg/rb/ChineseDecorationTiger_ZH-CN13118003712_150x150.jpg",
31             "http://www.bing.com/az/hprichbg/rb/NewYearPinwheels_ZH-CN12259065748_150x150.jpg",
32             "http://www.bing.com/az/hprichbg/rb/NewYearOrnaments_ZH-CN10726465661_150x150.jpg",
33             "http://www.bing.com/az/hprichbg/rb/DadaochengFireworks_ZH-CN10749562397_150x150.jpg",
34             "http://www.bing.com/az/hprichbg/rb/SummerVacation_ZH-CN10164213926_150x150.jpg",
35             "http://www.bing.com/az/hprichbg/rb/InsideRhoneGlacier_ZH-CN10709433723_150x150.jpg",
36             "http://www.bing.com/az/hprichbg/rb/BodleianLibrary_ZH-CN13371852606_150x150.jpg",
37             "http://www.bing.com/az/hprichbg/rb/HeartNebula_ZH-CN7750020667_150x150.jpg",
38             "http://www.bing.com/az/hprichbg/rb/HotAndCold_ZH-CN8140560654_150x150.jpg"
39         };
40
41         public ImageBugPage()
42         {
43             this.InitializeComponent();
44         }
45
46         /// <summary>
47         /// 在此页将要在 Frame 中显示时进行调用。
48         /// </summary>
49         /// <param name="e">描述如何访问此页的事件数据。
50         /// 此参数通常用于配置页。</param>
51         protected override void OnNavigatedTo(NavigationEventArgs e)
52         {
53             HardwareButtons.BackPressed += HardwareButtons_BackPressed;
54         }
55
56         protected override void OnNavigatedFrom(NavigationEventArgs e)
57         {
58             HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
59         }
60
61         private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
62         {
63             if (Frame.CanGoBack)
64             {
65                 e.Handled = true;
66                 Frame.GoBack();
67             }
68         }
69
70         private void BtnLoad_Click(object sender, RoutedEventArgs e)
71         {
72             lvwImage.ItemsSource = _testUrl;
73         }
74
75         private void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e)
76         {
77             Debug.WriteLine(e.ErrorMessage);
78         }
79     }
80 }
  测试效果:
  出现了其中一幅无法加载的情况
  而我们的调试窗口也显示出了无法加载的信息。
  解决方案:捕获到加载失败时,重新设定Image控件的Source属性。
  修改上面的后台代码中的ImageFailed方法:
44/4<1234
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号