Files
ytLlive/Models/Scene.cs
T

45 lines
1.1 KiB
C#

using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ytLive.Models;
public class Scene : INotifyPropertyChanged
{
public string Id { get; init; } = Guid.NewGuid().ToString();
private string _name = string.Empty;
private bool _isEditing;
private bool _isHidden;
public string Name
{
get => _name;
set => Set(ref _name, value);
}
public bool IsEditing
{
get => _isEditing;
set => Set(ref _isEditing, value);
}
public bool IsHidden
{
get => _isHidden;
set => Set(ref _isHidden, value);
}
public ObservableCollection<Source> Sources { get; } = new();
public bool IsChatScene { get; init; }
public event PropertyChangedEventHandler? PropertyChanged;
private void Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}