Пример #1
0
        public static void CreateTile(Post post)
        {
            TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();

            updater.EnableNotificationQueue(true);
            updater.Clear();

            var tileLarge = TileContentFactory.CreateTileWide310x150PeekImage01();

            tileLarge.Image.Src = "ms-appx:///Assets/WideLogo.scale-240.png";
            string title = post.Title;

            //if (title.Length > 13)
            //{
            //    title = title.Substring(0, 12) + "…";
            //}
            tileLarge.TextBodyWrap.Text = post.Summary;
            tileLarge.TextHeading.Text  = title;

            var tileSmall = TileContentFactory.CreateTileSquare150x150PeekImageAndText02();

            tileSmall.Image.Src         = "ms-appx:///Assets/Logo.scale-240.png";
            tileSmall.TextHeading.Text  = post.BlogApp;
            tileSmall.TextBodyWrap.Text = post.Title;

            tileLarge.Square150x150Content = tileSmall;
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileLarge.CreateNotification());
        }
Пример #2
0
        public void CreateTileWide310x150PeekImage01(string backTitle, string backContent)
        {
            var tileContent = TileContentFactory.CreateTileWide310x150PeekImage01();

            tileContent.Image.Src                   = "";
            tileContent.TextHeading.Text            = backTitle;
            tileContent.TextBodyWrap.Text           = backContent;
            tileContent.RequireSquare150x150Content = false;
            var tileNotification = tileContent.CreateNotification();

            Windows.UI.Notifications.TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }
Пример #3
0
        public void CreateTileWide310x150PeekImage01(string backTitle, string backContent)
        {
            var tileContent = TileContentFactory.CreateTileWide310x150PeekImage01();

            tileContent.Image.Src                   = "ms-appx:///Images/" + imageNum + "/310_150.jpg";
            tileContent.TextHeading.Text            = backTitle;
            tileContent.TextBodyWrap.Text           = backContent;
            tileContent.RequireSquare150x150Content = true;
            tileContent.Square150x150Content        = get150x150Content(backTitle, backContent);
            var tileNotification = tileContent.CreateNotification();

            Windows.UI.Notifications.TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }
