停用';引脚到开始';使用C#通过代码固定应用程序时,在应用程序列表页面上?
我正在创建一个windows phone应用程序,我在其中放置了一个按钮以将应用程序锁定到启动屏幕,但当按住应用程序列表屏幕上的应用程序图标时,我发现可以使用锁定到启动选项停用';引脚到开始';使用C#通过代码固定应用程序时,在应用程序列表页面上?,c#,windows-phone-7,windows-phone-8,C#,Windows Phone 7,Windows Phone 8,我正在创建一个windows phone应用程序,我在其中放置了一个按钮以将应用程序锁定到启动屏幕,但当按住应用程序列表屏幕上的应用程序图标时,我发现可以使用锁定到启动选项 ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("MainPage.xaml")); // Create the Tile if we didn't
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("MainPage.xaml"));
// Create the Tile if we didn't find that it already exists.
if (TileToFind == null)
{
// Create the Tile object and set some initial properties for the Tile.
// 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 = new Uri("300.png", UriKind.Relative),
Title = "apptitle",
BackTitle = "title",
BackContent = "testing ",
BackBackgroundImage = null
};
// Create the Tile and pin it to Start. This will cause a navigation to Start and a deactivation of our app.
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), NewTileData);
}
else {
MessageBox.Show("Already Pinned");
}
如何禁止用户从应用程序列表屏幕再次锁定应用程序您应该了解主磁贴和辅助磁贴之间的区别。从代码中创建的是辅助磁贴,从上下文菜单中创建的用户PIN是主磁贴 主磁贴始终是第一个磁贴:
var primaryTile = ShellTile.ActiveTiles.First();
请记住,主磁贴始终存在,即使它没有固定。没有用于检查主磁贴固定状态的API。因此,我建议您从应用程序中删除此功能
也可以找到一些细节