【发布时间】:2023-04-02 22:35:02
【问题描述】:
我的代码有问题。
表示值已设置,但未使用...
我在 bool _isInBackgroundMode = false; 下得到了漂亮的绿线;
我在这里没有得到什么?
namespace MyApp
{
using Views;
using Windows.UI;
using Windows.UI.ViewManagement;
sealed partial class App : Application
{
bool _isInBackgroundMode = false;
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.EnteredBackground += App_EnteredBackground;
this.LeavingBackground += App_LeavingBackground;
}
private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
{
_isInBackgroundMode = true;
}
private void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e)
{
_isInBackgroundMode = false;
}
【问题讨论】: