private void PinTile()
        {
            if (IsPinned)
            {
                var tile = TileService.Current.GetTile(_tileUrl);
                if (tile != null)
                {
                    tile.Delete();
                    IsPinned = false;
                }
            }
            else
            {
                var tileData = new ShellTileServiceFlipTileData
                {
                    Title = "MB " + AppResources.LabelLiveTv,
                    BackgroundImage = App.SpecificSettings.UseTransparentTile? new Uri("/Assets/Tiles/MBLiveTVTileTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/MBLiveTVTile.png", UriKind.Relative)
                };

                TileService.Current.Create(new Uri(_tileUrl, UriKind.Relative), tileData, false);

                IsPinned = true;
            }
        }
예제 #2
0
        public void SetSecondaryTileTransparency(bool useTransparentTiles)
        {
            ShellTileServiceFlipTileData tileData;
            var remoteTile = GetTile(string.Format(Constants.PhoneTileUrlFormat, "Remote", string.Empty, "Remote Control"));
            if (remoteTile != null)
            {
                tileData = new ShellTileServiceFlipTileData
                {
                    Title = "MB " + AppResources.LabelRemote,
                    BackgroundImage = App.SpecificSettings.UseTransparentTile ? new Uri("/Assets/Tiles/MBRemoteTileTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/MBRemoteTile.png", UriKind.Relative)
                };

                remoteTile.Update(tileData);
            }

            var liveTvTile = GetTile(string.Format(Constants.PhoneTileUrlFormat, "LiveTV", string.Empty, "Live TV"));
            if (liveTvTile != null)
            {
                tileData = new ShellTileServiceFlipTileData
                {
                    Title = "MB " + AppResources.LabelLiveTv,
                    BackgroundImage = App.SpecificSettings.UseTransparentTile ? new Uri("/Assets/Tiles/MBLiveTVTileTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/MBLiveTVTile.png", UriKind.Relative)
                };

                liveTvTile.Update(tileData);
            }

            var collectionTiles = ActiveTiles.Where(x => x.NavigationUri.ToString().Contains("=Collection"));
            foreach (var tile in collectionTiles)
            {
                var uri = new Uri("http://mediabrowser.tv" + tile.NavigationUri.OriginalString);
                var queries = uri.QueryDictionary();
                var name = queries["name"];
                var id = queries["id"];
                PinCollection(name, id, useTransparentTiles, false);
            }
        }
예제 #3
0
        private void UpdateTileData(Uri wideTileUri, Uri backContentUri = null, Uri backContentWideuri = null, bool useTransparentTile = false)
        {
            var primaryTile = ActiveTiles.First();

            var tileData = new ShellTileServiceFlipTileData
            {
                Title = ApplicationManifest.Current.App.Title,
                BackgroundImage = useTransparentTile ? new Uri("/Assets/Tiles/FlipCycleTileMediumTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative),
                SmallBackgroundImage = useTransparentTile ? new Uri("/Assets/Tiles/FlipCycleTileSmallTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative),
                WideBackgroundImage = wideTileUri,
                BackBackgroundImage = backContentUri ?? new Uri("/", UriKind.Relative),
                WideBackBackgroundImage = backContentWideuri ?? new Uri("/", UriKind.Relative)
            };

            primaryTile.Update(tileData);
        }
예제 #4
0
        public void PinCollection(string name, string id, bool isTransparentTile, bool createTile)
        {
            var tileUrl = string.Format(Constants.PhoneTileUrlFormat, "Collection", id, name);
            var tileData = new ShellTileServiceFlipTileData
            {
                Title = name,
                BackgroundImage = isTransparentTile ? new Uri("/Assets/Tiles/FlipCycleTileMediumTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative),
                SmallBackgroundImage = isTransparentTile ? new Uri("/Assets/Tiles/FlipCycleTileSmallTransparent.png", UriKind.Relative) : new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative),
                //WideBackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative)
            };

            if (createTile)
            {
                Create(new Uri(tileUrl, UriKind.Relative), tileData, false);
            }
            else
            {
                var tile = GetTile(tileUrl);
                if (tile != null)
                {
                    tile.Update(tileData);
                }
            }
        }