Попытки
- PowerShell
Попытка вызвать команды оболочки, подобные командам Powershellне работает.Код: Выделить всё
Stop-Computer - C#
Поэтому я попытался использовать собственный код C#. Однако это приводит к указанной ниже ошибке:
Код: Выделить всё
ShutdownManager.BeginShutdown(Windows.System.ShutdownKind.Shutdown, TimeSpan.FromSeconds(120));
- [/b]
Код: Выделить всё
MainPage.xaml.cs
Код: Выделить всё
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using System; using Windows.System; // The Blank Page item template is documented at https://learn.microsoft.com/en-us/previous-versions/windows/apps/hh768232(v=win.10)?redirectedfrom=MSDN#project-templates-at-a-glance. // Delete the extra namespaces when the application is complete. namespace Shutdown_Roulette { /// /// An empty page that can be used on its own or navigated to within a Frame. /// public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } private void Button_click(object sender, RoutedEventArgs e) { ShutdownManager.BeginShutdown(Windows.System.ShutdownKind.Shutdown, TimeSpan.FromSeconds(120)); } } } - [/b]
Код: Выделить всё
Package.appxmanifest
Код: Выделить всё
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"> Shutdown Roulette Master Roke Julian Lockhart Beedell Assets\StoreLogo.png
Подробнее здесь: https://stackoverflow.com/questions/648 ... 10-non-iot