Had to stop production as I ran out of copilot credits

This commit is contained in:
minster586
2026-08-15 04:11:52 -04:00
parent 65421eb379
commit 5838d4dcdd
5 changed files with 243 additions and 41 deletions
+36 -1
View File
@@ -2,6 +2,15 @@ namespace PainoBar_Helper
{
public partial class Main : Form
{
// Static event for Pianobar output - accessible to all forms
public static event Action<string>? OnPianobarOutputReceived;
// Static terminal history buffer for StationForm replay
public static List<string> TerminalHistory = new List<string>();
// Static reference to the main instance for accessing PianobarManager
private static Main? _instance;
private readonly ProfileManager _profileManager;
private readonly PianobarManager _pianobarManager;
private OutputManager? _outputManager;
@@ -22,6 +31,8 @@ namespace PainoBar_Helper
{
InitializeComponent();
_instance = this;
_profileManager = new ProfileManager();
_pianobarManager = new PianobarManager();
@@ -52,6 +63,18 @@ namespace PainoBar_Helper
}
}
/// <summary>
/// Sends a command to Pianobar's standard input stream.
/// </summary>
/// <param name="text">The command text to send (newline will be added automatically)</param>
public static void SendStdin(string text)
{
if (_instance?._pianobarManager != null)
{
_instance._pianobarManager.SendCommand(text);
}
}
#region Initialization
private void InitializeMenus()
@@ -83,6 +106,7 @@ namespace PainoBar_Helper
_pianobarManager.SongChanged += PianobarManager_SongChanged;
_pianobarManager.StationChanged += PianobarManager_StationChanged;
_pianobarManager.EventOccurred += PianobarManager_EventOccurred;
_pianobarManager.OutputReceived += PianobarManager_OutputReceived;
// Profile events
_profileManager.ProfilesChanged += ProfileManager_ProfilesChanged;
@@ -240,7 +264,7 @@ namespace PainoBar_Helper
return;
}
var stationForm = new StationForm(_pianobarManager);
var stationForm = new StationForm();
stationForm.ShowDialog(this);
}
@@ -344,6 +368,7 @@ namespace PainoBar_Helper
{
_outputManager?.Stop();
_outputManager = null;
TerminalHistory.Clear(); // Clear history on disconnect
UpdateConnectionStatus(ConnectionStatus.Disconnected);
UpdatePlayPauseButton();
});
@@ -375,6 +400,16 @@ namespace PainoBar_Helper
});
}
private void PianobarManager_OutputReceived(object? sender, string e)
{
// Add to history and forward to static event for StationForm and other subscribers
if (!string.IsNullOrEmpty(e))
{
TerminalHistory.Add(e);
OnPianobarOutputReceived?.Invoke(e);
}
}
private void OutputManager_ActiveStateChanged(object? sender, EventArgs e)
{
Invoke(() =>