修复停止工作导致的循环错误

This commit is contained in:
ZouJin 2024-06-01 13:44:33 +08:00
parent ddb434667f
commit b9d6c98f77
2 changed files with 14 additions and 4 deletions

View File

@ -195,6 +195,7 @@ public class ScheduleTask
public void Start()
{
IsOn = true;
NowIndex = 0;
StartWork();
}
/// <summary>
@ -212,7 +213,16 @@ public class ScheduleTask
AutoReset = false
};
private void WorkTimer_E_FinishWork(Core.WorkTimer.FinishWorkInfo obj) => StartWork();
private void WorkTimer_E_FinishWork(Core.WorkTimer.FinishWorkInfo obj)
{
if (obj.spendtime < obj.work.Time / 2)
Stop();
else
{
RestTime = 1;
RestTimer.Start();
}
}
public Package PackageWork { get; set; }
public Package PackageStudy { get; set; }

View File

@ -92,7 +92,7 @@ public partial class winWorkMenu : WindowX
else
sliderTaskLevel.TickFrequency = 5;
tbtnCurrentPlan.IsChecked = mw.ScheduleTask.PackageWork?.IsActive() == true;
btnStartSchedule.IsChecked = false;
btnStartSchedule.IsChecked = mw.ScheduleTask.IsOn;
AllowChange = true;
combTaskType.SelectedIndex = 0;
@ -472,7 +472,7 @@ public partial class winWorkMenu : WindowX
if (nowselefull.WorkType == Work.WorkType.Work)
{
if (mw.ScheduleTask.PackageWork?.IsActive() == true
&& MessageBoxX.Show("工作套餐已激活,是否替换?".Translate(), "套餐已激活".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.No)
&& MessageBoxX.Show("工作套餐已激活,是否替换?".Translate(), "套餐已激活".Translate(), MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
mw.ScheduleTask.PackageWork = package;
rpnDisplay(mw.ScheduleTask.PackageWork, nowselefull.WorkType);
@ -480,7 +480,7 @@ public partial class winWorkMenu : WindowX
else
{
if (mw.ScheduleTask.PackageStudy?.IsActive() == true
&& MessageBoxX.Show("学习套餐已激活,是否替换?".Translate(), "套餐已激活".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.No)
&& MessageBoxX.Show("学习套餐已激活,是否替换?".Translate(), "套餐已激活".Translate(), MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
mw.ScheduleTask.PackageStudy = package;
rpnDisplay(mw.ScheduleTask.PackageStudy, nowselefull.WorkType);