在我删除后台代理后,将活动tile自动恢复为静态tile



我的应用程序的主磁贴具有活动磁贴功能。然而,如果我关闭活动磁贴功能,当我返回到开始屏幕时,我的应用程序的主磁贴仍然显示活动磁贴的最后状态。

我想知道我需要做些什么,以便恢复我的应用程序的主瓷砖到它的静态状态,只要我把动态瓷砖功能关闭?现在,我需要调整贴图的大小或删除/重新插入它来获得这个效果。

这是当我关闭活动磁贴时运行的代码:

                // Remove the Background Agent for the live tile.
                ScheduledActionService.Remove("PeriodicTaskForLocation");

                // Update tile.
                RadFlipTileData extendedData = new RadFlipTileData()
                {
                    WideVisualElement = null,
                    WideBackVisualElement = null,
                    IsTransparencySupported = true
                };
                ShellTile tile = ShellTile.ActiveTiles.First();
                if (tile != null)
                {
                    tile.Update(extendedData);
                    LiveTileHelper.UpdateTile(tile, extendedData);
                }

成功了:

  // Remove the Background Agent for the live tile.
  RemoveAgent("PeriodicTaskForLocation");
  // Delete tile.
  ShellTile tile = ShellTile.ActiveTiles.First();
  if (tile != null)
  {
                RadFlipTileData extendedData = new RadFlipTileData();
                extendedData.IsTransparencySupported = true;

                extendedData.WideBackgroundImage = new Uri("/Assets/Tiles/Icon.png", UriKind.Relative);
                extendedData.WideBackVisualElement = null;
                LiveTileHelper.UpdateTile(tile, extendedData);
  }

最新更新