Restart a windows tablet from a UWP application?

0

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:

enter image description here

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.

c#
.net
uwp
uwp-xaml
windowsiot
asked on Stack Overflow Feb 17, 2021 by JDo • edited Feb 17, 2021 by JDo

1 Answer

1

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.

answered on Stack Overflow Feb 18, 2021 by Arya Ding - MSFT

User contributions licensed under CC BY-SA 3.0