0

当我执行此代码时,磁贴将为空,谁能向我解释为什么以及如何解决它?

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");
        }
    }

在此先感谢,马克斯。

4

1 回答 1

1

所有类型的图块仅支持本地图像。不支持远程图像(不在设备上)。您应该首先将远程图像保存到隔离存储中。

于 2013-01-29T18:58:16.123 回答