/// <summary>
        ///  セカンダリタイルから起動された時の処理.
        /// </summary>
        /// <param name="tileId"></param>
        public async void SecondaryTile_LaunchedAsync(string tileId)
        {
            var secondaryTile = await TileHelper.GetSecondaryTileFromTileIdAsync(tileId);

            if (secondaryTile == null)
            {
                App.Current.LaunchedFromSecondaryTile = false;
                return;
            }

            await App.Current.LoadAllItemsAsync();

            var item = App.Current.LockscreenItemList.FirstOrDefault(x => tileId.Equals(x.Setting.TileId, StringComparison.Ordinal));

            if (item == null)
            {
                // delete from start
                if (await secondaryTile.RequestDeleteAsync())
                {
                    await TileHelper.RemoveTileRegistrationAsync(tileId);
                }
                App.Current.LaunchedFromSecondaryTile = false;
                return;
            }
            else
            {
                var succeedToSet = await SetSelectedItemToLockscreenAsync(item);

                LoadCurrentLockscreenImageAsync();
                App.Current.LaunchedFromSecondaryTile = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  ロック画面に設定するアイテムのセカンダリタイルを取得する.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static async Task <Tile> GetSecondaryTileForItem(LockscreenImageItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            var secondaryTile = await TileHelper.GetSecondaryTileFromTileIdAsync(item.Setting.TileId);

            if (secondaryTile == null)
            {
                return(null);
            }

            return(new Tile()
            {
                SecondaryTile = secondaryTile,
            });
        }