コード例 #1
0
        public UpdateTileBackgroundTask()
        {
            _tileSquareContent           = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
            _tileSquareContent.Image.Src = "ms-appx:///Assets/Square150x150Logo.png";
            _tileSquareContent.Image.Alt = STORE_LOGO_ALT;

            _tileWideContent =
                TileContentFactory.CreateTileWide310x150PeekImage03();
            _tileWideContent.Image.Src = "ms-appx:///Assets/Wide310x150Logo.png";
            _tileWideContent.Image.Alt = STORE_LOGO_ALT;
        }
コード例 #2
0
        /// <summary>
        /// One large square image with four smaller square images to its right, no text.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileWideImageCollection
        /// </summary>
        /// <param name="item">The current Note item, this will allow us to get the notebooks for the image collection.</param>
        private static void TryCreateCollectionTile(NoteDataCommon item)
        {
            var totalImages = item.NoteBook.Items.SelectMany(i => i.Images).ToList();

            if (totalImages.Count >= 5)
            {
                ITileWide310x150ImageCollection tileContent = TileContentFactory.CreateTileWide310x150ImageCollection();
                for (var i = 0; i < 5; i++)
                {
                    var imgUrl = totalImages[i].ToBaseUrl();
                    switch (i)
                    {
                    case 0:
                        tileContent.ImageMain.Src = imgUrl;
                        tileContent.ImageMain.Alt = item.NoteBook.Title;
                        break;

                    case 1:
                        tileContent.ImageSmallColumn1Row1.Src = imgUrl;
                        tileContent.ImageSmallColumn1Row1.Alt = item.NoteBook.Title;
                        break;

                    case 2:
                        tileContent.ImageSmallColumn1Row2.Src = imgUrl;
                        tileContent.ImageSmallColumn1Row2.Alt = item.NoteBook.Title;
                        break;

                    case 3:
                        tileContent.ImageSmallColumn2Row1.Src = imgUrl;
                        tileContent.ImageSmallColumn2Row1.Alt = item.NoteBook.Title;
                        break;

                    case 4:
                        tileContent.ImageSmallColumn2Row2.Src = imgUrl;
                        tileContent.ImageSmallColumn2Row2.Alt = item.NoteBook.Title;
                        break;
                    }
                }

                ITileSquare150x150PeekImageAndText04 squareTileContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
                squareTileContent.Image.Src         = totalImages[0].ToBaseUrl();
                squareTileContent.Image.Alt         = item.Title;
                squareTileContent.TextBodyWrap.Text = item.Title;
                tileContent.Square150x150Content    = squareTileContent;

                ScheduledTileNotification schduleTile = new ScheduledTileNotification(tileContent.GetXml(), DateTime.Now.AddSeconds(10));
                TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
                TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(schduleTile);
            }
        }
コード例 #3
0
        /// <summary>
        /// TileWideImageAndText01
        /// One wide image over one string of regular text wrapped over a maximum of two lines.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileWideImageAndText01
        ///
        /// TileSquarePeekImageAndText04
        /// Top: Square image, no text. Bottom: One string of regular text wrapped over a maximum of four lines.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileSquarePeekImageAndText04
        /// </summary>
        /// <param name="item"></param>
        private static void CreateNotePreviewTile(NoteDataCommon item)
        {
            var imgWideUrl = GetPreviewImage(item, true).ToString();
            ITileWide310x150ImageAndText01 tileContent = TileContentFactory.CreateTileWide310x150ImageAndText01();

            tileContent.TextCaptionWrap.Text = item.Title;
            tileContent.Image.Src            = imgWideUrl;
            tileContent.Image.Alt            = item.Title;

            var imgUrl = GetPreviewImage(item, false).ToString();
            ITileSquare150x150PeekImageAndText04 squareTileContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();

            squareTileContent.Image.Src         = imgUrl;
            squareTileContent.Image.Alt         = item.Title;
            squareTileContent.TextBodyWrap.Text = item.Title;
            tileContent.Square150x150Content    = squareTileContent;

            tileContent.Branding = TileBranding.Logo;
            ScheduledTileNotification schduleTile = new ScheduledTileNotification(tileContent.GetXml(), DateTime.Now.AddSeconds(10));

            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
            TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(schduleTile);
        }
