Three explicit buttons: Connect / Go Live / End Stream, shown per state

This commit is contained in:
2026-08-04 10:37:38 -07:00
parent 639e1bb323
commit 4caf7eec8d
2 changed files with 23 additions and 26 deletions
+13 -23
View File
@@ -37,7 +37,7 @@ public class MainViewModel : ViewModelBase
{
OnPropertyChanged(nameof(IsOffline));
OnPropertyChanged(nameof(IsLive));
OnPropertyChanged(nameof(PrimaryButtonText));
OnPropertyChanged(nameof(ShowGoLive));
}
}
}
@@ -69,24 +69,22 @@ public class MainViewModel : ViewModelBase
set
{
if (SetProperty(ref _isYouTubeConnected, value))
OnPropertyChanged(nameof(PrimaryButtonText));
{
OnPropertyChanged(nameof(ShowConnect));
OnPropertyChanged(nameof(ShowGoLive));
}
}
}
/// <summary>
/// Single, context-aware primary button. Follows the user's journey:
/// not connected → connect, connected+idle → go live, live → stop.
/// </summary>
public string PrimaryButtonText => !IsYouTubeConnected
? "Connect to YouTube"
: IsLive
? "Stop Stream"
: "Go Live";
public bool ShowConnect => !IsYouTubeConnected;
public bool ShowGoLive => IsYouTubeConnected && IsOffline;
// Commands
public ICommand AddSceneCommand { get; }
public ICommand RemoveSceneCommand { get; }
public ICommand PrimaryCommand { get; }
public ICommand ConnectCommand { get; }
public ICommand GoLiveCommand { get; }
public ICommand EndStreamCommand { get; }
public MainViewModel()
{
@@ -98,7 +96,9 @@ public class MainViewModel : ViewModelBase
AddSceneCommand = new RelayCommand(_ => AddScene());
RemoveSceneCommand = new RelayCommand(scene => RemoveScene(scene as Scene));
PrimaryCommand = new RelayCommand(_ => PrimaryAction());
ConnectCommand = new RelayCommand(_ => ConnectYouTube());
GoLiveCommand = new RelayCommand(_ => StartStream(), _ => IsYouTubeConnected && IsOffline);
EndStreamCommand = new RelayCommand(_ => StopStream(), _ => IsLive);
// Start with a default scene
AddScene("Scene 1");
@@ -150,14 +150,4 @@ public class MainViewModel : ViewModelBase
// For now, this is a stub
IsYouTubeConnected = false;
}
private void PrimaryAction()
{
if (!IsYouTubeConnected)
ConnectYouTube();
else if (IsLive)
StopStream();
else
StartStream();
}
}