WIN10 UWP Restart Software

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.