Exemplo n.º 1
0
        private void PinTopicClickFav(object sender, RoutedEventArgs e)
        {
            TopicFav topicFavObject = ((sender as MenuItem).DataContext) as TopicFav;
            string   backgroundImageTile;
            string   backContent;
            Uri      backgroundImage;
            Uri      backBackgroundImage;
            // Création de la tile
            ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(topicFavObject.TopicUriFav));

            // Message à afficher
            backgroundImageTile = HFRClasses.GetCatName.ShortNameFromId(topicFavObject.TopicCatIdFav);
            if (topicFavObject.TopicIsHot == "On")
            {
                backContent         = "Nouveaux messages !";
                backBackgroundImage = new Uri("Images/tiles/unread.png", UriKind.Relative);
                backgroundImage     = new Uri("images/tiles/" + backgroundImageTile + "_new.png", UriKind.Relative);
            }
            else
            {
                backContent         = "Pas de nouveaux messages";
                backBackgroundImage = new Uri("Images/tiles/read.png", UriKind.Relative);
                backgroundImage     = new Uri("images/tiles/" + backgroundImageTile + ".png", UriKind.Relative);
            }

            if (TileToFind == null)
            {
                // The Count value of 12 shows the number 12 on the front of the Tile. Valid values are 1-99.
                // A Count value of 0 indicates that the Count should not be displayed.
                StandardTileData NewTileData = new StandardTileData
                {
                    BackgroundImage     = backgroundImage,
                    BackBackgroundImage = backBackgroundImage,
                    Title       = topicFavObject.TopicNameFav,
                    BackContent = backContent,
                    BackTitle   = topicFavObject.TopicNameFav
                };

                // Create the Tile and pin it to Start. This will cause a navigation to Start and a deactivation of our application.
                // TopicUriFav = "/ReadTopic.xaml?idcat=" + topicCatId + "&idtopic=" + topicId + "&topicname=" + HttpUtility.UrlEncode(line) + "&pagenumber=" + pageNumber + "&reponseid=" + reponseId + "&numberofpages=" + numberOfPagesTopicLine,
                ShellTile.Create(new Uri("/FromTileToTopic.xaml?" + topicFavObject.TopicUriFav.Split('?')[1], UriKind.Relative), NewTileData);
            }
            else
            {
                MessageBox.Show("Ce favori est déjà épinglé sur la page d'accueil.");
            }
        }
Exemplo n.º 2
0
        private void GoFavLastPageClick(object sender, RoutedEventArgs e)
        {
            TopicFav topicFavObject = ((sender as MenuItem).DataContext) as TopicFav;

            NavigationService.Navigate(new Uri("/ReadTopic.xaml?idcat=" + topicFavObject.TopicCatIdFav + "&idtopic=" + topicFavObject.TopicIdFav + "&topicname=" + HttpUtility.UrlEncode(topicFavObject.TopicNameFav) + "&pagenumber=" + topicFavObject.TopicNumberOfPages + "&numberofpages=" + topicFavObject.TopicNumberOfPages + "&from=listdrapcat", UriKind.Relative));
        }