스케줄에
This commit is contained in:
@@ -12,6 +12,7 @@ public sealed class ChannelScheduleItem : ObservableObject
|
||||
private ScheduleQueueItemState _state = ScheduleQueueItemState.Queued;
|
||||
private string _lastError = string.Empty;
|
||||
private DateTimeOffset? _lastPlayedAt;
|
||||
private string _currentRegionLabel = string.Empty;
|
||||
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
@@ -29,6 +30,14 @@ public sealed class ChannelScheduleItem : ObservableObject
|
||||
|
||||
public required int TotalCuts { get; init; }
|
||||
|
||||
public ScheduleRegionScope RegionScope { get; set; } = ScheduleRegionScope.All;
|
||||
|
||||
public string ScheduleElectionType { get; set; } = string.Empty;
|
||||
|
||||
public string RegionLabel { get; set; } = string.Empty;
|
||||
|
||||
public string RegionCode { get; set; } = string.Empty;
|
||||
|
||||
public ScheduleQueueItemState State
|
||||
{
|
||||
get => _state;
|
||||
@@ -56,6 +65,19 @@ public sealed class ChannelScheduleItem : ObservableObject
|
||||
set => SetProperty(ref _lastPlayedAt, value);
|
||||
}
|
||||
|
||||
public string CurrentRegionLabel
|
||||
{
|
||||
get => _currentRegionLabel;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _currentRegionLabel, value))
|
||||
{
|
||||
OnPropertyChanged(nameof(DisplayRegionLabel));
|
||||
OnPropertyChanged(nameof(DisplayName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string StateLabel => State switch
|
||||
{
|
||||
@@ -82,10 +104,32 @@ public sealed class ChannelScheduleItem : ObservableObject
|
||||
public bool CanDelete => State is not ScheduleQueueItemState.OnAir and not ScheduleQueueItemState.Sending;
|
||||
|
||||
[JsonIgnore]
|
||||
public string LastPlayedLabel => LastPlayedAt?.ToString("HH:mm:ss") ?? "아직 송출 안 함";
|
||||
public string LastPlayedLabel => LastPlayedAt?.ToString("HH:mm:ss") ?? "아직 송출 전";
|
||||
|
||||
public static ChannelScheduleItem FromTemplate(FormatTemplateDefinition template)
|
||||
[JsonIgnore]
|
||||
public string SelectionRegionLabel => RegionScope switch
|
||||
{
|
||||
ScheduleRegionScope.All => "전체",
|
||||
ScheduleRegionScope.StationRegions => "선택권역",
|
||||
_ => string.IsNullOrWhiteSpace(RegionLabel) ? "개별 지역" : RegionLabel
|
||||
};
|
||||
|
||||
[JsonIgnore]
|
||||
public string DisplayRegionLabel => string.IsNullOrWhiteSpace(CurrentRegionLabel)
|
||||
? SelectionRegionLabel
|
||||
: CurrentRegionLabel;
|
||||
|
||||
[JsonIgnore]
|
||||
public string DisplayName => $"{FormatName} / {DisplayRegionLabel}";
|
||||
|
||||
public static ChannelScheduleItem FromTemplate(FormatTemplateDefinition template, ScheduleRegionOption? regionOption = null)
|
||||
{
|
||||
var selectedRegion = regionOption ?? new ScheduleRegionOption
|
||||
{
|
||||
Scope = ScheduleRegionScope.All,
|
||||
Label = "전체"
|
||||
};
|
||||
|
||||
return new ChannelScheduleItem
|
||||
{
|
||||
FormatId = template.Id,
|
||||
@@ -94,7 +138,11 @@ public sealed class ChannelScheduleItem : ObservableObject
|
||||
Channel = template.RecommendedChannel,
|
||||
RequiresImage = template.RequiresImage,
|
||||
DefaultCutDurationSeconds = template.Cuts.First().DurationSeconds,
|
||||
TotalCuts = template.Cuts.Count
|
||||
TotalCuts = template.Cuts.Count,
|
||||
RegionScope = selectedRegion.Scope,
|
||||
ScheduleElectionType = selectedRegion.ElectionType,
|
||||
RegionLabel = selectedRegion.Scope == ScheduleRegionScope.Single ? selectedRegion.Label : string.Empty,
|
||||
RegionCode = selectedRegion.DistrictCode
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user