Xamarin/C#可视化窗口构建中黑底白字数字是什么?

4
当我为Windows 8.1或10构建Xamarin项目(在“本地机器”上运行)时,我会在左上角看到一些数字,类似于“0”。

enter image description here

我搜索了一下,但没有找到相关信息(可能是我的关键词不对),这些是什么?我能改变它们的位置或禁用它们吗?
2个回答

7
那是Windows帧率计数器。如果您想禁用它,请转到您的App.xaml.cs文件,并从OnLaunched方法中删除/注释掉以下代码:
#if DEBUG
        if (System.Diagnostics.Debugger.IsAttached)
        {
            this.DebugSettings.EnableFrameRateCounter = true;
        }
#endif

谢谢!一个问题。这是 Xamarin 独有的东西吗? - distante
不,这并不是Xamarin独有的,这是你在所有通用Windows应用程序中都会找到的 - 8.x版本、Windows手机和UWP(通用Windows平台)据我所知。 - Frauke

0

我遇到了同样的问题,最终采用了该解决方案。(如果有人不想永久禁用它。)

#if DEBUG
            MessageDialog dialog = new MessageDialog("Activate FPS Counter?");
            dialog.Commands.Add(new UICommand("Yes", null));
            dialog.Commands.Add(new UICommand("No", null));
            dialog.DefaultCommandIndex = 0;
            dialog.CancelCommandIndex = 1;
            var result = await dialog.ShowAsync();

            if (result.Label == "Yes")
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    this.DebugSettings.EnableFrameRateCounter = true;
                }
            }
#endif

不要忘记给Frauke的回答和distante的问题点赞。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接