mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
@@ -488,7 +488,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (!SettingsViewModel.TimerSettings.TimerModels.Timers[i].IsOn)
|
||||
if (SettingsViewModel.TimerSettings.TimerModels.Timers[i].IsOn == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -547,6 +547,8 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
_logger.Information($"Scheduled start: Timer Index: {configIndex}");
|
||||
await HandleScheduledStart(configIndex);
|
||||
|
||||
SettingsViewModel.TimerSettings.TimerModels.Timers[configIndex].IsOn ??= false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class TimerSettingsUserControlModel : PropertyChangedBase
|
||||
{
|
||||
public class TimerProperties : PropertyChangedBase
|
||||
{
|
||||
public TimerProperties(int timeId, bool isOn, int hour, int min, string? timerConfig)
|
||||
public TimerProperties(int timeId, bool? isOn, int hour, int min, string? timerConfig)
|
||||
{
|
||||
TimerId = timeId;
|
||||
_isOn = isOn;
|
||||
@@ -102,17 +102,14 @@ public class TimerSettingsUserControlModel : PropertyChangedBase
|
||||
|
||||
private readonly string _timerName = LocalizationHelper.GetString("Timer");
|
||||
|
||||
public string TimerName
|
||||
{
|
||||
get => $"{_timerName} {TimerId + 1}";
|
||||
}
|
||||
public string TimerName => $"{_timerName} {TimerId + 1}";
|
||||
|
||||
private bool _isOn;
|
||||
private bool? _isOn;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the timer is set.
|
||||
/// </summary>
|
||||
public bool IsOn
|
||||
public bool? IsOn
|
||||
{
|
||||
get => _isOn;
|
||||
set
|
||||
@@ -174,12 +171,12 @@ public class TimerSettingsUserControlModel : PropertyChangedBase
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Timers[i] = new TimerProperties(
|
||||
i,
|
||||
ConfigurationHelper.GetTimer(i, bool.FalseString) == bool.TrueString,
|
||||
int.Parse(ConfigurationHelper.GetTimerHour(i, $"{i * 3}")),
|
||||
int.Parse(ConfigurationHelper.GetTimerMin(i, "0")),
|
||||
ConfigurationHelper.GetTimerConfig(i, ConfigurationHelper.GetCurrentConfiguration()));
|
||||
var timerState = ConfigurationHelper.GetTimer(i, bool.FalseString);
|
||||
bool? isOn = bool.TryParse(timerState, out bool parsedBool) ? parsedBool : null;
|
||||
var hour = int.Parse(ConfigurationHelper.GetTimerHour(i, $"{i * 3}"));
|
||||
var minute = int.Parse(ConfigurationHelper.GetTimerMin(i, "0"));
|
||||
var config = ConfigurationHelper.GetTimerConfig(i, ConfigurationHelper.GetCurrentConfiguration());
|
||||
Timers[i] = new(i, isOn, hour, minute, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[0].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[0].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[0].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -133,7 +136,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[1].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[1].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[1].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -179,7 +185,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[2].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[2].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[2].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -225,7 +234,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[3].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[3].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[3].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -271,7 +283,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[4].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[4].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[4].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -317,7 +332,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[5].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[5].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[5].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -363,7 +381,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[6].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[6].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[6].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
@@ -409,7 +430,10 @@
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
Content="{Binding TimerModels.Timers[7].TimerName}"
|
||||
IsChecked="{Binding TimerModels.Timers[7].IsOn}" />
|
||||
IsChecked="{Binding TimerModels.Timers[7].IsOn}"
|
||||
MouseRightButtonUp="{s:Action ToggleCheckBoxNullOnRightClick,
|
||||
Target={x:Type helper:CheckBoxHelper}}"
|
||||
ToolTip="{DynamicResource CheckBoxesNotSaved}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:NumericUpDown
|
||||
Width="55"
|
||||
|
||||
Reference in New Issue
Block a user