1

如何一次更新每个代码的正方形和宽图块?或者我如何确定在开始屏幕上“加载”了哪种瓷砖类型?

我有这个代码:

private void JamesBond()
{
        var tileXML = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Text01);
        var tileText = tileXML.GetElementsByTagName("text");
        (tileText[0] as XmlElement).InnerText = "First text";
        (tileText[1] as XmlElement).InnerText = "Second text";
        (tileText[2] as XmlElement).InnerText = "Third text";
        (tileText[3] as XmlElement).InnerText = "Last text";
        var tileNotification = new TileNotification(tileXML);

        var tileXMLw = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Text01);
        var tileTextw = tileXMLw.GetElementsByTagName("text");
        (tileTextw[0] as XmlElement).InnerText = "Wide First text";
        (tileTextw[1] as XmlElement).InnerText = "Wide Second text";
        (tileTextw[2] as XmlElement).InnerText = "Wide Third text";
        (tileTextw[3] as XmlElement).InnerText = "Wide Last text";
        var tileNotificationW = new TileNotification(tileXMLw);

        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
        TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotificationW);
    }
}

...它所做的是,它更新了宽瓷砖。但如果它是方形瓷砖,那么它会更新它......有时。大多数时候,它是空的。所以,它以某种方式起作用。但是不对....

有人能帮我一下吗?

PS:我还尝试获取 TileUpdater 实例并在同一个实例中执行所有操作……更糟糕的是,它只显示宽瓷砖……

提前致谢。

问候, ben0bi

4

1 回答 1

1

解决了。根据 MSDN,我们必须合并这两个 xml,以便它们出现在同一个“视觉”标签下。

我是这样做的:

        string xml="<tile>\n";
        xml += "<visual version=\"2\">\n";
        xml += "  <binding template=\"TileSquare150x150Text01\" fallback=\"TileSquareText01\">\n";
        xml += "      <text id=\"1\">Row 0</text>\n";
        xml += "      <text id=\"2\">Row 1</text>\n";
        xml += "      <text id=\"3\">Row 2</text>\n";
        xml += "      <text id=\"4\">Row 3</text>\n";
        xml += "  </binding>\n";
        xml += "  <binding template=\"TileWide310x150Text01\" fallback=\"TileWideText01\">\n";
        xml += "      <text id=\"1\">Wide Row 0</text>\n";
        xml += "      <text id=\"2\">Wide Row 1</text>\n";
        xml += "      <text id=\"3\">Wide Row 2</text>\n";
        xml += "      <text id=\"4\">Wide Row 3</text>\n";
        xml += "  </binding>\n";
        xml+="</visual>\n";
        xml +="</tile>";
        XmlDocument txml = new XmlDocument();
        txml.LoadXml(xml);
        TileNotification tNotification = new TileNotification(txml);

        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
        TileUpdateManager.CreateTileUpdaterForApplication().Update(tNotification);
于 2015-02-11T22:18:53.920 回答