简体   繁体   中英

Restart a windows tablet from a UWP application?

I have UWP application running at kiosk mode in Tablet with Window 10. I would like to restart Tablet from my app. My installed UWP SDK version is - 10.0.18362.0. So I added into manifest:

<Package
 xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
 xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
 xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
 xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10"
 IgnorableNamespaces="uap mp iot">

  <Capabilities>
     <Capability Name="internetClient" />
     <!-- Add the capability here -->
     <iot:Capability Name="systemManagement" />
     <DeviceCapability Name="wifiControl" />
     <DeviceCapability Name="bluetooth" />

And try to restart system in button event handler:

    private async void OnClick(object sender, RoutedEventArgs e)
    {
        await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
        {
            ShutdownManager.BeginShutdown(ShutdownKind.Restart, TimeSpan.FromSeconds(3));
        });
    }

And I get the error:

System.UnauthorizedAccessException - (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

There is my extensions:

在此处输入图像描述

I couldn't find Windows IoT Extension there. Maybe this is the reason? How can I restart my tablet programmably.

UPD: I installed SDK with IoT Extension and added reference it does't help.

I'm afraid your tablet doesn't support this operation you want to achieve. This API only supports Windows IOT devices. It applies to the device with Windows IOT system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM