Beispiel #1
0
        public static TileNotification TileNotificationForQuotes(
            ICollection <StockQuote> quotes)
        {
            var nameSubgroup   = new TileSubgroup();
            var upDownSubgroup = new TileSubgroup();
            int count          = 3;

            foreach (var quote in quotes)
            {
                nameSubgroup.Children.Add(CreateNameTextForQuote(quote));
                upDownSubgroup.Children.Add(CreateArrowTextForQuote(quote));
                count--;
                if (count == 0)
                {
                    break;
                }
            }

            var group = new TileGroup();

            group.Children.Add(nameSubgroup);
            group.Children.Add(upDownSubgroup);

            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                group
                            }
                        }
                    },
                    TileWide = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                group
                            }
                        }
                    }
                }
            };

            var doc = content.GetXml();

            return(new TileNotification(doc));
        }
Beispiel #2
0
        private static TileBinding CreateWideMusicTileBinding()
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileGroup()
                    {
                        Children =
                        {
                            new TileSubgroup()
                            {
                                Children =
                                {
                                    new TileText()
                                    {
                                        Text  = Strings.NowPlaying,
                                        Style = TileTextStyle.Body,
                                    },
                                    new TileText()
                                    {
                                        Text  = Locator.MusicPlayerVM.CurrentTrack.Name + " - " + Locator.MusicPlayerVM.CurrentTrack.ArtistName,
                                        Wrap  = true,
                                        Style = TileTextStyle.CaptionSubtle
                                    }
                                }
                            }
                        }
                    },
                }
            };

            if (!string.IsNullOrEmpty(Locator.MusicPlayerVM.CurrentAlbum?.AlbumCoverFullUri))
            {
                bindingContent.PeekImage = new TilePeekImage()
                {
                    Source = Locator.MusicPlayerVM.CurrentAlbum.AlbumCoverFullUri,
                };
            }

            if (!string.IsNullOrEmpty(Locator.MusicPlayerVM.CurrentArtist?.Picture))
            {
                var artistPic = new TileSubgroup()
                {
                    Weight   = 33,
                    Children =
                    {
                        new TileImage()
                        {
                            Crop   = TileImageCrop.Circle,
                            Source = new TileImageSource(Locator.MusicPlayerVM.CurrentArtist.Picture)
                        }
                    }
                };
                (bindingContent.Children[0] as TileGroup).Children.Insert(0, artistPic);
            }

            return(new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content = bindingContent
            });
        }