示例#1
0
        void UpdateTileWithImage_Click(object sender, RoutedEventArgs e)
        {
            // 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

            // Users can resize any app tile to the small (Square70x70 on Windows 8.1, Square71x71 on Windows Phone 8.1) and medium (Square150x150) tile sizes.
            // These are both tile sizes an app must minimally support.
            // An app can additionally support the wide (Wide310x150) tile size as well as the large (Square310x310) tile size.
            // Note that in order to support a large (Square310x310) tile size, an app must also support the wide (Wide310x150) tile size (but not vice versa).

            // This sample application supports all four tile sizes: small, medium, wide and large.
            // This means that the user may have resized their tile to any of these four sizes for their custom Start screen layout.
            // Because an app has no way of knowing what size the user resized their app tile to, an app should include template bindings
            // for each supported tile sizes in their notifications. Only Windows Phone 8.1 supports small tile notifications.
            // We assemble one notification with four template bindings by including the content for each smaller
            // tile in the next size up. Square310x310 includes Wide310x150, which includes Square150x150, which includes Square71x71.
            // If we leave off the content for a tile size which the application supports, the user will not see the
            // notification if the tile is set to that size.

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

            tileContent.Image.Src = "ms-appx:///images/purpleSquare310x310.png";
            tileContent.Image.Alt = "Purple image";

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

            wide310x150Content.TextCaptionWrap.Text = "This tile notification uses ms-appx images";
            wide310x150Content.Image.Src            = "ms-appx:///images/redWide310x150.png";
            wide310x150Content.Image.Alt            = "Red image";

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

            square150x150Content.Image.Src = "ms-appx:///images/graySquare150x150.png";
            square150x150Content.Image.Alt = "Gray image";

            // 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:///images/graySquare150x150.png";
            square71x71Content.Image.Alt = "Gray image";

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

            OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent());
            rootPage.NotifyUser("Tile notification with local images sent", NotifyType.StatusMessage);
        }
        void SendTileNotificationWithQueryStrings_Click(object sender, RoutedEventArgs e)
        {
            ITileSquare310x310Image square310x310TileContent = TileContentFactory.CreateTileSquare310x310Image();

            square310x310TileContent.Image.Src = ImageUrl.Text;
            square310x310TileContent.Image.Alt = "Web image";

            // enable AddImageQuery on the notification
            square310x310TileContent.AddImageQuery = true;

            ITileWide310x150ImageAndText01 wide310x150TileContent = TileContentFactory.CreateTileWide310x150ImageAndText01();

            wide310x150TileContent.TextCaptionWrap.Text = "This tile notification uses query strings for the image src.";
            wide310x150TileContent.Image.Src            = ImageUrl.Text;
            wide310x150TileContent.Image.Alt            = "Web image";

            ITileSquare150x150Image square150x150TileContent = TileContentFactory.CreateTileSquare150x150Image();

            square150x150TileContent.Image.Src = ImageUrl.Text;
            square150x150TileContent.Image.Alt = "Web image";

            ITileSquare71x71Image square71x71TileContent = TileContentFactory.CreateTileSquare71x71Image();

            square71x71TileContent.Image.Src = ImageUrl.Text;
            square71x71TileContent.Image.Alt = "Web image";

            square150x150TileContent.Square71x71Content = square71x71TileContent;
            wide310x150TileContent.Square150x150Content = square150x150TileContent;
            square310x310TileContent.Wide310x150Content = wide310x150TileContent;

            TileUpdateManager.CreateTileUpdaterForApplication().Update(square310x310TileContent.CreateNotification());

            OutputTextBlock.Text = MainPage.PrettyPrint(square310x310TileContent.GetContent());
            rootPage.NotifyUser("Tile notification with image query strings sent.", NotifyType.StatusMessage);
        }
        void SendScaledImageTileNotification_Click(object sender, RoutedEventArgs e)
        {
            string scale;

            ResourceContext.GetForCurrentView().QualifierValues.TryGetValue("Scale", out scale);

            ITileSquare310x310Image square310x310TileContent = TileContentFactory.CreateTileSquare310x310Image();

            square310x310TileContent.Image.Src = "ms-appx:///images/purpleSquare310x310.png";
            square310x310TileContent.Image.Alt = "Purple square";

            ITileWide310x150ImageAndText01 wide310x150TileContent = TileContentFactory.CreateTileWide310x150ImageAndText01();

            wide310x150TileContent.TextCaptionWrap.Text = "scaled version of blueWide310x150.png in the xml is selected based on the current Start scale";
            wide310x150TileContent.Image.Src            = "ms-appx:///images/blueWide310x150.png";
            wide310x150TileContent.Image.Alt            = "Blue wide";

            ITileSquare150x150Image square150x150TileContent = TileContentFactory.CreateTileSquare150x150Image();

            square150x150TileContent.Image.Src = "ms-appx:///images/graySquare150x150.png";
            square150x150TileContent.Image.Alt = "Gray square";

            ITileSquare71x71Image square71x71TileContent = TileContentFactory.CreateTileSquare71x71Image();

            square71x71TileContent.Image.Src = "ms-appx:///images/graySquare150x150.png";
            square71x71TileContent.Image.Alt = "Gray square";

            square150x150TileContent.Square71x71Content = square71x71TileContent;
            wide310x150TileContent.Square150x150Content = square150x150TileContent;
            square310x310TileContent.Wide310x150Content = wide310x150TileContent;

            TileUpdateManager.CreateTileUpdaterForApplication().Update(square310x310TileContent.CreateNotification());

            OutputTextBlock.Text = MainPage.PrettyPrint(square310x310TileContent.GetContent());
            rootPage.NotifyUser("Tile notification with scaled images sent.", NotifyType.StatusMessage);
        }
        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)
            {
            }
        }