mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-10 19:46:08 +08:00
Keep dev-3.0 content, discard master changes
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
namespace CRSim.ScreenSimulator.Models
|
||||
{
|
||||
public class ScreenInfo
|
||||
{
|
||||
public required Guid SessionID { get; set; }
|
||||
public required string SelectedStyle { get; set; }
|
||||
public string? Text { get; set; }
|
||||
public string? Video { get; set; }
|
||||
public string? SelectedStationName { get; set; }
|
||||
public string? SelectedTicketCheck { get; set; }
|
||||
public string? SelectedPlatformName { get; set; }
|
||||
public int? SelectedLoaction { get; set; }
|
||||
}
|
||||
}
|
||||
17
CRSim.ScreenSimulator/Models/Session.cs
Normal file
17
CRSim.ScreenSimulator/Models/Session.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using CRSim.Core.Models;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Models
|
||||
{
|
||||
public class Session
|
||||
{
|
||||
public required Guid ID { get; set; }
|
||||
public required string StyleName { get; set; }
|
||||
public required DateTime SimulateTime { get; set; }
|
||||
public string? Text { get; set; }
|
||||
public Uri? Video { get; set; }
|
||||
public Station? Station { get; set; }
|
||||
public TicketCheck? TicketCheck { get; set; }
|
||||
public string? PlatformName { get; set; }
|
||||
public int? Loaction { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Models
|
||||
{
|
||||
public class StylesInfoDataItem
|
||||
{
|
||||
public string UniqueId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Region { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string Type { get; set; }
|
||||
public Type ViewType
|
||||
{
|
||||
get
|
||||
{
|
||||
string type = $"CRSim.ScreenSimulator.Views.{UniqueId}View";
|
||||
return Assembly.Load("CRSim.ScreenSimulator").GetType(type);
|
||||
}
|
||||
}
|
||||
|
||||
public Uri ImageSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Uri($"pack://application:,,,/CRSim.ScreenSimulator;component/Assets/{UniqueId.Replace('.', '/')}.png");
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> Parameters { get; set; } = [];
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Title;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class StylesInfoDataSource
|
||||
{
|
||||
|
||||
#region Singleton
|
||||
|
||||
private static readonly StylesInfoDataSource _instance;
|
||||
|
||||
public static StylesInfoDataSource Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
static StylesInfoDataSource()
|
||||
{
|
||||
_instance = new StylesInfoDataSource();
|
||||
}
|
||||
|
||||
private StylesInfoDataSource()
|
||||
{
|
||||
var jsonText = ReadStylesData();
|
||||
StylesInfo = JsonSerializer.Deserialize<List<StylesInfoDataItem>>(jsonText);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ICollection<StylesInfoDataItem> StylesInfo { get; }
|
||||
|
||||
private static string ReadStylesData()
|
||||
{
|
||||
var assembly = typeof(StylesInfoDataSource).Assembly;
|
||||
var resourceName = "CRSim.ScreenSimulator.Models.StylesInfoData.json";
|
||||
|
||||
using var stream = assembly.GetManifestResourceStream(resourceName);
|
||||
using var reader = new System.IO.StreamReader(stream);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
|
||||
public ICollection<string> GetParametersInfo(Type type)
|
||||
{
|
||||
return StylesInfo.FirstOrDefault(x => x.ViewType == type)?.Parameters;
|
||||
}
|
||||
|
||||
public string GetStyleName(Type type)
|
||||
{
|
||||
return StylesInfo.FirstOrDefault(x => x.ViewType == type)?.Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,34 @@
|
||||
public string TrainNumber { get; set; }
|
||||
public string Origin { get; set; }
|
||||
public string Terminal { get; set; }
|
||||
public DateTime? ArrivalTime { get; set; }
|
||||
public DateTime? DepartureTime { get; set; }
|
||||
private DateTime? arrivalTime { get; set; }
|
||||
private DateTime? departureTime { get; set; }
|
||||
public DateTime? ArrivalTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return State is null ? arrivalTime : arrivalTime + State;
|
||||
}
|
||||
set
|
||||
{
|
||||
arrivalTime = value;
|
||||
}
|
||||
}
|
||||
public DateTime? DepartureTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return State is null ? departureTime : departureTime + State;
|
||||
}
|
||||
set
|
||||
{
|
||||
departureTime = value;
|
||||
}
|
||||
}
|
||||
public List<string> TicketChecks { get; set; }
|
||||
public string WaitingArea { get; set; }
|
||||
public string Platform { get; set; }
|
||||
public TimeSpan State { get; set; }
|
||||
public TimeSpan? State { get; set; }
|
||||
public string? Landmark { get; set; }
|
||||
public int Length { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user