Exemplo n.º 1
0
        /// <summary>
        ///  タイルの登録情報を削除する.
        /// </summary>
        /// <param name="tileId"></param>
        /// <returns></returns>
        public static async Task RemoveTileRegistrationAsync(string tileId)
        {
            if (tileId == null)
            {
                throw new ArgumentNullException("tileId");
            }

            var regs = AppSettings.Instance.GetTileRegistration();

            if (!regs.ContainsKey(tileId))
            {
                return;
            }

            var registration = TileRegistration.FromJson(regs[tileId] as string);

            if (registration == null)
            {
                return;
            }

            await DeleteFileAsync(new Uri(registration.NormalTileImageCacheFileName));
            await DeleteFileAsync(new Uri(registration.WideTileImageCacheFileName));

            regs.Remove(tileId);
            AppSettings.Instance.SetTileRegistration(regs);
        }
Exemplo n.º 2
0
        public static TileRegistration At(this IDictionary <string, object> state, string tileId)
        {
            if (!state.ContainsKey(tileId))
            {
                return(null);
            }

            return(TileRegistration.FromJson(state[tileId] as string));
        }
Exemplo n.º 3
0
        /// <summary>
        ///  タイルの登録情報を保存する.
        /// </summary>
        /// <param name="tile"></param>
        public static void SaveTileRegistration(Tile tile)
        {
            if (tile == null)
            {
                throw new ArgumentNullException("tile");
            }

            var registration = new TileRegistration()
            {
                TileId = tile.SecondaryTile.TileId,
                NormalTileImageCacheFileName = tile.SecondaryTile.Logo.ToString(),
                WideTileImageCacheFileName   = tile.SecondaryTile.WideLogo.ToString(),
            };

            var regs = AppSettings.Instance.GetTileRegistration();

            regs.Add(registration);
            AppSettings.Instance.SetTileRegistration(regs);
        }
Exemplo n.º 4
0
 public static void Add(this IDictionary <string, object> state, TileRegistration registration)
 {
     state.Add(registration.TileId, registration.ToJson().Stringify());
 }