perf: 自动公招时间属性设置优化 (#11025)

* perf: 招募时间属性设置

* style: format

* style: format
This commit is contained in:
status102
2024-11-02 22:00:21 +08:00
committed by GitHub
parent 59690a7e96
commit 2fe62fcc2d
3 changed files with 41 additions and 40 deletions

View File

@@ -3608,8 +3608,6 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private bool _chooseLevelTimeUpdating;
private int _chooseLevel3Hour = Convert.ToInt32(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel3Time, "9")) / 60;
public int ChooseLevel3Hour
@@ -3617,11 +3615,12 @@ namespace MaaWpfGui.ViewModels.UI
get => _chooseLevel3Hour;
set
{
SetAndNotify(ref _chooseLevel3Hour, value);
if (!_chooseLevelTimeUpdating)
if (!SetAndNotify(ref _chooseLevel3Hour, value))
{
ChooseLevel3Time = (value * 60) + ChooseLevel3Min;
return;
}
ChooseLevel3Time = (value * 60) + ChooseLevel3Min;
}
}
@@ -3632,11 +3631,12 @@ namespace MaaWpfGui.ViewModels.UI
get => _chooseLevel3Min;
set
{
SetAndNotify(ref _chooseLevel3Min, value);
if (!_chooseLevelTimeUpdating)
if (!SetAndNotify(ref _chooseLevel3Min, value))
{
ChooseLevel3Time = (ChooseLevel3Hour * 60) + value;
return;
}
ChooseLevel3Time = (ChooseLevel3Hour * 60) + value;
}
}
@@ -3656,10 +3656,8 @@ namespace MaaWpfGui.ViewModels.UI
SetAndNotify(ref _chooseLevel3Time, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ChooseLevel3Time, value.ToString());
_chooseLevelTimeUpdating = true;
ChooseLevel3Hour = value / 60;
ChooseLevel3Min = value % 60;
_chooseLevelTimeUpdating = false;
SetAndNotify(ref _chooseLevel3Hour, value / 60, nameof(ChooseLevel3Hour));
SetAndNotify(ref _chooseLevel3Min, value % 60, nameof(ChooseLevel3Min));
}
}
@@ -3670,11 +3668,12 @@ namespace MaaWpfGui.ViewModels.UI
get => _chooseLevel4Hour;
set
{
SetAndNotify(ref _chooseLevel4Hour, value);
if (!_chooseLevelTimeUpdating)
if (!SetAndNotify(ref _chooseLevel4Hour, value))
{
ChooseLevel4Time = (value * 60) + ChooseLevel4Min;
return;
}
ChooseLevel4Time = (value * 60) + ChooseLevel4Min;
}
}
@@ -3685,11 +3684,12 @@ namespace MaaWpfGui.ViewModels.UI
get => _chooseLevel4Min;
set
{
SetAndNotify(ref _chooseLevel4Min, value);
if (!_chooseLevelTimeUpdating)
if (!SetAndNotify(ref _chooseLevel4Min, value))
{
ChooseLevel4Time = (ChooseLevel4Hour * 60) + value;
return;
}
ChooseLevel4Time = (ChooseLevel4Hour * 60) + value;
}
}
@@ -3709,10 +3709,8 @@ namespace MaaWpfGui.ViewModels.UI
SetAndNotify(ref _chooseLevel4Time, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ChooseLevel4Time, value.ToString());
_chooseLevelTimeUpdating = true;
ChooseLevel4Hour = value / 60;
ChooseLevel4Min = value % 60;
_chooseLevelTimeUpdating = false;
SetAndNotify(ref _chooseLevel4Hour, value / 60, nameof(ChooseLevel4Hour));
SetAndNotify(ref _chooseLevel4Min, value % 60, nameof(ChooseLevel4Min));
}
}
@@ -3723,11 +3721,12 @@ namespace MaaWpfGui.ViewModels.UI
get => _chooseLevel5Hour;
set
{
SetAndNotify(ref _chooseLevel5Hour, value);
if (!_chooseLevelTimeUpdating)
if (!SetAndNotify(ref _chooseLevel5Hour, value))
{
ChooseLevel5Time = (value * 60) + ChooseLevel5Min;
return;
}
ChooseLevel5Time = (value * 60) + ChooseLevel5Min;
}
}
@@ -3738,11 +3737,12 @@ namespace MaaWpfGui.ViewModels.UI
get => _chooseLevel5Min;
set
{
SetAndNotify(ref _chooseLevel5Min, value);
if (!_chooseLevelTimeUpdating)
if (!SetAndNotify(ref _chooseLevel5Min, value))
{
ChooseLevel5Time = (ChooseLevel5Hour * 60) + value;
return;
}
ChooseLevel5Time = (ChooseLevel5Hour * 60) + value;
}
}
@@ -3762,10 +3762,8 @@ namespace MaaWpfGui.ViewModels.UI
SetAndNotify(ref _chooseLevel5Time, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ChooseLevel5Time, value.ToString());
_chooseLevelTimeUpdating = true;
ChooseLevel5Hour = value / 60;
ChooseLevel5Min = value % 60;
_chooseLevelTimeUpdating = false;
SetAndNotify(ref _chooseLevel5Hour, value / 60, nameof(ChooseLevel5Hour));
SetAndNotify(ref _chooseLevel5Min, value % 60, nameof(ChooseLevel5Min));
}
}

View File

@@ -86,7 +86,7 @@
Minimum="1"
ValueFormat="00"
Value="{Binding RecruitSettingDataContext.ChooseLevel3Hour}" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
Increment="10"
@@ -111,7 +111,7 @@
Minimum="1"
ValueFormat="00"
Value="{Binding RecruitSettingDataContext.ChooseLevel4Hour}" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
Increment="10"
@@ -136,7 +136,7 @@
Minimum="1"
ValueFormat="00"
Value="{Binding RecruitSettingDataContext.ChooseLevel5Hour}" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
Increment="10"
@@ -154,12 +154,15 @@
VerticalAlignment="Bottom"
Content="{DynamicResource AutoSelectLevel6Tags}"
IsChecked="{Binding ChooseLevel6}" />
<StackPanel Orientation="Horizontal" Visibility="{c:Binding RecruitAutoSetTime}" IsEnabled="False">
<StackPanel
IsEnabled="False"
Orientation="Horizontal"
Visibility="{c:Binding RecruitAutoSetTime}">
<hc:NumericUpDown
Width="55"
ValueFormat="00"
Value="9" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
ValueFormat="00"

View File

@@ -76,7 +76,7 @@
Minimum="1"
ValueFormat="00"
Value="{Binding ChooseLevel3Hour}" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
Increment="10"
@@ -99,7 +99,7 @@
Minimum="1"
ValueFormat="00"
Value="{Binding ChooseLevel4Hour}" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
Increment="10"
@@ -122,7 +122,7 @@
Minimum="1"
ValueFormat="00"
Value="{Binding ChooseLevel5Hour}" />
<controls:TextBlock Margin="5">:</controls:TextBlock>
<controls:TextBlock Margin="5" Text=":" />
<hc:NumericUpDown
Width="55"
Increment="10"