perf: 调整位置

This commit is contained in:
status102
2026-01-19 19:25:25 +08:00
parent a6e06dfbb6
commit 67a926b8d4

View File

@@ -1701,21 +1701,29 @@ public class TaskQueueViewModel : Screen
continue;
}
switch (SerializeTask(item))
try
{
case true:
++count;
Instances.TaskQueueViewModel.TaskItemViewModels[index].TaskId = Instances.AsstProxy.TasksStatus.Last().Key;
break;
case false:
taskRet = false;
AddLog(LocalizationHelper.GetStringFormat("TaskAppend.Error", LocalizationHelper.GetString(item.TaskType.ToString()), item.Name), UiLogColor.Error);
Instances.TaskQueueViewModel.TaskItemViewModels[index].Status = (int)Main.TaskStatus.Error;
break;
case null:
AddLog(LocalizationHelper.GetStringFormat("TaskAppend.Skip", LocalizationHelper.GetString(item.TaskType.ToString()), item.Name), UiLogColor.Info);
Instances.TaskQueueViewModel.TaskItemViewModels[index].Status = 4;
break;
switch (SerializeTask(item))
{
case true:
++count;
Instances.TaskQueueViewModel.TaskItemViewModels[index].TaskId = Instances.AsstProxy.TasksStatus.Last().Key;
break;
case false:
taskRet = false;
AddLog(LocalizationHelper.GetStringFormat("TaskAppend.Error", LocalizationHelper.GetString(item.TaskType.ToString()), item.Name), UiLogColor.Error);
Instances.TaskQueueViewModel.TaskItemViewModels[index].Status = (int)Main.TaskStatus.Error;
break;
case null:
AddLog(LocalizationHelper.GetStringFormat("TaskAppend.Skip", LocalizationHelper.GetString(item.TaskType.ToString()), item.Name), UiLogColor.Info);
Instances.TaskQueueViewModel.TaskItemViewModels[index].Status = 4;
break;
}
}
catch (Exception ex)
{
taskRet = false;
AddLog(LocalizationHelper.GetStringFormat("TaskAppend.Error", LocalizationHelper.GetString(item.TaskType.ToString()), item.Name) + "\n" + ex.Message, UiLogColor.Error);
}
}
@@ -2075,15 +2083,7 @@ public class TaskQueueViewModel : Screen
bool? ret = null;
foreach (var instance in _taskViewModelTypes)
{
try
{
ret ??= instance.SerializeTask(task, taskId);
}
catch (Exception ex)
{
Instances.TaskQueueViewModel.AddLog($"SerializeTask failed for {task.TaskType} - {task.Name}: {ex.Message}", UiLogColor.Error);
return false;
}
ret ??= instance.SerializeTask(task, taskId);
}
return ret;
}