The above solution will only work for people who install Template10. Common decision -
paste these lines into the constructor of App.xaml.cs
this.LeavingBackground += App_LeavingBackground; this.Resuming += App_Resuming;
It will look like
public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.LeavingBackground += App_LeavingBackground; this.Resuming += App_Resuming; }
These are methods, although you can press TAB and they will be automatically generated.
private void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e) { } private void App_Resuming(object sender, object e) { }
LeavingBackground methods and one that is not mentioned here, EnteredBackground are again added to uwp.
Before these methods, we will use resume and pause saving and restoring ui, but now the recommended place for this work is here. These are also the last places to do work before resuming the application. Thus, the work on these methods should be small ui or other things, such as altering values ββthat are deprecated, since a long held method here will affect the applicationβs startup time when resuming.
Source Windows dev material , Windoes dev material 2
Thank you, and we have a good day.
hispeed
source share