mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 02:55:38 +08:00
@@ -133,8 +133,7 @@ public class TaskQueueViewModel : Screen
|
||||
public void TaskItemSelectionChanged(object? sender = null, NotifyCollectionChangedEventArgs? e = null)
|
||||
{
|
||||
_ = (sender, e);
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
Execute.OnUIThread(() => {
|
||||
int index = 0;
|
||||
foreach (var item in TaskItemViewModels)
|
||||
{
|
||||
@@ -171,8 +170,7 @@ public class TaskQueueViewModel : Screen
|
||||
public bool EnableAfterActionSetting
|
||||
{
|
||||
get => _enableAfterActionSetting;
|
||||
set
|
||||
{
|
||||
set {
|
||||
SetAndNotify(ref _enableAfterActionSetting, value);
|
||||
TaskSettingVisibilityInfo.Instance.Set("AfterAction", value);
|
||||
}
|
||||
@@ -323,8 +321,7 @@ public class TaskQueueViewModel : Screen
|
||||
public TaskQueueViewModel()
|
||||
{
|
||||
_runningState = RunningState.Instance;
|
||||
_runningState.StateChanged += (_, e) =>
|
||||
{
|
||||
_runningState.StateChanged += (_, e) => {
|
||||
Idle = e.Idle;
|
||||
Inited = e.Inited;
|
||||
Stopping = e.Stopping;
|
||||
@@ -340,8 +337,7 @@ public class TaskQueueViewModel : Screen
|
||||
|
||||
private void RunningState_TimeOut(object? sender, string message)
|
||||
{
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
Execute.OnUIThread(() => {
|
||||
AddLog(message, UiLogColor.Warning);
|
||||
ToastNotification.ShowDirect(message);
|
||||
if (!SettingsViewModel.ExternalNotificationSettings.ExternalNotificationSendWhenTimeout)
|
||||
@@ -482,8 +478,7 @@ public class TaskQueueViewModel : Screen
|
||||
UpdateDatePromptAndStagesLocally();
|
||||
|
||||
var delayTime = CalculateRandomDelay();
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
_ = Task.Run(async () => {
|
||||
await Task.Delay(delayTime);
|
||||
await _runningState.UntilIdleAsync(60000);
|
||||
await UpdateDatePromptAndStagesWeb();
|
||||
@@ -507,8 +502,7 @@ public class TaskQueueViewModel : Screen
|
||||
|
||||
_isCheckingForUpdates = true;
|
||||
var delayTime = CalculateRandomDelay();
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
_ = Task.Run(async () => {
|
||||
_logger.Information("waiting for update check: {DelayTime}", delayTime);
|
||||
await Task.Delay(delayTime);
|
||||
await Instances.VersionUpdateViewModel.VersionUpdateAndAskToRestartAsync();
|
||||
@@ -669,8 +663,7 @@ public class TaskQueueViewModel : Screen
|
||||
delay.TotalMilliseconds);
|
||||
var dialog = HandyControl.Controls.Dialog.Show(dialogUserControl, nameof(Views.UI.RootView));
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
dialogUserControl.Click += (_, _) =>
|
||||
{
|
||||
dialogUserControl.Click += (_, _) => {
|
||||
canceled = true;
|
||||
dialog.Close();
|
||||
tcs.TrySetResult(true);
|
||||
@@ -886,13 +879,11 @@ public class TaskQueueViewModel : Screen
|
||||
/// <param name="toolTip">The toolTip</param>
|
||||
public void AddLog(string? content, string color = UiLogColor.Trace, string weight = "Regular", ToolTip? toolTip = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(content))
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
Execute.OnUIThread(() => {
|
||||
var log = new LogItemViewModel(content, color, weight, toolTip: toolTip);
|
||||
LogItemViewModels.Add(log);
|
||||
switch (color)
|
||||
@@ -915,8 +906,7 @@ public class TaskQueueViewModel : Screen
|
||||
/// </summary>
|
||||
private void ClearLog()
|
||||
{
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
Execute.OnUIThread(() => {
|
||||
LogItemViewModels.Clear();
|
||||
DownloadLogItemViewModel = new(string.Empty);
|
||||
_logger.Information("Main windows log clear.");
|
||||
@@ -932,8 +922,7 @@ public class TaskQueueViewModel : Screen
|
||||
/// <param name="toolTip">Optional tooltip.</param>
|
||||
public void UpdateDownloadLog(string fullText, string? toolTip = null)
|
||||
{
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
Execute.OnUIThread(() => {
|
||||
// Keep download area limited to a single entry.
|
||||
if (string.IsNullOrEmpty(fullText))
|
||||
{
|
||||
@@ -975,8 +964,7 @@ public class TaskQueueViewModel : Screen
|
||||
public bool InverseMode
|
||||
{
|
||||
get => _inverseMode;
|
||||
set
|
||||
{
|
||||
set {
|
||||
SetAndNotify(ref _inverseMode, value);
|
||||
InverseShowText = value ? LocalizationHelper.GetString("Inverse") : LocalizationHelper.GetString("Clear");
|
||||
InverseMenuText = value ? LocalizationHelper.GetString("Clear") : LocalizationHelper.GetString("Inverse");
|
||||
@@ -1431,8 +1419,7 @@ public class TaskQueueViewModel : Screen
|
||||
{
|
||||
_runningState.SetStopping(true);
|
||||
AddLog(LocalizationHelper.GetString("Stopping"));
|
||||
await Task.Run(() =>
|
||||
{
|
||||
await Task.Run(() => {
|
||||
if (!Instances.AsstProxy.AsstStop())
|
||||
{
|
||||
_logger.Warning("Failed to stop Asst");
|
||||
@@ -1605,8 +1592,7 @@ public class TaskQueueViewModel : Screen
|
||||
|
||||
if (mainFightRet && FightTask.UseRemainingSanityStage && !string.IsNullOrEmpty(FightTask.RemainingSanityStage))
|
||||
{
|
||||
var task = new AsstFightTask()
|
||||
{
|
||||
var task = new AsstFightTask() {
|
||||
Stage = FightTask.RemainingSanityStage,
|
||||
MaxTimes = int.MaxValue,
|
||||
Series = 0,
|
||||
@@ -1651,8 +1637,7 @@ public class TaskQueueViewModel : Screen
|
||||
return;
|
||||
}
|
||||
|
||||
var task = new AsstFightTask()
|
||||
{
|
||||
var task = new AsstFightTask() {
|
||||
Stage = FightTask.RemainingSanityStage ?? string.Empty,
|
||||
MaxTimes = int.MaxValue,
|
||||
Series = 0,
|
||||
@@ -1696,8 +1681,7 @@ public class TaskQueueViewModel : Screen
|
||||
public bool Idle
|
||||
{
|
||||
get => _idle;
|
||||
set
|
||||
{
|
||||
set {
|
||||
SetAndNotify(ref _idle, value);
|
||||
if (!value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user