private void CreateTileWithExtensions_Click(object sender, RoutedEventArgs e)
        {
            // Create a notification for the Square150x150 tile using one of the available templates for the size.
            ITileSquare150x150Text01 square150x150Content = TileContentFactory.CreateTileSquare150x150Text01();

            square150x150Content.Branding         = TileBranding.None;
            square150x150Content.TextHeading.Text = "Square Tile EXT";
            square150x150Content.TextBody1.Text   = "Line 1";
            square150x150Content.TextBody2.Text   = "Line 2";
            square150x150Content.TextBody3.Text   = "Line 3";

            // Create a notification for the Wide310x150 tile using one of the available templates for the size.
            ITileWide310x150Text01 wide310x150Content = TileContentFactory.CreateTileWide310x150Text01();

            wide310x150Content.Branding         = TileBranding.None;
            wide310x150Content.TextHeading.Text = "Wide Tile EXT";
            wide310x150Content.TextBody1.Text   = "Line 1";
            wide310x150Content.TextBody2.Text   = "Line 2";
            wide310x150Content.TextBody3.Text   = "Line 3";
            wide310x150Content.TextBody4.Text   = "Line 4";

            // Create a notification for the Square310x310 tile using one of the available templates for the size.
            ITileSquare310x310Text01 tileContent = TileContentFactory.CreateTileSquare310x310Text01();

            tileContent.Branding         = TileBranding.None;
            tileContent.TextHeading.Text = "Large Tile EXT";
            tileContent.TextBody1.Text   = "Line 1";
            tileContent.TextBody2.Text   = "Line 2";
            tileContent.TextBody3.Text   = "Line 3";
            tileContent.TextBody4.Text   = "Line 4";
            tileContent.TextBody5.Text   = "Line 5";
            tileContent.TextBody6.Text   = "Line 6";
            tileContent.TextBody7.Text   = "Line 7";
            tileContent.TextBody8.Text   = "Line 8";
            tileContent.TextBody9.Text   = "Line 9";

            // Attach the Square150x150 template to the Wide310x150 template.
            wide310x150Content.Square150x150Content = square150x150Content;

            // Attach the Wide310x150 template to the Square310x310 template.
            tileContent.Wide310x150Content = wide310x150Content;

            // Send the notification to the application’s tile.
            //TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification());

            var updater = TileUpdateManager.CreateTileUpdaterForApplication();

            updater.EnableNotificationQueue(true);
            updater.Update(tileContent.CreateNotification());

            ExtensionBasedXML.Text = XDocument.Parse(tileContent.GetContent()).ToString();
        }
Пример #2
0
        /// <summary>
        /// TileWideText01
        /// One header string in larger text on the first line, four strings of regular text on the next four lines. Text does not wrap.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileWideText01
        ///
        /// 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 CreateTextToDoTile(NoteDataCommon item)
        {
            ITileWide310x150Text01 tileContent = TileContentFactory.CreateTileWide310x150Text01();

            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());
        }