diff --git a/MainWindow.xaml b/MainWindow.xaml
index 772565b..0f4f6ec 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -119,38 +119,10 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs
index ed7061c..82989cf 100644
--- a/ViewModels/MainViewModel.cs
+++ b/ViewModels/MainViewModel.cs
@@ -38,6 +38,7 @@ public class MainViewModel : ViewModelBase
OnPropertyChanged(nameof(IsOffline));
OnPropertyChanged(nameof(IsLive));
OnPropertyChanged(nameof(StatusDisplay));
+ OnPropertyChanged(nameof(PrimaryButtonText));
}
}
}
@@ -66,7 +67,11 @@ public class MainViewModel : ViewModelBase
public bool IsYouTubeConnected
{
get => _isYouTubeConnected;
- set => SetProperty(ref _isYouTubeConnected, value);
+ set
+ {
+ if (SetProperty(ref _isYouTubeConnected, value))
+ OnPropertyChanged(nameof(PrimaryButtonText));
+ }
}
public string StatusDisplay => StreamStatus switch
@@ -78,12 +83,20 @@ public class MainViewModel : ViewModelBase
_ => "UNKNOWN"
};
+ ///
+ /// Single, context-aware primary button. Follows the user's journey:
+ /// not connected → connect, connected+idle → go live, live → stop.
+ ///
+ public string PrimaryButtonText => !IsYouTubeConnected
+ ? "Connect to YouTube"
+ : IsLive
+ ? "Stop Stream"
+ : "Go Live";
+
// Commands
public ICommand AddSceneCommand { get; }
public ICommand RemoveSceneCommand { get; }
- public ICommand StartStreamCommand { get; }
- public ICommand StopStreamCommand { get; }
- public ICommand ConnectYouTubeCommand { get; }
+ public ICommand PrimaryCommand { get; }
public MainViewModel()
{
@@ -95,9 +108,7 @@ public class MainViewModel : ViewModelBase
AddSceneCommand = new RelayCommand(_ => AddScene());
RemoveSceneCommand = new RelayCommand(scene => RemoveScene(scene as Scene));
- StartStreamCommand = new RelayCommand(_ => StartStream(), _ => StreamStatus == StreamStatus.Offline);
- StopStreamCommand = new RelayCommand(_ => StopStream(), _ => StreamStatus == StreamStatus.Streaming);
- ConnectYouTubeCommand = new RelayCommand(_ => ConnectYouTube());
+ PrimaryCommand = new RelayCommand(_ => PrimaryAction());
// Start with a default scene
AddScene("Scene 1");
@@ -131,19 +142,16 @@ public class MainViewModel : ViewModelBase
private async void StartStream()
{
StreamStatus = StreamStatus.Connecting;
- OnPropertyChanged(nameof(StatusDisplay));
// TODO: Initialize capture pipeline, encode, and push to RTMP
// For now, simulate connection
await Task.Delay(500);
StreamStatus = StreamStatus.Streaming;
- OnPropertyChanged(nameof(StatusDisplay));
}
private void StopStream()
{
StreamStatus = StreamStatus.Offline;
- OnPropertyChanged(nameof(StatusDisplay));
}
private void ConnectYouTube()
@@ -152,4 +160,14 @@ public class MainViewModel : ViewModelBase
// For now, this is a stub
IsYouTubeConnected = false;
}
+
+ private void PrimaryAction()
+ {
+ if (!IsYouTubeConnected)
+ ConnectYouTube();
+ else if (IsLive)
+ StopStream();
+ else
+ StartStream();
+ }
}