[英]Unable to override onBackgroundActivated and OnSuspending events in Application class : Winui3
I am creating a winui3 application and having the latest .net SDK 5.0403 but I'm unable to override onBackgroundActivated
, OnSuspending
events in the App class that extends the Application class. I am creating a winui3 application and having the latest .net SDK 5.0403 but I'm unable to override
onBackgroundActivated
, OnSuspending
events in the App class that extends the Application class. I have windows 10(version 19042), Windows.Foundation.UniversalApiContract (v4.0)我有 windows 10(版本 19042),Windows.Foundation.UniversalApiContract (v4.0)
The OnLaunched
method is already overridden in the App.xaml.cs
file that's included in the default WinUI 3 template in Visual Studio. OnLaunched
方法已在App.xaml.cs
文件中重写,该文件包含在 Visual Studio 的默认 WinUI 3 模板中。
And Suspending
is an event that cannot be overriden but handled in the same class/file:并且
Suspending
是一个不能被覆盖但在同一个类/文件中处理的事件:
public partial class App : Application
{
public App()
{
this.InitializeComponent();
Suspending += OnSuspending;
}
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}
private void OnSuspending(object sender, SuspendingEventArgs e)
{
//...
}
private Window m_window;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.