From 5054855523d5854ab2a2aa2567be5ed6436b6717 Mon Sep 17 00:00:00 2001 From: sakuraxp Date: Thu, 2 Jun 2022 01:27:02 +0800 Subject: [PATCH 01/25] =?UTF-8?q?feat.=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E4=BC=91=E7=9C=A0=E5=92=8C=E8=87=AA=E5=8A=A8=E5=BE=85?= =?UTF-8?q?=E6=9C=BA=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8CUI=E4=B8=8A?= =?UTF-8?q?=E9=9D=A2=E6=9A=82=E6=9C=AA=E5=90=AF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAsstGui/ViewModels/RootViewModel.cs | 4 +- .../ViewModels/TaskQueueViewModel.cs | 48 +++++++++++++++++++ src/MeoAsstGui/Views/TaskQueueView.xaml | 47 ++++++++++++------ 3 files changed, 82 insertions(+), 17 deletions(-) diff --git a/src/MeoAsstGui/ViewModels/RootViewModel.cs b/src/MeoAsstGui/ViewModels/RootViewModel.cs index 579b932390..b17d06e06f 100644 --- a/src/MeoAsstGui/ViewModels/RootViewModel.cs +++ b/src/MeoAsstGui/ViewModels/RootViewModel.cs @@ -58,7 +58,7 @@ namespace MeoAsstGui //Items.Add(ivm); Items.Add(cvm); Items.Add(svm); - svm.UpdateWindowTitle(); // 在标题栏上显示模拟器和IP端口 必须在 Items.Add(svm)之后执行。 + svm.UpdateWindowTitle(); // 鍦ㄦ爣棰樻爮涓婃樉绀烘ā鎷熷櫒鍜孖P绔彛 蹇呴』鍦 Items.Add(svm)涔嬪悗鎵ц銆 ActiveItem = tvm; } @@ -89,7 +89,7 @@ namespace MeoAsstGui await task; } } - private string _windowTitle; + private string _windowTitle = "MaaAssistantArknights"; public string WindowTitle { get => _windowTitle; diff --git a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs index 843f1f00d6..30a625f40f 100644 --- a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs +++ b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs @@ -421,6 +421,14 @@ namespace MeoAsstGui System.Diagnostics.Process.Start("shutdown.exe", "-a"); } } + if (Hibernate) + { + System.Diagnostics.Process.Start("shutdown.exe", "-h"); + } + if (Suspend) + { + System.Diagnostics.Process.Start("rundll32.exe", "powrprof.dll,SetSuspendState 0,1,0"); + } } private bool _idle = false; @@ -444,6 +452,46 @@ namespace MeoAsstGui set { SetAndNotify(ref _shutdown, value); + + if (value) + { + Hibernate = false; + Suspend = false; + } + } + } + + private bool _hibernate = false; // 浼戠湢 + + public bool Hibernate + { + get { return _hibernate; } + set + { + SetAndNotify(ref _hibernate, value); + + if (value) + { + Shutdown = false; + Suspend = false; + } + } + } + + private bool _suspend = false; // 寰呮満 + + public bool Suspend + { + get { return _suspend; } + set + { + SetAndNotify(ref _suspend, value); + + if (value) + { + Shutdown = false; + Hibernate = false; + } } } diff --git a/src/MeoAsstGui/Views/TaskQueueView.xaml b/src/MeoAsstGui/Views/TaskQueueView.xaml index 8c109de369..3da3eee5b9 100644 --- a/src/MeoAsstGui/Views/TaskQueueView.xaml +++ b/src/MeoAsstGui/Views/TaskQueueView.xaml @@ -19,26 +19,43 @@ - + - + + + + + + + + + + - - - - - - - - - -