perf(WpfGui): 碎石时锁定理智药使用量为9999

This commit is contained in:
status102
2024-02-27 11:09:01 +08:00
parent 1ec93236f6
commit 5581776313
2 changed files with 8 additions and 10 deletions

View File

@@ -2868,8 +2868,6 @@ namespace MaaWpfGui.ViewModels.UI
SetAndNotify(ref _medicineNumber, value);
// If the amount of medicine is 0, the stone is not used.
UseStone = UseStone;
SetFightParams();
ConfigurationHelper.SetValue(ConfigurationKeys.UseMedicineQuantity, MedicineNumber);
}
@@ -2885,18 +2883,15 @@ namespace MaaWpfGui.ViewModels.UI
get => _useStoneWithNull;
set
{
// If the amount of medicine is 0, the stone is not used.
if (!int.TryParse(MedicineNumber, out int result) || result == 0)
{
value = false;
}
SetAndNotify(ref _useStoneWithNull, value);
if (value != false && !UseMedicine)
{
UseMedicineWithNull = null;
}
MedicineNumber = "9999";
NotifyOfPropertyChange(nameof(UseStone));
SetFightParams();
}
}
@@ -2904,7 +2899,8 @@ namespace MaaWpfGui.ViewModels.UI
/// <summary>
/// Gets or sets a value indicating whether to use originiums.
/// </summary>
private bool UseStone
// ReSharper disable once MemberCanBePrivate.Global
public bool UseStone
{
get => UseStoneWithNull != false;
set => UseStoneWithNull = value;

View File

@@ -38,6 +38,7 @@
VerticalContentAlignment="Center"
Content="{DynamicResource UseSanityPotion}"
IsChecked="{Binding UseMedicineWithNull}"
IsEnabled="{c:Binding !UseStone}"
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
Target={x:Type helper:CheckBoxHelper}}"
ToolTip="{DynamicResource CheckBoxesNotSavedAsNull}" />
@@ -70,6 +71,7 @@
HorizontalAlignment="Left"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
IsEnabled="{c:Binding !UseStone}"
Maximum="9999"
Minimum="0"
ValueChanged="NumericUpDown_ValueChanged"
@@ -173,7 +175,7 @@
VerticalContentAlignment="Center"
IsHitTestVisible="{c:Binding !FightTaskRunning}"
ItemsSource="{Binding SeriesList}"
SelectedValue="{Binding Series}"/>
SelectedValue="{Binding Series}" />
</StackPanel>
</Grid>
<Grid Grid.Row="3">