fix: 修复过程中无法删除'退出游戏'任务的问题

This commit is contained in:
DESKTOP-9PHO9TI\kenko
2022-06-26 13:28:35 +08:00
parent 90067a7ad7
commit 2736e2daa4
2 changed files with 26 additions and 7 deletions

View File

@@ -300,6 +300,11 @@ namespace MeoAsstGui
{
isMainTaskQueueAllCompleted = false;
}
if (unique_runned_task == (_latestTaskId.TryGetValue(TaskType.CloseDown, out var closeDownTaskId) ? closeDownTaskId : 0))
{
isMainTaskQueueAllCompleted = false;
_latestTaskId.Clear();
}
}
mainModel.Idle = true;
mainModel.UseStone = false;
@@ -315,7 +320,11 @@ namespace MeoAsstGui
//mainModel.CheckAndShutdown();
mainModel.CheckAfterCompleted();
}
_latestTaskId.Clear();
if (!_latestTaskId.TryGetValue(TaskType.CloseDown, out _))
{
_latestTaskId.Clear();
}
break;
}
}
@@ -884,7 +893,7 @@ namespace MeoAsstGui
{
TaskId id = AsstAppendTaskWithEncoding("CloseDown");
_latestTaskId[TaskType.CloseDown] = id;
return id != 0 && AsstStart();
return id != 0 && !AsstStart();
}
public bool AsstAppendVisit()

View File

@@ -350,11 +350,6 @@ namespace MeoAsstGui
return;
}
if (ActionAfterCompleted == ActionType.StopGame)
{
ret &= asstProxy.AsstStartCloseDown();
}
ret &= asstProxy.AsstStart();
if (ret)
@@ -630,6 +625,21 @@ namespace MeoAsstGui
case ActionType.DoNothing:
break;
case ActionType.StopGame:
var asstProxy = _container.Get<AsstProxy>();
if (!asstProxy.AsstStartCloseDown())
{
Execute.OnUIThread(() =>
{
using (var toast = new ToastNotification("游戏关闭失败"))
{
toast.AppendContentText("请手动关闭游戏")
.Show(lifeTime: 5, row: 2);
}
});
}
break;
case ActionType.ExitSelf:
if (!new ToastNotification().CheckToastSystem())
{