9103ff1fb7
- MVVM architecture (Models, ViewModels, Views, Services, Helpers) - Models: Scene, Source, StreamConfig, StreamHealth, YouTubeChannel, ChatMessage - Services: YouTubeAuthService (OAuth2), YouTubeStreamService (broadcasts/stream health), YouTubeChatService (live chat polling) - ViewModels: MainViewModel with scene management, stream controls, chat - MainWindow with dark theme: scene/source panel, preview area, chat panel, status bar - Version roadmap: v0.1 (scenes, RTMP, OAuth2, chat, health) -> 1.0
25 lines
699 B
C#
25 lines
699 B
C#
using System.Windows.Input;
|
|
|
|
namespace ytLive.Helpers;
|
|
|
|
public class RelayCommand : ICommand
|
|
{
|
|
private readonly Action<object?> _execute;
|
|
private readonly Func<object?, bool>? _canExecute;
|
|
|
|
public RelayCommand(Action<object?> execute, Func<object?, bool>? canExecute = null)
|
|
{
|
|
_execute = execute;
|
|
_canExecute = canExecute;
|
|
}
|
|
|
|
public event EventHandler? CanExecuteChanged
|
|
{
|
|
add => CommandManager.RequerySuggested += value;
|
|
remove => CommandManager.RequerySuggested -= value;
|
|
}
|
|
|
|
public bool CanExecute(object? parameter) => _canExecute?.Invoke(parameter) ?? true;
|
|
public void Execute(object? parameter) => _execute(parameter);
|
|
}
|