Пример #1
0
        /// <summary>
        /// TileWideSmallImageAndText02
        /// On the left, one small image; on the right, one header string in larger text on the first line over four strings of regular text on the next four lines. Text does not wrap.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileWideSmallImageAndText02
        ///
        /// TileSquarePeekImageAndText02
        /// Top: Square image, no text. Bottom: One header string in larger text on the first line, over one string of regular text wrapped over a maximum of three lines.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileSquarePeekImageAndText02
        /// </summary>
        /// <param name="item"></param>
        private static void CreateSeconderyNoteBook(NoteBook item)
        {
            var imgUrl     = GetPreviewImage(item, false).ToString();
            var imgWideUrl = GetPreviewImage(item, true).ToString();

            ITileWide310x150SmallImageAndText02 tileContent = TileContentFactory.CreateTileWide310x150SmallImageAndText02();

            tileContent.TextHeading.Text = item.Title;
            var count = item.Items.Count < 4 ? item.Items.Count : 4;

            for (var i = 0; i < count; i++)
            {
                var noteTitle = item.Items[i].Title;
                switch (i)
                {
                case 0:
                    tileContent.TextBody1.Text = noteTitle;
                    break;

                case 1:
                    tileContent.TextBody2.Text = noteTitle;
                    break;

                case 2:
                    tileContent.TextBody3.Text = noteTitle;
                    break;

                case 3:
                    tileContent.TextBody3.Text = noteTitle;
                    break;
                }
            }

            tileContent.Image.Src = imgWideUrl;
            tileContent.Image.Alt = item.Title;

            tileContent.Branding = TileBranding.Name;

            ITileSquare150x150PeekImageAndText02 squareTileContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText02();

            squareTileContent.Image.Src         = imgUrl;
            squareTileContent.Image.Alt         = item.Title;
            squareTileContent.TextHeading.Text  = item.Title;
            squareTileContent.TextBodyWrap.Text = item.Description.Equals(Consts.DefaultDescriptionText) ? string.Empty : item.Description.ToShortString();
            tileContent.Square150x150Content    = squareTileContent;

            TileUpdateManager.CreateTileUpdaterForSecondaryTile(item.UniqueId).Update(tileContent.CreateNotification());
        }
Пример #2
0
        /// <summary>
        /// TileWideSmallImageAndText02
        /// On the left, one small image; on the right, one header string in larger text on the first line over four strings of regular text on the next four lines. Text does not wrap.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileWideSmallImageAndText02
        ///
        /// TileSquareText01
        /// One header string in larger text on the first line; three strings of regular text on each of the next three lines. Text does not wrap.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileSquareText01
        /// </summary>
        /// <param name="item"></param>
        private static void CreateSeconderyForToDo(ToDoDataItem item)
        {
            ITileWide310x150SmallImageAndText02 tileContent = TileContentFactory.CreateTileWide310x150SmallImageAndText02();
            var imgUrl     = GetPreviewImage(item, false).ToString();
            var imgWideUrl = GetPreviewImage(item, true).ToString();

            tileContent.Image.Src = imgWideUrl;
            tileContent.Image.Alt = item.Title;
            tileContent.RequireSquare150x150Content = true;
            tileContent.TextHeading.Text            = item.Title;
            var count = item.ToDo.Count >= 4 ? 4 : item.ToDo.Count;

            for (var i = 0; i < count; i++)
            {
                var value = item.ToDo[i].Done == true?string.Format("{0} {1}", "√", item.ToDo[i].Title) : item.ToDo[i].Title;

                switch (i)
                {
                case 0:
                    tileContent.TextBody1.Text = value;
                    break;

                case 1:
                    tileContent.TextBody2.Text = value;
                    break;

                case 2:
                    tileContent.TextBody3.Text = value;
                    break;

                case 3:
                    tileContent.TextBody4.Text = value;
                    break;
                }
            }

            ITileSquare150x150Text01 squareTileContent = TileContentFactory.CreateTileSquare150x150Text01();

            squareTileContent.TextHeading.Text = item.Title;
            count = item.ToDo.Count >= 3 ? 3 : item.ToDo.Count;
            for (var i = 0; i < count; i++)
            {
                var value = item.ToDo[i].Done == true?string.Format("{0} {1}", "√", item.ToDo[i].Title) : item.ToDo[i].Title;

                switch (i)
                {
                case 0:
                    squareTileContent.TextBody1.Text = value;
                    break;

                case 1:
                    squareTileContent.TextBody2.Text = value;
                    break;

                case 2:
                    squareTileContent.TextBody3.Text = value;
                    break;
                }
            }

            tileContent.Branding             = TileBranding.Name;
            tileContent.Square150x150Content = squareTileContent;
            TileUpdateManager.CreateTileUpdaterForSecondaryTile(item.UniqueId).Update(tileContent.CreateNotification());
        }