当我执行此代码时,磁贴将为空,谁能向我解释为什么以及如何解决它?
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");
}
}
在此先感谢,马克斯。