Three explicit buttons: Connect / Go Live / End Stream, shown per state
This commit is contained in:
+13
-23
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user