简体   繁体   English

如何从在指定访问模式下运行的UWP应用程序关闭Windows平板电脑?

[英]How to shutdown a windows tablet from a UWP application running in assigned access mode?

I have a UWP app running in assigned access mode on a windows tablet without a physical keyboard. 我有一个UWP应用程序在没有物理键盘的Windows平板电脑上以指定的访问模式运行。 Once the user finishes the operation I want to let the user shutdown the tablet ( Can't Alt+CTRL+DEL and shutdown as there is no physical keyboard). 一旦用户完成操作,我想让用户关闭平板电脑(无法按Alt + CTRL + DEL并关闭,因为没有物理键盘)。 I know there are no API from UWP to shutdown the tablet. 我知道UWP没有关闭平板电脑的API。 but is there any workarounds? 但有没有解决方法? How is Microsoft handling this scenario? Microsoft如何处理此方案?

This is not achievable within UWP application, which runs inside an App Container, and don't have such privilege. 这在UWP应用程序中无法实现,该应用程序在App Container内运行,并且没有此类权限。

However, you can try out the Brokered Windows Runtime Components for side-loaded Windows Store apps. 但是,您可以为侧载Windows应用商店应用试用Brokered Windows运行时组件。 Essentially, it allows you UWP app to call Win32 API hosted in a different process, which runs outside of the App container. 从本质上讲,它允许您使用UWP应用程序调用托管在不同进程中的Win32 API,该进程在App容器外部运行。

Inside your brokered component, you can use below code to shut down your PC. 在您的代理组件中,您可以使用以下代码关闭您的PC。

var psi = new ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);

Below is the brokered WinRT component template for VS2015 https://visualstudiogallery.msdn.microsoft.com/d2e9cac0-66a8-464a-a902-55ae765c8e6e?tduid=(c5f2776eb12ea55b8926d0c075062c9d)(256380)(2459594)(TnL5HPStwNw-gN1OuW5VyKxMyOTAH.bK0w)() 以下是VS2015的代理WinRT组件模板https://visualstudiogallery.msdn.microsoft.com/d2e9cac0-66a8-464a-a902-55ae765c8e6e?tduid=(c5f2776eb12ea55b8926d0c075062c9d)(256380)(2459594)(TnL5HPStwNw-gN1OuW5VyKxMyOTAH.bK0w)( )

Below is a very good example for creating brokered components for UWP, https://xamltips.wordpress.com/2015/11/13/brokered-component-for-uwp-on-windows-10/ 下面是为UWP创建代理组件的一个很好的示例, https: //xamltips.wordpress.com/2015/11/13/brokered-component-for-uwp-on-windows-10/

For more information, see to https://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx 有关详细信息,请参阅https://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx

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

相关问题 从 UWP 应用程序重新启动 windows 平板电脑? - Restart a windows tablet from a UWP application? 检查Windows 8应用程序是否在指定的访问模式下运行 - Check if Windows 8 app is running in assigned access mode Windows UWP模板10和分配的访问/信息亭模式 - Windows UWP Template 10 and Assigned Access/Kiosk Mode 如何从Windows平板电脑UWP应用程序使用数据库? - How to use a Database from a Windows tablet UWP app? 如何在C#Windows窗体项目中设置应用程序关闭模式? - How to Set Application Shutdown Mode in a C# Windows Forms Project? UWP - MessageDialog 在 Windows Phone 和平板电脑模式下使应用程序崩溃 - UWP - MessageDialog crashes the app on Windows Phone and tablet mode 如何访问连接到平板电脑UWP的外部摄像头 - How to access external camera connected to a tablet UWP 如何关闭/重新启动我的UWP应用程序? - How to shutdown/restart my UWP-Application? 如何在Windows窗体应用程序中检测Windows 10何时进入平板电脑模式? - How can I detect when Windows 10 enters tablet mode in a Windows Forms application? 当应用程序在Windows 10中以指定的访问模式运行时,无法显示MessageBox - Can't show MessageBox while app is running in assigned access mode in windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM