0
我正在寫一個Windows 8應用程序,並試圖讓活動的瓷磚正常工作。這裏是我到目前爲止(所有App.xaml.cs
):Windows 8 Live Tile更新無法正常工作
在OnLaunched()
:
Window.Current.VisibilityChanged += Current_VisibilityChanged;
對於該事件處理程序:
void Current_VisibilityChanged(object sender, Windows.UI.Core.VisibilityChangedEventArgs e)
{
// create a string with the tile template xml
string tileXmlString = "<tile><visual><binding template=\"TileSquareBlock\">" + App.VM.GetImageLinks() + "</binding></visual></tile>";
// create a DOM
Windows.Data.Xml.Dom.XmlDocument tileDOM = new Windows.Data.Xml.Dom.XmlDocument();
// load the xml string into the DOM, catching any invalid xml characters
tileDOM.LoadXml(tileXmlString);
// create a tile notification
TileNotification tile = new TileNotification(tileDOM);
// send the notification to the app's application tile
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
}
App.VM.GetImageLinks()
回報:
<tile>
<visual>
<binding template=\"TileSquareBlock\">
<image id=\"1\">Assets/Img1.jpg</image>
<image id=\"2\">Assets/Img2.jpg</image>
<image id=\"3\">Assets/Img3.jpg</image>
</binding>
</visual>
</tile>
在一分鐘,我基本上只是試圖讓這些圖像sh在開始屏幕上。我的猜測是VisibilityChanged
是錯誤的事件,因爲它似乎太頻繁發生。
是的我想他想要tileSquareImage –