【问题标题】:Updating live tile in Windows Phone 8.1 Offline在 Windows Phone 8.1 Offline 中更新动态磁贴
【发布时间】:2015-01-10 02:29:47
【问题描述】:

我已经成功地使用以下代码为我的应用创建了一个动态磁贴:

        var tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText01);

        var tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;
        tileImage.SetAttribute("src", "ms-appx:///Assets/Icon.png");

        var tileText = tileXml.GetElementsByTagName("text");
        (tileText[0] as XmlElement).InnerText = ""+DateTime.Now.ToString();
        (tileText[1] as XmlElement).InnerText = "1";
        (tileText[2] as XmlElement).InnerText = "2";
        (tileText[3] as XmlElement).InnerText = "3";

        var tileNotification = new TileNotification(tileXml);
        TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);

但是我不确定如何使用调度程序代理自动更新实时磁贴。我已经研究过使用 TileUpdateManager.StartPeriodicAgent,但是它需要一个 URI 参数,我想避免创建一个服务器只是为了更新我的动态磁贴。

有什么办法可以做到这一点吗? 非常感谢:D

【问题讨论】:

    标签: c# windows visual-studio windows-phone-8.1 live-tile


    【解决方案1】:

    您需要从您的应用运行后台代理,并将您的动态磁贴更新代码放在那里。

    MSDN 上的主题:

    Quickstart: Update a live tile from a background task

    Windows Phone 8.1 上的后台代理/多任务处理:

    http://www.jayway.com/2014/04/23/windows-phone-8-1-for-developers-multitasking-and-background-tasks/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-20
      相关资源
      最近更新 更多