4b9a8e515f
- Sliding pill toggle (green ON / red OFF) replaces checkbox - Geometry mismatch error for custom backgrounds - Backdrop -> Background: C# rename, SQL column rename with migration - Source.IsBackground: new -> override (fixes WPF binding) - Legacy 'Backdrop' display name migrated to 'Background' - Per-scene UseDefaultBackground + CustomBackgroundPath - Asset files renamed backdrop -> background - StagedScene/LiveScene split, thumbnail strip, edit gating - TransitionService (Cut/Fade/Move) - Context menu: Capture Desktop, Refresh Desktop - Resolution badge removed, ON-AIR status light added
53 lines
2.0 KiB
C#
53 lines
2.0 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Windows.Data;
|
|
|
|
namespace ytLive.Models;
|
|
|
|
/// <summary>
|
|
/// The app's five canonical scenes. Scenes are worked on by name; you can delete
|
|
/// them ("work with less"), but the app only ever adds back one of these five —
|
|
/// anything beyond them is OBS territory. The live desktop/game background exists
|
|
/// only in the Live scene.
|
|
/// </summary>
|
|
public static class SceneCatalog
|
|
{
|
|
public const string Starting = "Starting";
|
|
public const string Live = "Live";
|
|
public const string Brb = "BRB";
|
|
public const string Chat = "Chat";
|
|
public const string Ending = "Ending";
|
|
|
|
public static readonly string[] All = { Starting, Live, Brb, Chat, Ending };
|
|
|
|
private static readonly Dictionary<string, string> DisplayNames = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
};
|
|
|
|
public static string DisplayName(string? name)
|
|
=> name != null && DisplayNames.TryGetValue(name.Trim(), out var display) ? display : name ?? string.Empty;
|
|
|
|
public static readonly IValueConverter DisplayNameConverter = new SceneDisplayNameConverter();
|
|
|
|
private sealed class SceneDisplayNameConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> DisplayName(value as string);
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> value ?? string.Empty;
|
|
}
|
|
|
|
public static bool IsCanonical(string? name)
|
|
=> name != null && All.Contains(name.Trim(), StringComparer.OrdinalIgnoreCase);
|
|
|
|
public static bool Is(string? name, string canonical)
|
|
=> name != null && string.Equals(name.Trim(), canonical, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool IsChat(string? name) => Is(name, Chat);
|
|
|
|
/// <summary>Only the Live scene carries the live desktop/game background.</summary>
|
|
public static bool HasBackground(string? name) => Is(name, Live);
|
|
}
|