c# - 使用 C# 通过代码固定应用程序时,在应用程序列表页面上停用 ' pin to start '?

标签 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 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");
        }

如何禁止用户从应用程序列表屏幕再次固定应用程序

最佳答案

您应该了解主要图 block 和次要图 block 之间的区别。您通过代码创建的内容是辅助图 block ,用户从上下文菜单中固定的内容是主图 block 。

主图 block 始终是第一个图 block :

var primaryTile = ShellTile.ActiveTiles.First();

请记住,主图 block 始终存在,即使它没有固定。没有 API 可以检查主图 block 的固定状态。因此,我建议您从应用中删除此功能。

还可以找到一些详细信息here .

关于c# - 使用 C# 通过代码固定应用程序时,在应用程序列表页面上停用 ' pin to start '?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19756239/

相关文章:

c# - 解决方案中不存在 Package.appxmanifest

windows-phone-8 - VS 2013 命名空间中不存在名称 “LocalizedStrings”

c# - 有没有一种简单的方法可以手动解码 FlateDecode 过滤器以提取 PDF 中的文本? C#

SQL Server 内容的 C# 代码错误

c# - 如何每 20 天启动一些方法 (Windows Phone)

c# - 使用 Json.net 将 JSON 数组中的多个项目添加到 C# 中的对象

c# - 如何将 "Load More"按钮添加到列表框结果的底部?

javascript - 我的 WP 应用程序具有不受我控制的外部依赖项,我该如何解决问题而不重新提交到市场?

c# - <input type ="submit"/> 不执行 javascript 代码

c# - 如何为 Windows Phone 应用程序创建 Silverlight 4 用户控件?