コード例 #1
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
        ///
        /// TileSquarePeekImageAndText02
        /// Top: Square image, no text. Bottom: One header string in larger text on the first line, over one string of regular text wrapped over a maximum of three lines.
        /// http://msdn.microsoft.com/en-us/library/windows/apps/hh761491#TileSquarePeekImageAndText02
        /// </summary>
        /// <param name="item"></param>
        private static void CreateSeconderyNoteBook(NoteBook item)
        {
            var imgUrl     = GetPreviewImage(item, false).ToString();
            var imgWideUrl = GetPreviewImage(item, true).ToString();

            ITileWide310x150SmallImageAndText02 tileContent = TileContentFactory.CreateTileWide310x150SmallImageAndText02();

            tileContent.TextHeading.Text = item.Title;
            var count = item.Items.Count < 4 ? item.Items.Count : 4;

            for (var i = 0; i < count; i++)
            {
                var noteTitle = item.Items[i].Title;
                switch (i)
                {
                case 0:
                    tileContent.TextBody1.Text = noteTitle;
                    break;

                case 1:
                    tileContent.TextBody2.Text = noteTitle;
                    break;

                case 2:
                    tileContent.TextBody3.Text = noteTitle;
                    break;

                case 3:
                    tileContent.TextBody3.Text = noteTitle;
                    break;
                }
            }

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

            tileContent.Branding = TileBranding.Name;

            ITileSquare150x150PeekImageAndText02 squareTileContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText02();

            squareTileContent.Image.Src         = imgUrl;
            squareTileContent.Image.Alt         = item.Title;
            squareTileContent.TextHeading.Text  = item.Title;
            squareTileContent.TextBodyWrap.Text = item.Description.Equals(Consts.DefaultDescriptionText) ? string.Empty : item.Description.ToShortString();
            tileContent.Square150x150Content    = squareTileContent;

            TileUpdateManager.CreateTileUpdaterForSecondaryTile(item.UniqueId).Update(tileContent.CreateNotification());
        }
コード例 #2
0
        /// <summary>
        ///     Sets the MainTile with new Information
        /// </summary>
        /// <param name="income">Income of these month</param>
        /// <param name="spending">Spending of these month</param>
        /// <param name="earnings">Earnings of these month </param>
        public void UpdateMainTile(string income, string spending, string earnings)
        {
            TileUpdateManager.CreateTileUpdaterForApplication().Clear();

            if (ServiceLocator.Current.GetInstance <TileSettingsViewModel>().ShowInfoOnMainTile)
            {
                ITileSquare310x310SmallImagesAndTextList04 tileContent =
                    TileContentFactory.CreateTileSquare310x310SmallImagesAndTextList04();
                tileContent.Image1.Src        = "ms-appx:///Assets/Logo.png";
                tileContent.TextHeading1.Text = Translation.GetTranslation("CashflowTileLabel");
                tileContent.TextWrap1.Text    = income;
                tileContent.TextWrap2.Text    = spending;
                tileContent.TextWrap3.Text    = earnings;

                // Create a notification for the Wide310x150 tile using one of the available templates for the size.
                ITileWide310x150SmallImageAndText02 wide310x150Content =
                    TileContentFactory.CreateTileWide310x150SmallImageAndText02();
                wide310x150Content.Image.Src        = "ms-appx:///Assets/Logo.png";
                wide310x150Content.TextHeading.Text = Translation.GetTranslation("CashflowTileLabel");
                wide310x150Content.TextBody1.Text   = income;
                wide310x150Content.TextBody2.Text   = spending;
                wide310x150Content.TextBody3.Text   = earnings;

                // Create a notification for the Square150x150 tile using one of the available templates for the size.
                ITileSquare150x150PeekImageAndText01 square150x150Content =
                    TileContentFactory.CreateTileSquare150x150PeekImageAndText01();
                square150x150Content.Image.Src        = "ms-appx:///Assets/Logo.png";
                square150x150Content.TextHeading.Text = Translation.GetTranslation("CashflowTileLabel");
                square150x150Content.TextBody1.Text   = income;
                square150x150Content.TextBody2.Text   = spending;
                square150x150Content.TextBody3.Text   = earnings;

                // 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? tile.
                TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification());
            }
        }
コード例 #3
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());
        }