新しいプロジェクトを使用してチュートリアルに従った場合、次のコードが機能しました 。
ただし、実際のプロジェクトに同じコードをプラグインすると、アプリケーションのタイルを更新できません。
- パッケージを作り直しました。
- アプリをアンインストールして再デプロイしました。
- ワイドロゴ画像ファイルを更新しました。
- 新しいプロジェクトを作成するときに同じコードが機能することを確認しました。
- リンクされたチュートリアルで提案されているように、アプリのマニフェストを確認しました。
これは、あるソリューションではうまく機能しますが、他のソリューションではうまく機能しません。
public MainPage()
{
this.InitializeComponent();
ClearTileNotification();
SendTileTextNotification("Why isn't this working!");
}
void ClearTileNotification()
{
// the same TileUpdateManager can be used to clear the tile since
// tile notifications are being sent to the application's default tile
TileUpdateManager.CreateTileUpdaterForApplication().Clear();
}
void SendTileTextNotification(string text)
{
// Get a filled in version of the template by using getTemplateContent
var tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideText03);
// You will need to look at the template documentation to know how many text fields a particular template has
// get the text attributes for this template and fill them in
var tileAttributes = tileXml.GetElementsByTagName("text");
tileAttributes[0].AppendChild(tileXml.CreateTextNode(text));
// create the notification from the XML
var tileNotification = new TileNotification(tileXml);
// send the notification to the app's default tile
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
}