Beispiel #1
0
        void ScheduleTile(String updateString, DateTime dueTime, int idNumber)
        {
            // Set up the wide tile text
            ITileWideText09 tileContent = TileContentFactory.CreateTileWideText09();

            tileContent.TextHeading.Text  = updateString;
            tileContent.TextBodyWrap.Text = "Received: " + dueTime.ToLocalTime();

            // Set up square tile text
            ITileSquareText04 squareContent = TileContentFactory.CreateTileSquareText04();

            squareContent.TextBodyWrap.Text = updateString;

            tileContent.SquareContent = squareContent;

            // Create the notification object
            ScheduledTileNotification futureTile = new ScheduledTileNotification(tileContent.GetXml(), dueTime);

            futureTile.Id = "Tile" + idNumber;

            // Add to schedule
            // You can update a secondary tile in the same manner using CreateTileUpdaterForSecondaryTile(tileId)
            // See "Tiles" sample for more details
            TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(futureTile);
            rootPage.NotifyUser("Scheduled a tile with ID: " + futureTile.Id, NotifyType.StatusMessage);
        }
Beispiel #2
0
        public async void pinButton_Click(object sender, RoutedEventArgs e)
        {
            this.BottomAppBar.IsSticky = true;

            _item.IsPin = true;

            var logo      = new Uri("ms-appx:///Assets/Logo.png");
            var logoWide  = new Uri("ms-appx:///Assets/WideLogo.png");
            Uri smallLogo = new Uri("ms-appx:///Assets/SmallLogo.png");


            SecondaryTile tile = new SecondaryTile(
                _item.UniqueId,                 // Tile ID
                "Think",                        // Tile short name
                _item.Autor,                    // Tile display name
                _item.UniqueId,                 // Activation argument
                TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo,
                logo,                           // Tile logo
                logoWide
                );

            // Specify a foreground text value.
            // The tile background color is inherited from the parent unless a separate value is specified.
            tile.ForegroundText = ForegroundText.Light;


            // Like the background color, the small tile logo is inherited from the parent application tile by default. Let's override it, just to see how that's done.
            tile.SmallLogo = smallLogo;


            bool created = await tile.RequestCreateAsync();

            if (created)
            {
                // Note: This sample contains an additional reference, NotificationsExtensions, which you can use in your apps
                ITileWideText09 tileContent = TileContentFactory.CreateTileWideText09();
                tileContent.TextHeading.Text  = _item.Autor;
                tileContent.TextBodyWrap.Text = _item.Quote;


                ITileSquareText04 squareContent = TileContentFactory.CreateTileSquareText04();
                squareContent.TextBodyWrap.Text = _item.Quote;
                tileContent.SquareContent       = squareContent;


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

            // Show pin button in the appbar
            CheckAppBarButtons();

            this.BottomAppBar.IsSticky = false;
            ThinkDataSource.SaveLocalDataAsync();
        }