私のUWPプライマリタイルまたはセカンダリタイルを更新しようとすると、何も起こりません。UWPライブタイルが更新されない
Visual Studio 2017からUWPアプリケーションを起動すると、更新機能がうまく動作し、タイルが更新されます。 しかし、VS2017からWindowsストアアプリを作成すると、更新機能はそれ以上動作しません。
これは私の現在の更新機能である:
using System;
using System.Diagnostics;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
using Windows.UI.Xaml.Controls;
namespace UpdateTile
{
public sealed class TileUpdate
{
// Function which is call by every background task to update the app tile
// and each app secondary tile
// The tile ID could be empty for update the primary tile
public static void ScheduleUpdate(String data, String tileID)
{
#region variables
TileUpdater tileUpdater = null;
#endregion
// Check the tile ID
if (tileID == "")
{
// If tile ID is empty then create a tile updater for the app tile
tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
}
else
{
tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileID);
}
tileUpdater.EnableNotificationQueue(true);
tileUpdater.Clear();
tileUpdater.Update(new TileNotification(new TileXML().WriteXml(data)));
}
}
}
}
これは私が実際にタイルのためのXMLを作成する方法である:
using System;
using System.Diagnostics;
using SystemInformation;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
using Microsoft.Toolkit.Uwp.Notifications;
namespace UpdateTile
{
public sealed class TileXML
{
// Function to create a xml document for tiles
// returns a xml document
public XmlDocument WriteXml(String data)
{
#region variables
String[] result = { "" }; ;
SystemInfo sysinfo = new SystemInfo();
TileContent content = null;
String textCaption = "";
String textCaptionSubTle1 = "";
String textCaptionSubTle2 = "";
String textCaptionSubTle3 = "";
#endregion
Debug.WriteLine("Create xml document for tile");
if (String.IsNullOrEmpty(data))
{
// Set xml text for initial text file data
textCaption = "No data available";
}
else
{
// Split text file data by carriage return and new line
result = data.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
// check the result length to create an xml document text
if (result.Length == 1)
{
// Set xml text if no data file exists
textCaption = "No data available";
}
else
{
// Set xml text if data file is present
textCaption = sysinfo.Hostname;
textCaptionSubTle1 = result[3].Replace("Enterprise", "") + " v" + result[4];
textCaptionSubTle2 = "IP: " + sysinfo.IP_Address;
textCaptionSubTle3 = "Hotline: " + result[1];
}
}
// Create an adaptive tile content
content = new TileContent()
{
Visual = new TileVisual()
{
TileWide = new TileBinding()
{
Content = new TileBindingContentAdaptive()
{
BackgroundImage = new TileBackgroundImage()
{
Source = "Assets/Backgroung.png",
HintOverlay = 60
},
Children =
{
new AdaptiveText()
{
Text = textCaption,
HintStyle = AdaptiveTextStyle.Caption
},
new AdaptiveText()
{
Text = textCaptionSubTle1,
HintStyle = AdaptiveTextStyle.CaptionSubtle
},
new AdaptiveText()
{
Text = textCaptionSubTle2,
HintStyle = AdaptiveTextStyle.CaptionSubtle
},
new AdaptiveText()
{
Text = textCaptionSubTle3,
HintStyle = AdaptiveTextStyle.CaptionSubtle
}
}
}
}
}
};
// return the xml domument from adaptive tile content
return content.GetXml();
}
}
}
私もタイルを更新するために、RAW XMLを使用しようとしました、何も動作しません。なぜ誰かがタイルの更新がVS 2017で動作するのですが、Windowsストアアプリではないという考えを持っていますか?
パブリッシャー証明書がルート証明書としてインポートされました。私のシステムについて
情報: OS:Windowsの10 v1703 - >バージョン:10.0.15063.540