简体   繁体   English

从 UWP 应用程序重新启动 windows 平板电脑?

[英]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.我在 Window 10 的平板电脑中以信息亭模式运行 UWP 应用程序。我想从我的应用程序重新启动平板电脑。 My installed UWP SDK version is - 10.0.18362.0.我安装的 UWP SDK 版本是 - 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)) System.UnauthorizedAccessException -(来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))

There is my extensions:有我的扩展:

在此处输入图像描述

I couldn't find Windows IoT Extension there.我在那里找不到 Windows IoT Extension。 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. UPD:我使用 IoT Extension 安装了 SDK 并添加了参考,但它没有帮助。

I'm afraid your tablet doesn't support this operation you want to achieve.恐怕你的平板不支持你想要实现的这个操作。 This API only supports Windows IOT devices.此 API 仅支持 Windows IOT 设备。 It applies to the device with Windows IOT system.适用于带有Windows物联网系统的设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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