mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-13 13:15:46 +08:00
Add files via upload
This commit is contained in:
@@ -51,6 +51,8 @@
|
||||
services.AddTransient<Views.Shanghai.OutsideScreenView>();
|
||||
services.AddTransient<ViewModels.Hanzhong.PlatformScreenViewModel>();
|
||||
services.AddTransient<Views.Hanzhong.PlatformScreenView>();
|
||||
services.AddTransient<ViewModels.ZiBo.PrimaryScreenViewModel>();
|
||||
services.AddTransient<Views.ZiBo.PrimaryScreenView>();
|
||||
}).Build();
|
||||
|
||||
[STAThread]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<LangVersion>13.0</LangVersion>
|
||||
<StartupObject>CRSim.App</StartupObject>
|
||||
<ApplicationIcon>Assets\CRSimIcon.ico</ApplicationIcon>
|
||||
<Version>1.2.3.3</Version>
|
||||
<Version>1.2.3.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -45,6 +45,7 @@
|
||||
<Resource Include="Assets\StyleImages\Hanzhong\PlatformScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Harbin\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Shanghai\OutsideScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\ZiBo\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\win11-dashboard.dark.png" />
|
||||
<Resource Include="Assets\win11-dashboard.light.png" />
|
||||
<EmbeddedResource Include="Models\StylesInfoData.json" />
|
||||
@@ -88,6 +89,13 @@
|
||||
<Compile Update="Views\Windows\Stations\Shanghai\OutsideScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Windows\Stations\ZiBo\PrimaryScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</local:HeaderTile>
|
||||
<local:HeaderTile
|
||||
Title="赞助作者"
|
||||
Description="赏作者一口饭吃吧QAQ!传说捐赠者的样式请求会优先满足!"
|
||||
Description="赏作者一口饭吃QAQ"
|
||||
Link="https://afdian.com/a/CRSim"
|
||||
Margin="0 0 6 0">
|
||||
<local:HeaderTile.Source>
|
||||
@@ -65,7 +65,7 @@
|
||||
</local:HeaderTile>
|
||||
<local:HeaderTile
|
||||
Title="开源主页"
|
||||
Description="欢迎贡献代码!当然功能样式请求和Bug反馈也请交到Issue中!"
|
||||
Description="欢迎贡献代码!"
|
||||
Margin="0 0 6 0"
|
||||
Link="https://github.com/denglihong2007/CRSim">
|
||||
<local:HeaderTile.Source>
|
||||
|
||||
@@ -85,5 +85,15 @@
|
||||
"Station",
|
||||
"Platform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "ZiBo PrimaryScreen",
|
||||
"Title": "淄博站主要看板",
|
||||
"Station": "ZiBo",
|
||||
"StyleName": "PrimaryScreenView",
|
||||
"ImagePath": "Assets/StyleImages/ZiBo/PrimaryScreen.png",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,50 @@
|
||||
namespace CRSim.ViewModels.ZiBo
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ObservableCollection<TrainInfo> LeftScreen { get; private set; } = [];
|
||||
public ObservableCollection<TrainInfo> RightScreen { get; private set; } = [];
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 8;
|
||||
PageCount = 2;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Initialize();
|
||||
}
|
||||
private async void Initialize()
|
||||
{
|
||||
await WaitForDataLoadAsync();
|
||||
RefreshDisplay(null,null);
|
||||
}
|
||||
private void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
int pageCount = (int)Math.Ceiling((double)TrainInfo.Count / (ItemsPerPage * PageCount));
|
||||
LeftScreen.Clear();
|
||||
RightScreen.Clear();
|
||||
int startIndex = CurrentPageIndex * ItemsPerPage * PageCount;
|
||||
var leftItems = TrainInfo.Skip(startIndex).Take(ItemsPerPage).ToList();
|
||||
while (leftItems.Count < ItemsPerPage)
|
||||
{
|
||||
leftItems.Add(new TrainInfo());
|
||||
}
|
||||
foreach (var item in leftItems)
|
||||
{
|
||||
LeftScreen.Add(item);
|
||||
}
|
||||
var rightItems = TrainInfo.Skip(startIndex + ItemsPerPage).Take(ItemsPerPage).ToList();
|
||||
while (rightItems.Count < ItemsPerPage)
|
||||
{
|
||||
rightItems.Add(new TrainInfo());
|
||||
}
|
||||
foreach (var item in rightItems)
|
||||
{
|
||||
RightScreen.Add(item);
|
||||
}
|
||||
CurrentPageIndex = CurrentPageIndex + 1 >= Math.Min(_settings.MaxPages, pageCount) ? 0 : CurrentPageIndex + 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user