mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-04 16:26:24 +08:00
@@ -32,7 +32,7 @@ namespace CRSim.Core.Models
|
||||
public string UserKey { get; set; } = "";
|
||||
public bool LoadTodayOnly { get; set; } = false;
|
||||
public bool ReopenUnclosedScreensOnLoad { get; set; } = true;
|
||||
|
||||
public int RefreshIntervalSeconds { get; set; } = 1;
|
||||
public List<TrainColor> TrainColors { get; set; } =
|
||||
[
|
||||
new TrainColor { Prefix = "G", Color = Color.Magenta },
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CRSim.Core.Services
|
||||
{
|
||||
_settings = settingsService.GetSettings();
|
||||
|
||||
_oneSecondTimer = new(1000);
|
||||
_oneSecondTimer = new(_settings.RefreshIntervalSeconds * 1000);
|
||||
_oneSecondTimer.Elapsed += OnOneSecondElapsed;
|
||||
|
||||
_twentySecondsTimer = new(_settings.SwitchPageSeconds * 1000);
|
||||
|
||||
@@ -60,6 +60,8 @@ namespace CRSim.ViewModels
|
||||
[ObservableProperty]
|
||||
public partial List<TrainColor> TrainColors { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string RefreshIntervalSeconds { get; set; }
|
||||
#endregion
|
||||
public SettingsPageViewModel(ISettingsService settingsService, IDatabaseService databaseService, IDialogService dialogService, INetworkService networkService)
|
||||
{
|
||||
@@ -82,6 +84,7 @@ namespace CRSim.ViewModels
|
||||
Api = Apis.First(x => x.Name == _settings.Api.Name);
|
||||
MaxPages = _settings.MaxPages.ToString();
|
||||
SwitchPageSeconds = _settings.SwitchPageSeconds.ToString();
|
||||
RefreshIntervalSeconds = _settings.RefreshIntervalSeconds.ToString();
|
||||
UserKey = _settings.UserKey;
|
||||
LoadTodayOnly = _settings.LoadTodayOnly;
|
||||
ReopenUnclosedScreensOnLoad = _settings.ReopenUnclosedScreensOnLoad;
|
||||
@@ -98,6 +101,7 @@ namespace CRSim.ViewModels
|
||||
UpdateSettings(StopCheckInAdvanceDuration, false, value => _settings.StopCheckInAdvanceDuration = TimeSpan.FromMinutes(value));
|
||||
UpdateSettings(MaxPages, false, value => _settings.MaxPages = value);
|
||||
UpdateSettings(SwitchPageSeconds, false, value => _settings.SwitchPageSeconds = value);
|
||||
UpdateSettings(RefreshIntervalSeconds, false, value => _settings.RefreshIntervalSeconds = value);
|
||||
_settings.UserKey = UserKey;
|
||||
_settings.LoadTodayOnly = LoadTodayOnly;
|
||||
_settings.ReopenUnclosedScreensOnLoad = ReopenUnclosedScreensOnLoad;
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
</StackPanel>
|
||||
<TextBlock Text="引导屏模拟" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Margin="0,0,0,12"/>
|
||||
<StackPanel Spacing="4" Margin="0,0,0,24">
|
||||
<controls:SettingsCard Header="数据刷新频率" Description="频率越小,数据刷新越及时,性能消耗越高,建议设为1" HeaderIcon="{winui:FontIcon Glyph=}">
|
||||
<TextBox MaxWidth="72" Text="{x:Bind ViewModel.RefreshIntervalSeconds, Mode=TwoWay}"/>
|
||||
</controls:SettingsCard>
|
||||
<controls:SettingsCard Header="只加载当日车次" Description="不显示明日车次" HeaderIcon="{winui:FontIcon Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LoadTodayOnly, Mode=TwoWay}"/>
|
||||
</controls:SettingsCard>
|
||||
|
||||
Reference in New Issue
Block a user