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();
        }
        public static void UpdateNormalTile(List <string> undoList, bool isAddToSchedule = false)
        {
            var mediumContent = TileContentFactory.CreateTileSquare150x150Text01();

            mediumContent.TextBody1.Text   = undoList.Count == 0 ? "Enjoy your day ;-)" : undoList.ElementAtOrDefault(0);
            mediumContent.TextBody2.Text   = undoList.ElementAtOrDefault(1);
            mediumContent.TextBody3.Text   = undoList.ElementAtOrDefault(2);
            mediumContent.TextHeading.Text = "TO-DO: " + undoList.Count.ToString();

            var wideContent = TileContentFactory.CreateTileWide310x150BlockAndText01();

            wideContent.RequireSquare150x150Content = true;
            wideContent.Square150x150Content        = mediumContent;
            wideContent.TextBlock.Text    = "  " + undoList.Count.ToString();
            wideContent.TextSubBlock.Text = "To-do";
            wideContent.TextBody1.Text    = undoList.Count == 0 ? "Enjoy your day" : undoList.ElementAtOrDefault(0);
            wideContent.TextBody2.Text    = undoList.ElementAtOrDefault(1);
            wideContent.TextBody3.Text    = undoList.ElementAtOrDefault(2);
            wideContent.TextBody4.Text    = undoList.ElementAtOrDefault(3);
            wideContent.Branding          = TileBranding.Logo;

            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(isAddToSchedule);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(wideContent.CreateNotification());

            if (undoList.Count > 3 && isAddToSchedule)
            {
                wideContent.TextBody1.Text = undoList.ElementAtOrDefault(4);
                wideContent.TextBody2.Text = undoList.ElementAtOrDefault(5);
                wideContent.TextBody3.Text = undoList.ElementAtOrDefault(6);
                wideContent.TextBody4.Text = undoList.ElementAtOrDefault(7);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(wideContent.CreateNotification());

                if (undoList.Count > 6)
                {
                    wideContent.TextBody1.Text = undoList.ElementAtOrDefault(8);
                    wideContent.TextBody2.Text = undoList.ElementAtOrDefault(9);
                    wideContent.TextBody3.Text = undoList.ElementAtOrDefault(10);
                    wideContent.TextBody4.Text = undoList.ElementAtOrDefault(11);
                    TileUpdateManager.CreateTileUpdaterForApplication().Update(wideContent.CreateNotification());
                }
            }
        }
Exemple #3
0
        public async Task <ISquare310x310TileNotificationContent> detailedLiveTiles(string siteName)
        {
            var aqiStr    = "AQI:" + sitesStrDict[siteName]["AQI"];
            var pm2_5_Str = "PM 2.5:" + sitesStrDict[siteName]["PM2.5"];
            var siteStr   = "觀測站:" + sitesStrDict[siteName]["SiteName"];
            var timeStr   = sitesStrDict[siteName]["PublishTime"].Substring(11, 5);
            // get the XML content of one of the predefined tile templates, so that, you can customize it
            // Large template
            var statusStr    = StaticTaqModel.fieldNames["Status"] + ":" + sitesStrDict[siteName]["Status"];
            var largeContent = TileContentFactory.CreateTileSquare310x310Text09();

            largeContent.TextHeadingWrap.Text = statusStr;
            largeContent.TextHeading1.Text    = siteStr;
            largeContent.TextHeading2.Text    = "發佈時間:" + timeStr;
            largeContent.TextBody1.Text       = aqiStr;
            largeContent.TextBody2.Text       = pm2_5_Str;
            largeContent.Branding             = NotificationsExtensions.TileContent.TileBranding.None;

            // create the wide template
            var wideContent = TileContentFactory.CreateTileWide310x150Text01();

            wideContent.TextHeading.Text = statusStr;
            wideContent.TextBody1.Text   = siteStr;
            wideContent.TextBody2.Text   = "發佈時間:" + timeStr;
            wideContent.TextBody3.Text   = aqiStr;
            wideContent.TextBody4.Text   = pm2_5_Str;
            wideContent.Branding         = NotificationsExtensions.TileContent.TileBranding.None;

            // create the square template and attach it to the wide template
            var squareContent = TileContentFactory.CreateTileSquare150x150Text01();

            squareContent.TextHeading.Text = aqiStr;
            squareContent.TextBody1.Text   = pm2_5_Str;
            squareContent.TextBody2.Text   = siteStr;
            squareContent.TextBody3.Text   = "時間:" + timeStr;
            squareContent.Branding         = NotificationsExtensions.TileContent.TileBranding.None;

            largeContent.Wide310x150Content  = wideContent;
            wideContent.Square150x150Content = squareContent;

            return(largeContent);
        }
Exemple #4
0
        public MainPage()
        {
            this.InitializeComponent();

            var tileContent = TileContentFactory.CreateTileSquare150x150Text01();

            tileContent.TextHeading.Text = "Hello!";
            tileContent.TextBody1.Text   = "One";
            tileContent.TextBody2.Text   = "Two";
            tileContent.TextBody3.Text   = "Three";

            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(tileContent.ToString());

            TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();

            tileUpdater.Update(
                new TileNotification(xmlDocument)
            {
            });
        }
Exemple #5
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());
        }
Exemple #6
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());
        }