2017-09-11 9 views
0

UWP 기본 및/또는 보조 타일을 업데이트하려고하면 아무 일도 일어나지 않습니다.UWP 라이브 타일이 업데이트되지 않습니다.

Visual Studio 2017에서 UWP 앱을 시작하면 업데이트 기능이 제대로 작동하고 타일이 업데이트됩니다. 그러나 VS 2017에서 Windows Store 앱을 만들면 업데이트 기능이 더 이상 작동하지 않습니다.

이 내 현재 업데이트 기능입니다 :

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을 생성하는 방법이다 : 나는 또한 타일을 업데이트 RAW 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(); 
     } 
    } 
} 

을, 그러나 아무것도 작동하지 않습니다. 누구나 타일 업데이트가 VS 2017에서 작동하지만 Windows Store 앱으로 작동하지 않는 이유는 무엇입니까?

게시자 인증서가 루트 인증서로 가져 왔습니다. 내 시스템에 대한

정보 : OS : 윈도우 10 v1703는 -> 버전 : 10.0.15063.540

답변

0

문제는 스스로 해결하고있다. 내가이 주석하고 새로운 Windows 스토어 앱을 만들 때

BackgroundImage = new TileBackgroundImage() 
{ 
    Source = "Assets/Backgroung.png", 
    HintOverlay = 60 
}, 

는, 라이브 업데이트가 다시 작동합니다

내가 라이브 타일에 대한 XML을 생성

, 난 배경 이미지를 설정합니다.

이미지의 치수가 올바르지 않을 수도 있습니다.