From 90347ebb3f28ea46ce998a45b7e41bdba5c34f48 Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Sat, 18 Feb 2023 17:22:23 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=80=9A=E8=BF=87TryParse=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=95=B0=E9=87=8F=E8=80=8C=E4=B8=8D=E6=98=AF=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/TaskQueueViewModel.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/MaaWpfGui/Main/TaskQueueViewModel.cs b/src/MaaWpfGui/Main/TaskQueueViewModel.cs index 21a85fff3f..e6328a2075 100644 --- a/src/MaaWpfGui/Main/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/Main/TaskQueueViewModel.cs @@ -1850,12 +1850,10 @@ namespace MaaWpfGui return; } - if (value == "0" || !int.TryParse(value, out _)) - { - UseStone = false; - } - SetAndNotify(ref _medicineNumber, value); + + // If the amount of medicine is 0, the stone is not used. + UseStone = UseStone; SetFightParams(); ViewStatusStorage.Set("MainFunction.UseMedicine.Quantity", MedicineNumber); } @@ -1871,7 +1869,8 @@ namespace MaaWpfGui get => _useStone; set { - if (MedicineNumber == "0") + // If the amount of medicine is 0, the stone is not used. + if (!int.TryParse(MedicineNumber, out int result) || result == 0) { value = false; }