Renamed some of the labels for the input data and fix that also had an issue where sometimes the UI would not show the data but the output was not messed with

This commit is contained in:
minster586
2026-09-05 00:48:31 -04:00
parent b0c37b815d
commit 0f43ffe5d7
2 changed files with 109 additions and 73 deletions
+67 -67
View File
@@ -43,11 +43,14 @@
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.time_data_label = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.time_label = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.album_data = new System.Windows.Forms.Label();
this.artist_data = new System.Windows.Forms.Label();
this.title_data = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
@@ -58,9 +61,6 @@
this.profile_drop_box = new System.Windows.Forms.ComboBox();
this.profile_label = new System.Windows.Forms.Label();
this.load_profile_button = new System.Windows.Forms.Button();
this.time_label = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.time_data_label = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.menuStrip2.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -183,9 +183,9 @@
this.groupBox1.Controls.Add(this.time_label);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.album_data);
this.groupBox1.Controls.Add(this.artist_data);
this.groupBox1.Controls.Add(this.title_data);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
@@ -197,6 +197,37 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Song Info";
//
// time_data_label
//
this.time_data_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.time_data_label.Location = new System.Drawing.Point(97, 160);
this.time_data_label.Name = "time_data_label";
this.time_data_label.Size = new System.Drawing.Size(266, 17);
this.time_data_label.TabIndex = 10;
this.time_data_label.Text = "No Data";
this.time_data_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(17, 144);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(357, 16);
this.label9.TabIndex = 9;
this.label9.Text = "――――――――――――――――――――――――――――――――――――――――――――――――――";
this.label9.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// time_label
//
this.time_label.AutoSize = true;
this.time_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.time_label.Location = new System.Drawing.Point(20, 157);
this.time_label.Name = "time_label";
this.time_label.Size = new System.Drawing.Size(63, 24);
this.time_label.TabIndex = 8;
this.time_label.Text = "Time:";
this.time_label.Click += new System.EventHandler(this.label9_Click);
//
// label8
//
this.label8.AutoSize = true;
@@ -216,35 +247,35 @@
this.label7.TabIndex = 6;
this.label7.Text = "――――――――――――――――――――――――――――――――――――――――――――――――――";
//
// label6
// album_data
//
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(99, 121);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(266, 17);
this.label6.TabIndex = 5;
this.label6.Text = "No album";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.album_data.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.album_data.Location = new System.Drawing.Point(99, 121);
this.album_data.Name = "album_data";
this.album_data.Size = new System.Drawing.Size(266, 17);
this.album_data.TabIndex = 5;
this.album_data.Text = "No album";
this.album_data.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label5
// artist_data
//
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(99, 76);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(266, 17);
this.label5.TabIndex = 4;
this.label5.Text = "No artist";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.artist_data.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.artist_data.Location = new System.Drawing.Point(99, 76);
this.artist_data.Name = "artist_data";
this.artist_data.Size = new System.Drawing.Size(266, 17);
this.artist_data.TabIndex = 4;
this.artist_data.Text = "No artist";
this.artist_data.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
// title_data
//
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(99, 33);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(266, 16);
this.label4.TabIndex = 3;
this.label4.Text = "No title";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.title_data.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.title_data.Location = new System.Drawing.Point(99, 33);
this.title_data.Name = "title_data";
this.title_data.Size = new System.Drawing.Size(266, 16);
this.title_data.TabIndex = 3;
this.title_data.Text = "No title";
this.title_data.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
@@ -340,37 +371,6 @@
this.load_profile_button.Text = "Load Profile";
this.load_profile_button.UseVisualStyleBackColor = true;
//
// time_label
//
this.time_label.AutoSize = true;
this.time_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.time_label.Location = new System.Drawing.Point(20, 157);
this.time_label.Name = "time_label";
this.time_label.Size = new System.Drawing.Size(63, 24);
this.time_label.TabIndex = 8;
this.time_label.Text = "Time:";
this.time_label.Click += new System.EventHandler(this.label9_Click);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(17, 144);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(357, 16);
this.label9.TabIndex = 9;
this.label9.Text = "――――――――――――――――――――――――――――――――――――――――――――――――――";
this.label9.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// time_data_label
//
this.time_data_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.time_data_label.Location = new System.Drawing.Point(97, 160);
this.time_data_label.Name = "time_data_label";
this.time_data_label.Size = new System.Drawing.Size(266, 17);
this.time_data_label.TabIndex = 10;
this.time_data_label.Text = "No Data";
this.time_data_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -415,9 +415,9 @@
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label album_data;
private System.Windows.Forms.Label artist_data;
private System.Windows.Forms.Label title_data;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
+42 -6
View File
@@ -193,9 +193,9 @@ namespace RadioDJViewer
if (pauseTimerArtist != null) pauseTimerArtist.Stop();
if (pauseTimerAlbum != null) pauseTimerAlbum.Stop();
if (ShouldScroll(label4, marqueeTextTitle)) marqueeTimerTitle.Start(); else marqueeTimerTitle.Stop();
if (ShouldScroll(label5, marqueeTextArtist)) marqueeTimerArtist.Start(); else marqueeTimerArtist.Stop();
if (ShouldScroll(label6, marqueeTextAlbum)) marqueeTimerAlbum.Start(); else marqueeTimerAlbum.Stop();
if (ShouldScroll(title_data, marqueeTextTitle)) marqueeTimerTitle.Start(); else marqueeTimerTitle.Stop();
if (ShouldScroll(artist_data, marqueeTextArtist)) marqueeTimerArtist.Start(); else marqueeTimerArtist.Stop();
if (ShouldScroll(album_data, marqueeTextAlbum)) marqueeTimerAlbum.Start(); else marqueeTimerAlbum.Stop();
}
private void UpdateMarqueeLabel(Label label, System.Windows.Forms.Timer marqueeTimer, ref System.Windows.Forms.Timer pauseTimer, string text, string labelName, Func<int> getOffset, Action<int> setOffset, Action resetOffset)
@@ -247,17 +247,17 @@ namespace RadioDJViewer
private void MarqueeTimerTitle_Tick(object sender, EventArgs e)
{
UpdateMarqueeLabel(label4, marqueeTimerTitle, ref pauseTimerTitle, marqueeTextTitle, "MarqueeTitle", () => marqueeOffsetTitle, value => marqueeOffsetTitle = value, () => marqueeOffsetTitle = 0);
UpdateMarqueeLabel(title_data, marqueeTimerTitle, ref pauseTimerTitle, marqueeTextTitle, "MarqueeTitle", () => marqueeOffsetTitle, value => marqueeOffsetTitle = value, () => marqueeOffsetTitle = 0);
}
private void MarqueeTimerArtist_Tick(object sender, EventArgs e)
{
UpdateMarqueeLabel(label5, marqueeTimerArtist, ref pauseTimerArtist, marqueeTextArtist, "MarqueeArtist", () => marqueeOffsetArtist, value => marqueeOffsetArtist = value, () => marqueeOffsetArtist = 0);
UpdateMarqueeLabel(artist_data, marqueeTimerArtist, ref pauseTimerArtist, marqueeTextArtist, "MarqueeArtist", () => marqueeOffsetArtist, value => marqueeOffsetArtist = value, () => marqueeOffsetArtist = 0);
}
private void MarqueeTimerAlbum_Tick(object sender, EventArgs e)
{
UpdateMarqueeLabel(label6, marqueeTimerAlbum, ref pauseTimerAlbum, marqueeTextAlbum, "MarqueeAlbum", () => marqueeOffsetAlbum, value => marqueeOffsetAlbum = value, () => marqueeOffsetAlbum = 0);
UpdateMarqueeLabel(album_data, marqueeTimerAlbum, ref pauseTimerAlbum, marqueeTextAlbum, "MarqueeAlbum", () => marqueeOffsetAlbum, value => marqueeOffsetAlbum = value, () => marqueeOffsetAlbum = 0);
}
private void ApiTimer_Tick(object sender, EventArgs e)
@@ -591,6 +591,24 @@ namespace RadioDJViewer
marqueeTextTitle = !string.IsNullOrWhiteSpace(title) ? title : "No title";
marqueeTextArtist = !string.IsNullOrWhiteSpace(artist) ? artist : "No artist";
marqueeTextAlbum = !string.IsNullOrWhiteSpace(album) ? album : "No album";
// Explicitly set label text on UI thread
if (this.InvokeRequired)
{
this.BeginInvoke(new Action(() =>
{
title_data.Text = marqueeTextTitle;
artist_data.Text = marqueeTextArtist;
album_data.Text = marqueeTextAlbum;
}));
}
else
{
title_data.Text = marqueeTextTitle;
artist_data.Text = marqueeTextArtist;
album_data.Text = marqueeTextAlbum;
}
StartMarqueeTimers();
UpdatePlaybackState($"{marqueeTextArtist}|{marqueeTextTitle}", elapsed, duration);
@@ -664,6 +682,24 @@ namespace RadioDJViewer
marqueeTextTitle = "No title";
marqueeTextArtist = "No artist";
marqueeTextAlbum = "No album";
// Explicitly set label text on UI thread in error case
if (this.InvokeRequired)
{
this.BeginInvoke(new Action(() =>
{
title_data.Text = marqueeTextTitle;
artist_data.Text = marqueeTextArtist;
album_data.Text = marqueeTextAlbum;
}));
}
else
{
title_data.Text = marqueeTextTitle;
artist_data.Text = marqueeTextArtist;
album_data.Text = marqueeTextAlbum;
}
StartMarqueeTimers();
playbackTimer.Stop();
_playbackElapsedSeconds = 0;