コード例 #4
0
        public static async void ShowliveTile()
        {
            try
            {
                string FileData = await FileManagement.ReadFile("MissingPeople.json");

                string ResultJson = "[" + FileData.ToString() + "]";

                List <MissingPerson> Mis = JsonData.MissingPeopleList("el", ResultJson, Category.Missing).OrderByDescending(x => x.DateMissing).ToList <MissingPerson>();

                if (Mis.Count >= 5)
                {
                    string SkippedItemsString = AppStorage.SkippedItems.Get();

                    String[] Skipped = SkippedItemsString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    if (Skipped.Count() != 0)
                    {
                        foreach (var item in Skipped)
                        {
                            Int32 Intitem       = Convert.ToInt32(item);
                            var   stuffToRemove = Mis.SingleOrDefault(s => s.ID == Intitem);
                            if (stuffToRemove != null)
                            {
                                Mis.Remove(stuffToRemove);
                            }
                        }
                    }
                    // Note: This sample contains an additional project, NotificationsExtensions.
                    // NotificationsExtensions exposes an object model for creating notifications, but you can also
                    // modify the strings directly. See UpdateTileWithImageWithStringManipulation_Click for an example

                    // Create a notification for the Square310x310 tile using one of the available templates for the size.
                    ITileSquare310x310SmallImagesAndTextList05 tileContent = TileContentFactory.CreateTileSquare310x310SmallImagesAndTextList05();
                    tileContent.TextHeading.Text      = "Eξαφανίσεις";
                    tileContent.Image1.Src            = Mis[0].ImageSrc;
                    tileContent.TextGroup1Field1.Text = Mis[0].FullName;
                    tileContent.TextGroup1Field2.Text = Mis[0].Town;
                    tileContent.Image2.Src            = Mis[1].ImageSrc;
                    tileContent.TextGroup2Field1.Text = Mis[1].FullName;
                    tileContent.TextGroup2Field2.Text = Mis[1].Town;
                    tileContent.Image3.Src            = Mis[2].ImageSrc;
                    tileContent.TextGroup3Field1.Text = Mis[2].FullName;
                    tileContent.TextGroup3Field2.Text = Mis[2].Town;

                    // Create a notification for the Wide310x150 tile using one of the available templates for the size.
                    ITileWide310x150PeekImageCollection05 wide310x150Content = TileContentFactory.CreateTileWide310x150PeekImageCollection05();
                    wide310x150Content.ImageMain.Src             = Mis[0].ImageSrc;
                    wide310x150Content.ImageSecondary.Src        = Mis[0].ImageSrc;
                    wide310x150Content.ImageSmallColumn1Row1.Src = Mis[1].ImageSrc;
                    wide310x150Content.ImageSmallColumn1Row2.Src = Mis[2].ImageSrc;
                    wide310x150Content.ImageSmallColumn2Row1.Src = Mis[3].ImageSrc;
                    wide310x150Content.ImageSmallColumn2Row2.Src = Mis[4].ImageSrc;
                    wide310x150Content.TextHeading.Text          = Mis[0].Date;
                    wide310x150Content.TextBodyWrap.Text         = Mis[0].FullName + " Εξαφανίστηκε από " + Mis[0].Town;

                    // Create a notification for the Square150x150 tile using one of the available templates for the size.
                    ITileSquare150x150PeekImageAndText04 square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
                    square150x150Content.Image.Src         = Mis[0].ImageSrc;
                    square150x150Content.TextBodyWrap.Text = Mis[0].FullName + Mis[0].Town;

                    // Create a notification for the Square71x71 tile using one of the available templates for the size.
                    ITileSquare71x71Image square71x71Content = TileContentFactory.CreateTileSquare71x71Image();
                    square71x71Content.Image.Src = "ms-appx:///Assets/Square70x70Logo.scale-100";
                    square71x71Content.Image.Alt = "Silver Alert";

                    // Attach the Square71x71 template to the Square150x150 template.
                    square150x150Content.Square71x71Content = square71x71Content;

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

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

                    // Send the notification to the application’s tile.
                    TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification());
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #5
0
ファイル: TileHomePage.cs プロジェクト: mevellea/GlobeTrotter
        public static void UpdateDisplay(String _appName, String _reward, Boolean _sample, String _picPath, List <String> _picAlbum, List <String> _countries)
        {
            ResourceLoader _res = ResourceLoader.GetForCurrentView();
            String         _textDesc = _res.GetString("ReviewDefinition");
            String         _uridemo = "ms-appx:///Assets/";
            String         _uriStart = _sample ? "ms-appx:///appdata/" : "ms-appdata:///local/";
            String         _src1, _src2, _src3, _src4;

            if (_picPath != null)
            {
                _src1 = _uriStart + _picPath + "/" + _picAlbum[0];

                if (_picAlbum.Count < 2)
                {
                    _src2 = _uridemo + "reward_0_blueViolet.png";
                }
                else
                {
                    _src2 = _uriStart + _picPath + "/" + _picAlbum[1];
                }

                if (_picAlbum.Count < 3)
                {
                    _src3 = _uridemo + "reward_1_blueViolet.png";
                }
                else
                {
                    _src3 = _uriStart + _picPath + "/" + _picAlbum[2];
                }

                if (_picAlbum.Count < 4)
                {
                    _src4 = _uridemo + "reward_2_blueViolet.png";
                }
                else
                {
                    _src4 = _uriStart + _picPath + "/" + _picAlbum[3];
                }

                if (_countries.Count > 0)
                {
                    _textDesc += " to ";
                    foreach (String _country in _countries)
                    {
                        _textDesc += _country + ", ";
                    }
                    _textDesc += "...";
                }
            }
            else
            {
                _src1   = _uridemo + "reward_0.png";
                _src2   = _uridemo + "reward_1.png";
                _src3   = _uridemo + "reward_2.png";
                _src4   = _uridemo + "reward_3.png";
                _reward = _uridemo + "reward_cup_1.png";
            }

            _src1 = "ms-appx:///appdata/1221335346/83915936.jpg";
            _src2 = "ms-appx:///appdata/1221335346/2112996589.jpg";
            _src3 = "ms-appx:///appdata/1221335346/1915394806.jpg";
            _src4 = "ms-appx:///appdata/1221335346/684173310.jpg";

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

            tileContent.TextCaptionWrap.Text = _textDesc;
            tileContent.ImageMain.Src        = _reward;
            tileContent.ImageSmall1.Src      = _src1;
            tileContent.ImageSmall2.Src      = _src2;
            tileContent.ImageSmall3.Src      = _src3;
            tileContent.ImageSmall4.Src      = _src4;

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

            wide310x150Content.TextBodyWrap.Text         = _textDesc;
            wide310x150Content.TextHeading.Text          = _appName;
            wide310x150Content.ImageSmallColumn1Row1.Src = _src1;
            wide310x150Content.ImageSmallColumn2Row1.Src = _src2;
            wide310x150Content.ImageSmallColumn1Row2.Src = _src3;
            wide310x150Content.ImageSmallColumn2Row2.Src = _src4;
            wide310x150Content.ImageMain.Src             = _reward;
            wide310x150Content.ImageSecondary.Src        = _reward;

            // Create a notification for the Square150x150 tile using one of the available templates for the size.
            ITileSquare150x150PeekImageAndText04 square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();

            square150x150Content.TextBodyWrap.Text = _textDesc;
            square150x150Content.Image.Src         = _reward;

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