/// <summary>
        /// This is the click handler for the 'Sending tile notification' button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SendTileNotification_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                if (SecondaryTile.Exists(MainPage.dynamicTileId))
                {
                    // Note: This sample contains an additional reference, NotificationsExtensions, which you can use in your apps
                    ITileWide310x150Text04 tileContent = TileContentFactory.CreateTileWide310x150Text04();
                    tileContent.TextBodyWrap.Text = "Sent to a secondary tile from NotificationsExtensions!";

                    ITileSquare150x150Text04 squareContent = TileContentFactory.CreateTileSquare150x150Text04();
                    squareContent.TextBodyWrap.Text  = "Sent to a secondary tile from NotificationExtensions!";
                    tileContent.Square150x150Content = squareContent;

                    // Send the notification to the secondary tile by creating a secondary tile updater
                    TileUpdateManager.CreateTileUpdaterForSecondaryTile(MainPage.dynamicTileId).Update(tileContent.CreateNotification());

                    rootPage.NotifyUser("Tile notification sent to " + MainPage.dynamicTileId, NotifyType.StatusMessage);
                }
                else
                {
                    ToggleButtons(false);
                    rootPage.NotifyUser(MainPage.dynamicTileId + " not pinned.", NotifyType.ErrorMessage);
                }
            }
        }
        void UpdateTileExpiring_Click(object sender, RoutedEventArgs e)
        {
            int seconds;

            if (!Int32.TryParse(Time.Text, out seconds))
            {
                seconds = 10;
            }

            Windows.Globalization.Calendar cal = new Windows.Globalization.Calendar();
            cal.SetToNow();
            cal.AddSeconds(seconds);

            var            longTime         = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longtime");
            DateTimeOffset expiryTime       = cal.GetDateTime();
            string         expiryTimeString = longTime.Format(expiryTime);

            // Create a notification for the Square310x310 tile using one of the available templates for the size.
            ITileSquare310x310Text09 tileSquare310x310Content = TileContentFactory.CreateTileSquare310x310Text09();

            tileSquare310x310Content.TextHeadingWrap.Text = "This notification will expire at " + expiryTimeString;

            // Create a notification for the Wide310x150 tile using one of the available templates for the size.
            ITileWide310x150Text04 wide310x150TileContent = TileContentFactory.CreateTileWide310x150Text04();

            wide310x150TileContent.TextBodyWrap.Text = "This notification will expire at " + expiryTimeString;

            // Create a notification for the Square150x150 tile using one of the available templates for the size.
            ITileSquare150x150Text04 square150x150TileContent = TileContentFactory.CreateTileSquare150x150Text04();

            square150x150TileContent.TextBodyWrap.Text = "This notification will expire at " + expiryTimeString;

            // Attach the Square150x150 template to the Wide310x150 template.
            wide310x150TileContent.Square150x150Content = square150x150TileContent;

            // Attach the Wide310x150 template to the Square310x310 template.
            tileSquare310x310Content.Wide310x150Content = wide310x150TileContent;

            TileNotification tileNotification = tileSquare310x310Content.CreateNotification();

            // Set the expiration time and update the tile.
            tileNotification.ExpirationTime = expiryTime;
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);

            rootPage.NotifyUser("Tile notification sent. It will expire at " + expiryTime, NotifyType.StatusMessage);
        }