diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
index 421bff6ad9..3433005b5c 100644
--- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs
+++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
@@ -113,8 +113,11 @@ public static class ConfigurationKeys
public const string BlockSleepWithScreenOn = "Start.BlockSleepWithScreenOn";
public const string ChooseLevel3 = "Recruit.ChooseLevel3";
+ public const string ToolBoxChooseLevel3Time = "Toolbox.Recruit.ChooseLevel3.Time";
public const string ChooseLevel4 = "Recruit.ChooseLevel4";
+ public const string ToolBoxChooseLevel4Time = "Toolbox.Recruit.ChooseLevel4.Time";
public const string ChooseLevel5 = "Recruit.ChooseLevel5";
+ public const string ToolBoxChooseLevel5Time = "Toolbox.Recruit.ChooseLevel5.Time";
public const string ChooseLevel6 = "Recruit.ChooseLevel6";
public const string AutoSetTime = "Recruit.AutoSetTime";
public const string RecruitmentShowPotential = "Recruit.ShowPotential";
diff --git a/src/MaaWpfGui/ViewModels/UI/ToolboxViewModel.cs b/src/MaaWpfGui/ViewModels/UI/ToolboxViewModel.cs
index 7d9cbcf364..07e9b4c19a 100644
--- a/src/MaaWpfGui/ViewModels/UI/ToolboxViewModel.cs
+++ b/src/MaaWpfGui/ViewModels/UI/ToolboxViewModel.cs
@@ -108,24 +108,12 @@ public class ToolboxViewModel : Screen
#region Recruit
- private string _recruitInfo = LocalizationHelper.GetString("RecruitmentRecognitionTip");
-
///
/// Gets or sets the recruit info.
///
- public string RecruitInfo
- {
- get => _recruitInfo;
- set => SetAndNotify(ref _recruitInfo, value);
- }
+ public string RecruitInfo { get => field; set => SetAndNotify(ref field, value); } = LocalizationHelper.GetString("RecruitmentRecognitionTip");
- private ObservableCollection _recruitResultInlines = [];
-
- public ObservableCollection RecruitResultInlines
- {
- get => _recruitResultInlines;
- set => SetAndNotify(ref _recruitResultInlines, value);
- }
+ public ObservableCollection RecruitResultInlines { get => field; set => SetAndNotify(ref field, value); } = [];
public void UpdateRecruitResult(JArray? resultArray)
{
@@ -227,47 +215,41 @@ public class ToolboxViewModel : Screen
}
}
- private bool _chooseLevel3 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel3, bool.FalseString));
-
///
/// Gets or sets a value indicating whether to choose level 3.
///
public bool ChooseLevel3
{
- get => _chooseLevel3;
+ get => field;
set {
- SetAndNotify(ref _chooseLevel3, value);
+ SetAndNotify(ref field, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ChooseLevel3, value.ToString());
}
- }
-
- private bool _chooseLevel4 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel4, bool.TrueString));
+ } = ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel3, true);
///
/// Gets or sets a value indicating whether to choose level 4.
///
public bool ChooseLevel4
{
- get => _chooseLevel4;
+ get => field;
set {
- SetAndNotify(ref _chooseLevel4, value);
+ SetAndNotify(ref field, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ChooseLevel4, value.ToString());
}
- }
-
- private bool _chooseLevel5 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel5, bool.TrueString));
+ } = ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel4, true);
///
/// Gets or sets a value indicating whether to choose level 5.
///
public bool ChooseLevel5
{
- get => _chooseLevel5;
+ get => field;
set {
- SetAndNotify(ref _chooseLevel5, value);
+ SetAndNotify(ref field, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ChooseLevel5, value.ToString());
}
- }
+ } = ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel5, true);
private bool _chooseLevel6 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel6, bool.TrueString));
@@ -283,6 +265,90 @@ public class ToolboxViewModel : Screen
}
}
+ [PropertyDependsOn(nameof(ChooseLevel3Time))]
+ public int ChooseLevel3Hour
+ {
+ get => ChooseLevel3Time / 60;
+ set => ChooseLevel3Time = (value * 60) + ChooseLevel3Min;
+ }
+
+ [PropertyDependsOn(nameof(ChooseLevel3Time))]
+ public int ChooseLevel3Min
+ {
+ get => (ChooseLevel3Time % 60) / 10 * 10;
+ set => ChooseLevel3Time = (ChooseLevel3Hour * 60) + value;
+ }
+
+ public int ChooseLevel3Time
+ {
+ get => field;
+ set {
+ value = value switch {
+ < 60 => 9 * 60,
+ > 9 * 60 => 60,
+ _ => value / 10 * 10,
+ };
+ SetAndNotify(ref field, value);
+ ConfigurationHelper.SetValue(ConfigurationKeys.ToolBoxChooseLevel3Time, value.ToString());
+ }
+ } = ConfigurationHelper.GetValue(ConfigurationKeys.ToolBoxChooseLevel3Time, 540);
+
+ [PropertyDependsOn(nameof(ChooseLevel4Time))]
+ public int ChooseLevel4Hour
+ {
+ get => ChooseLevel4Time / 60;
+ set => ChooseLevel4Time = (value * 60) + ChooseLevel4Min;
+ }
+
+ [PropertyDependsOn(nameof(ChooseLevel3Time))]
+ public int ChooseLevel4Min
+ {
+ get => (ChooseLevel4Time % 60) / 10 * 10;
+ set => ChooseLevel4Time = (ChooseLevel4Hour * 60) + value;
+ }
+
+ public int ChooseLevel4Time
+ {
+ get => field;
+ set {
+ value = value switch {
+ < 60 => 9 * 60,
+ > 9 * 60 => 60,
+ _ => value / 10 * 10,
+ };
+ SetAndNotify(ref field, value);
+ ConfigurationHelper.SetValue(ConfigurationKeys.ToolBoxChooseLevel4Time, value.ToString());
+ }
+ } = ConfigurationHelper.GetValue(ConfigurationKeys.ToolBoxChooseLevel4Time, 540);
+
+ [PropertyDependsOn(nameof(ChooseLevel5Time))]
+ public int ChooseLevel5Hour
+ {
+ get => ChooseLevel5Time / 60;
+ set => ChooseLevel5Time = (value * 60) + ChooseLevel5Min;
+ }
+
+ [PropertyDependsOn(nameof(ChooseLevel5Time))]
+ public int ChooseLevel5Min
+ {
+ get => (ChooseLevel5Time % 60) / 10 * 10;
+ set => ChooseLevel5Time = (ChooseLevel5Hour * 60) + value;
+ }
+
+ public int ChooseLevel5Time
+ {
+ get => field;
+ set {
+ value = value switch {
+ < 60 => 9 * 60,
+ > 9 * 60 => 60,
+ _ => value / 10 * 10,
+ };
+ SetAndNotify(ref field, value);
+ ConfigurationHelper.SetValue(ConfigurationKeys.ToolBoxChooseLevel5Time, value.ToString());
+ }
+ } = ConfigurationHelper.GetValue(ConfigurationKeys.ToolBoxChooseLevel5Time, 540);
+
private bool _autoSetTime = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.AutoSetTime, bool.TrueString));
///
diff --git a/src/MaaWpfGui/Views/UI/ToolboxView.xaml b/src/MaaWpfGui/Views/UI/ToolboxView.xaml
index 8e20b8de35..ba2c59889b 100644
--- a/src/MaaWpfGui/Views/UI/ToolboxView.xaml
+++ b/src/MaaWpfGui/Views/UI/ToolboxView.xaml
@@ -11,6 +11,7 @@
xmlns:s="https://github.com/canton7/Stylet"
xmlns:uiBehaviors="clr-namespace:MaaWpfGui.Extensions.UIBehaviors"
xmlns:ui_vms="clr-namespace:MaaWpfGui.ViewModels.UI"
+ d:Background="White"
d:DataContext="{d:DesignInstance {x:Type ui_vms:ToolboxViewModel}}"
d:DesignHeight="600"
d:DesignWidth="800"
@@ -107,7 +108,7 @@
Maximum="9"
Minimum="1"
ValueFormat="00"
- Value="{Binding ChooseLevel3Hour, Source={x:Static ui_vms:TaskQueueViewModel.RecruitTask}}" />
+ Value="{Binding ChooseLevel3Hour}" />
+ Value="{Binding ChooseLevel3Min}" />
@@ -132,7 +133,7 @@
Maximum="9"
Minimum="1"
ValueFormat="00"
- Value="{Binding ChooseLevel4Hour, Source={x:Static ui_vms:TaskQueueViewModel.RecruitTask}}" />
+ Value="{Binding ChooseLevel4Hour}" />
+ Value="{Binding ChooseLevel4Min}" />
@@ -157,7 +158,7 @@
Maximum="9"
Minimum="1"
ValueFormat="00"
- Value="{Binding ChooseLevel5Hour, Source={x:Static ui_vms:TaskQueueViewModel.RecruitTask}}" />
+ Value="{Binding ChooseLevel5Hour}" />
+ Value="{Binding ChooseLevel5Min}" />