Merge pull request #1825 from Hydrogina/dev

feat: 添加完成后选项 退出并关闭模拟器并休眠
This commit is contained in:
MistEO
2022-09-12 20:42:51 +08:00
committed by GitHub
6 changed files with 30 additions and 2 deletions

View File

@@ -180,6 +180,7 @@
<system:String x:Key="CloseEmulator">Close Emulator</system:String>
<system:String x:Key="ExitMAAAndCloseEmulator">Exit and Close Emulator</system:String>
<system:String x:Key="Hibernate">Hibernate*</system:String>
<system:String x:Key="ExitMAAAndCloseEmulatorAndHibernate">Exit and Close Emulator and Hibernate*</system:String>
<system:String x:Key="Shutdown">Shutdown*</system:String>
<system:String x:Key="LinkStart">Link Start!</system:String>

View File

@@ -180,6 +180,7 @@
<system:String x:Key="CloseEmulator">エミュレータを終了する</system:String>
<system:String x:Key="ExitMAAAndCloseEmulator">MAAとエミュレータを終了する</system:String>
<system:String x:Key="Hibernate">休止状態にする*</system:String>
<system:String x:Key="ExitMAAAndCloseEmulatorAndHibernate">MAAとエミューレータを終了し、PCをスリープさせる*</system:String>
<system:String x:Key="Shutdown">シャットダウン*</system:String>
<system:String x:Key="LinkStart">Link Start!</system:String><!--分かりやすく動作開始でも良い気はする-->

View File

@@ -180,6 +180,7 @@
<system:String x:Key="CloseEmulator">关闭模拟器</system:String>
<system:String x:Key="ExitMAAAndCloseEmulator">退出并关闭模拟器</system:String>
<system:String x:Key="Hibernate">休眠*</system:String>
<system:String x:Key="ExitMAAAndCloseEmulatorAndHibernate">退出并关闭模拟器并休眠*</system:String>
<system:String x:Key="Shutdown">关机*</system:String>
<system:String x:Key="LinkStart">Link Start!</system:String>

View File

@@ -180,6 +180,7 @@
<system:String x:Key="CloseEmulator">關閉模擬器</system:String>
<system:String x:Key="ExitMAAAndCloseEmulator">退出並關閉模擬器</system:String>
<system:String x:Key="Hibernate">休眠*</system:String>
<system:String x:Key="ExitMAAAndCloseEmulatorAndHibernate">退出並關閉模擬器並休眠*</system:String>
<system:String x:Key="Shutdown">關機*</system:String>
<system:String x:Key="LinkStart">Link Start!</system:String>

View File

@@ -88,7 +88,7 @@ namespace MeoAsstGui
{
SetAndNotify(ref _actionAfterCompleted, value.ToString());
string storeValue = ActionType.DoNothing.ToString();
if (value != ActionType.Shutdown && value != ActionType.Hibernate)
if (value != ActionType.Shutdown && value != ActionType.Hibernate && value != ActionType.ExitMAAAndCloseEmulatorAndHibernate)
{
storeValue = value.ToString();
}
@@ -270,6 +270,7 @@ namespace MeoAsstGui
// new GenericCombData<ActionTypeAfterCompleted>{ Display="待机",Value=ActionTypeAfterCompleted.Suspend },
new GenericCombData<ActionType> { Display = Localization.GetString("Hibernate"), Value = ActionType.Hibernate },
new GenericCombData<ActionType> { Display = Localization.GetString("ExitMAAAndCloseEmulatorAndHibernate"), Value = ActionType.ExitMAAAndCloseEmulatorAndHibernate },
new GenericCombData<ActionType> { Display = Localization.GetString("Shutdown"), Value = ActionType.Shutdown },
};
var temp_order_list = new List<DragItemViewModel>(new DragItemViewModel[task_list.Length]);
@@ -1090,6 +1091,11 @@ namespace MeoAsstGui
/// </summary>
Hibernate,
/// <summary>
/// Exits MAA and emulator and computer hibernates.
/// </summary>
ExitMAAAndCloseEmulatorAndHibernate,
/// <summary>
/// Computer shutdown.
/// </summary>
@@ -1168,6 +1174,24 @@ namespace MeoAsstGui
Process.Start("shutdown.exe", "-h");
break;
case ActionType.ExitMAAAndCloseEmulatorAndHibernate:
if (!killEumlatorbyWindow())
{
AddLog(Localization.GetString("CloseEmulatorFailed"), LogColor.Error);
}
// 休眠提示
AddLog(Localization.GetString("HibernatePrompt"), LogColor.Error);
// 休眠不能加时间参数https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1133
Process.Start("shutdown.exe", "-h");
// Shutdown 会调用 OnExit 但 Exit 不会
Application.Current.Shutdown();
// Environment.Exit(0);
break;
default:
break;
}

View File

@@ -125,7 +125,7 @@
TextWrapping="Wrap" />
<ComboBox
Grid.Column="1"
Width="120"
Width="155"
Margin="5"
DisplayMemberPath="Display"
ItemsSource="{Binding ActionAfterCompletedList}"