PutraKg
PutraKg

Reputation: 2246

How to go to the Windows Phone Start Screen directly from within my app?

My app has the option to create many secondary tiles. When user try to pin an existing tile, the app asks the user to go to the Start Screen to remove the tile first.

Is there a way programmatically to navigate to the WP Start Screen from my app?

UPDATE I know user can just click the start button or back button. But I want to detect if that navigation is made to set certain flags. And it would be a little convenient for the user if the apps could help them to navigate automatically.

Upvotes: 0

Views: 89

Answers (2)

halil
halil

Reputation: 326

From the UX point of view, you should already avoid such situations by disabling (or adding to the tile 'unpin from start' option) for the corresponding tile, if it's already pinned to start.

  public static bool CheckIfTileExists(string tileUri)
            {
                ShellTile shellTile = ShellTile.ActiveTiles.FirstOrDefault(
                    tile => tile.NavigationUri.ToString().Contains(tileUri));
                if (shellTile == null)
                    return false;
                return true;
            }

Upvotes: 0

asitis
asitis

Reputation: 3031

As you said "When user try to pin an existing tile" means you want to update the existing tile . Use the code for Updating the existing tile.

 public static void UpdateAppTile(string navigationUri)
 {
   var tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(navigationUri));
   if (tile != null)
   {
           var tileData = new FlipTileData
            {
                SmallBackgroundImage = new Uri("/Assets/Tiles/small.png", UriKind.Relative),
                BackgroundImage = new Uri("/Assets/Tiles/medium.png", UriKind.Relative),
                WideBackgroundImage = new Uri("/Assets/Tiles/wide.png", UriKind.Relative),
                // other properties
            };
            tile.Update(tileData);
    }
 }

And for deleting the tile

 public static void DeleteAppTile(string navigationUri)
 {
   var tile =  ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(navigationUri));
   if (tile != null)
   {
     tileToFind.Delete();
   }
 }

Upvotes: 1

Related Questions