当我执行此代码时,磁贴将为空,任何人都可以向我解释为什么以及如何解决它?
private void CreateCycleTileWide()
{
if (!Mangopollo.Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 7.8");
return;
}
try
{
此代码从reddit获取json提要,submission.data.thumbnail看起来像“http://someaddress.com/something.png”。
Submission orig;
for (int cur = 0; cur < App.ViewModel.PicsSubmissionList.Count; cur++)
{
orig = App.ViewModel.PicsSubmissionList[cur];
Submission submission = orig;
Dispatcher.BeginInvoke(() =>
{
if (!string.IsNullOrEmpty(submission.data.thumbnail))
{
try
{
list.Add(new Uri(submission.data.thumbnail));
}
catch { MessageBox.Show("Can't generate list"); }
}
});
}
此代码根据上一个URI列表创建磁贴。
try
{
var mytile = new CycleTileData
{
Title = "Reddit /r/Pics",
Count = 0,
SmallBackgroundImage = new Uri("/images/RedditLogo.png", UriKind.Relative),
CycleImages = list
};
ShellTileExt.Create(new Uri("/MainPage.xaml?msg=fromwidetile", UriKind.Relative), mytile, true);
}
catch { MessageBox.Show("cantcreatetile"); }
}
catch
{
MessageBox.Show("remove tile before creating it again");
}
}
提前致谢,Max。