【问题标题】:Restoring a live tile to a static tile automatically after I remove its background agent删除后台代理后自动将活动磁贴恢复为静态磁贴
【发布时间】:2014-07-26 04:25:47
【问题描述】:

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

我想知道我需要做什么才能在我关闭动态磁贴功能后立即将应用的主磁贴恢复到其静态状态?目前,我需要调整磁贴的大小或移除/重新插入它以获得这种效果。

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

                // 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);
                }

【问题讨论】:

    标签: windows-phone-8 telerik windows-phone live-tile background-agents


    【解决方案1】:

    这已经成功了:

      // 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);
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-22
      相关资源
      最近更新 更多