Пример #4
0
        public static void CreateTile(Post post)
        {
            TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();

            updater.EnableNotificationQueue(true);
            updater.Clear();

            var tileLarge = TileContentFactory.CreateTileWide310x150PeekImage01();

            tileLarge.Image.Src = "ms-appx:///Assets/TileUpdateBG_Wide_310x150.png";
            string title = post.Title;

            tileLarge.TextBodyWrap.Text = post.Summary;
            tileLarge.TextHeading.Text  = title;

            var tileSmall = TileContentFactory.CreateTileSquare150x150PeekImageAndText02();

            tileSmall.Image.Src         = "ms-appx:///Assets/TileUpdateBG_Square_150x150.png";
            tileSmall.TextHeading.Text  = post.BlogApp;
            tileSmall.TextBodyWrap.Text = post.Title;

            tileLarge.Square150x150Content = tileSmall;
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileLarge.CreateNotification());
        }
        public static async Task <bool> UpdateNoteTileIfExists(Note note, bool transparentTile = false)
        {
            //must exists
            if (!SecondaryTile.Exists(note.ID))
            {
                return(false);
            }

            //update background
            await UpdateNoteTileBackgroundColor(note, transparentTile);

            string contentWithoutTitle = note.GetContent(true, false, 150, 3);
            string contentWithTitle    = note.GetContent(true, true, 200, 3);

            var tileSquare71Content = TileContentFactory.CreateTileSquare71x71Image();

            tileSquare71Content.Image.Src = "ms-appx:///Assets/Tiles/Transparent/Square71x71Logo.png";

            ITileNotificationContent biggerTile;
            ISquare150x150TileNotificationContent tileSquare150Content;

            if (note.Images != null && note.Images.Count > 0)
            {
                tileSquare150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText02();

                var _tileSquare150Content = tileSquare150Content as ITileSquare150x150PeekImageAndText02;
                _tileSquare150Content.TextHeading.Text   = note.Title;
                _tileSquare150Content.TextBodyWrap.Text  = contentWithoutTitle;
                _tileSquare150Content.Image.Src          = note.Images[0].URL;
                _tileSquare150Content.Square71x71Content = tileSquare71Content;
                _tileSquare150Content.Branding           = NotificationsExtensions.TileContent.TileBranding.Logo;
            }
            else
            {
                tileSquare150Content = TileContentFactory.CreateTileSquare150x150Text02();

                var _tileSquare150Content = tileSquare150Content as ITileSquare150x150Text02;
                _tileSquare150Content.TextHeading.Text   = note.Title;
                _tileSquare150Content.TextBodyWrap.Text  = contentWithoutTitle;
                _tileSquare150Content.Square71x71Content = tileSquare71Content;
                _tileSquare150Content.Branding           = NotificationsExtensions.TileContent.TileBranding.Logo;
            }

            IWide310x150TileNotificationContent tileWide310x150Content;

            if (note.Images != null && note.Images.Count > 0)
            {
                tileWide310x150Content = TileContentFactory.CreateTileWide310x150PeekImage01();

                var _tileWide310x150Content = tileWide310x150Content as ITileWide310x150PeekImage01;
                _tileWide310x150Content.TextHeading.Text     = note.Title;
                _tileWide310x150Content.TextBodyWrap.Text    = contentWithoutTitle;
                _tileWide310x150Content.Image.Src            = note.Images[0].URL;
                _tileWide310x150Content.Square150x150Content = tileSquare150Content;
                _tileWide310x150Content.Branding             = NotificationsExtensions.TileContent.TileBranding.Logo;
            }
            else
            {
                tileWide310x150Content = TileContentFactory.CreateTileWide310x150Text09();

                var _tileWide310x150Content = tileWide310x150Content as ITileWide310x150Text09;
                _tileWide310x150Content.TextHeading.Text     = note.Title;
                _tileWide310x150Content.TextBodyWrap.Text    = contentWithoutTitle;
                _tileWide310x150Content.Square150x150Content = tileSquare150Content;
                _tileWide310x150Content.Branding             = NotificationsExtensions.TileContent.TileBranding.Logo;
            }

#if WINDOWS_PHONE_APP
            biggerTile = tileWide310x150Content;
#else
            ISquare310x310TileNotificationContent tileSquare310Content;
            if (note.Images != null && note.Images.Count > 0)
            {
                tileSquare310Content = TileContentFactory.CreateTileSquare310x310ImageAndTextOverlay02();

                var _tileSquare310Content = tileSquare310Content as ITileSquare310x310ImageAndTextOverlay02;
                _tileSquare310Content.TextHeadingWrap.Text = note.Title;
                _tileSquare310Content.TextBodyWrap.Text    = contentWithoutTitle;
                _tileSquare310Content.Image.Src            = note.Images[0].URL;
                _tileSquare310Content.Wide310x150Content   = tileWide310x150Content;
                _tileSquare310Content.Branding             = NotificationsExtensions.TileContent.TileBranding.Logo;
            }
            else
            {
                tileSquare310Content = TileContentFactory.CreateTileSquare310x310ImageAndTextOverlay02();

                var _tileSquare310Content = tileSquare310Content as ITileSquare310x310ImageAndTextOverlay02;
                _tileSquare310Content.TextHeadingWrap.Text = note.Title;
                _tileSquare310Content.TextBodyWrap.Text    = contentWithoutTitle;
                _tileSquare310Content.Image.Src            = "";
                _tileSquare310Content.Wide310x150Content   = tileWide310x150Content;
                _tileSquare310Content.Branding             = NotificationsExtensions.TileContent.TileBranding.Logo;
            }

            biggerTile = tileSquare310Content;
#endif

            //create notification
            var notification = biggerTile.CreateNotification();
            notification.Tag = note.ID.Substring(0, 16);

            //update
            var tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(note.ID);
            tileUpdater.Clear();
            //tileUpdater.EnableNotificationQueue(false); //crashing on w10mobile
            tileUpdater.Update(notification);

            return(true);
        }