Original: win10 uwp restart software
The 16299 support in the software itself restarts, does not need to let the user click Off and then start, although I do not know what the use of this. This article tells you how to get the software off and reopen
The first version you need to use is 16299, and then you can turn the software back on by using the Requestrestartasync method.
Here is the simple software
<StackPanel> <TextBlock Margin="100" HorizontalAlignment="Center" Text="点击上面的按钮重启 林德熙"></TextBlock> <Button HorizontalAlignment="Center" Content="重启" Click="ButtonBase_OnClick"></Button> </StackPanel> privateasyncvoidButtonBase_OnClick(object sender, RoutedEventArgs e) { await CoreApplication.RequestRestartAsync("退出"); }
This method in the Coreapplication, when used can pass parameters, when the software is open to get this parameter
Please look at the code
protectedoverridevoidOnActivated(IActivatedEventArgs args) { base.OnActivated(args); Debugger.Launch(); as LaunchActivatedEventArgs; string str = launchArgs?.Arguments; }
If you need the debug click button to reopen, you need to click Cycle Selection Pending, then reopen
If you need to re-open the software to enter the debugging, you can add the following code in OnLaunched
Debugger.Launch();
Added this code can be in the software to boot into the debugging
How to Restart your App programmatically-building apps for windowsbuilding apps for Windows
This work is licensed under the Creative Commons Attribution-NonCommercial use-Share 4.0 International license agreement in the same way. Welcome to reprint, use, republish, but be sure to keep the article Attribution Lindesi (including Link: http://blog.csdn.net/lindexi_gd), not for commercial purposes, based on the modified works of this article must be issued with the same license. If you have any questions, please contact me.
WIN10 UWP Restart Software