From b9d6c98f77ba90e6f8602462e7c1bded9011618d Mon Sep 17 00:00:00 2001 From: ZouJin Date: Sat, 1 Jun 2024 13:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=9C=E6=AD=A2=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=AF=BC=E8=87=B4=E7=9A=84=E5=BE=AA=E7=8E=AF=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows.Interface/ScheduleTask.cs | 12 +++++++++++- VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/VPet-Simulator.Windows.Interface/ScheduleTask.cs b/VPet-Simulator.Windows.Interface/ScheduleTask.cs index a5f08a8..8a78e1a 100644 --- a/VPet-Simulator.Windows.Interface/ScheduleTask.cs +++ b/VPet-Simulator.Windows.Interface/ScheduleTask.cs @@ -195,6 +195,7 @@ public class ScheduleTask public void Start() { IsOn = true; + NowIndex = 0; StartWork(); } /// @@ -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; } diff --git a/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs b/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs index 17850e9..ae60854 100644 --- a/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs @@ -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);