I have moved the load profile to the main window
This commit is contained in:
48
RadioDJViewer/Main.Designer.cs
generated
48
RadioDJViewer/Main.Designer.cs
generated
@@ -53,6 +53,9 @@
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.uicolor = new System.Windows.Forms.Button();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
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.statusStrip1.SuspendLayout();
|
||||
this.menuStrip2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
@@ -66,7 +69,7 @@
|
||||
this.toolStripStatusLabel2,
|
||||
this.toolStripStatusLabel4,
|
||||
this.toolStripStatusLabel3});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 268);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 314);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(612, 25);
|
||||
this.statusStrip1.TabIndex = 0;
|
||||
@@ -137,7 +140,7 @@
|
||||
this.offToolStripMenuItem});
|
||||
this.loggingToolStripMenuItem.Enabled = false;
|
||||
this.loggingToolStripMenuItem.Name = "loggingToolStripMenuItem";
|
||||
this.loggingToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.loggingToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
|
||||
this.loggingToolStripMenuItem.Text = "Logging";
|
||||
//
|
||||
// onToolStripMenuItem
|
||||
@@ -238,7 +241,7 @@
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(250, 216);
|
||||
this.button1.Location = new System.Drawing.Point(62, 230);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(99, 42);
|
||||
this.button1.TabIndex = 5;
|
||||
@@ -248,7 +251,7 @@
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(392, 216);
|
||||
this.button2.Location = new System.Drawing.Point(180, 230);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(99, 42);
|
||||
this.button2.TabIndex = 6;
|
||||
@@ -259,7 +262,7 @@
|
||||
// uicolor
|
||||
//
|
||||
this.uicolor.Image = global::RadioDJViewer.Properties.Resources.MdiWeatherNight;
|
||||
this.uicolor.Location = new System.Drawing.Point(13, 234);
|
||||
this.uicolor.Location = new System.Drawing.Point(572, 276);
|
||||
this.uicolor.Name = "uicolor";
|
||||
this.uicolor.Size = new System.Drawing.Size(28, 23);
|
||||
this.uicolor.TabIndex = 7;
|
||||
@@ -273,11 +276,41 @@
|
||||
this.pictureBox1.TabIndex = 3;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// profile_drop_box
|
||||
//
|
||||
this.profile_drop_box.FormattingEnabled = true;
|
||||
this.profile_drop_box.Location = new System.Drawing.Point(62, 278);
|
||||
this.profile_drop_box.Name = "profile_drop_box";
|
||||
this.profile_drop_box.Size = new System.Drawing.Size(217, 21);
|
||||
this.profile_drop_box.TabIndex = 8;
|
||||
//
|
||||
// profile_label
|
||||
//
|
||||
this.profile_label.AutoSize = true;
|
||||
this.profile_label.Location = new System.Drawing.Point(12, 281);
|
||||
this.profile_label.Name = "profile_label";
|
||||
this.profile_label.Size = new System.Drawing.Size(44, 13);
|
||||
this.profile_label.TabIndex = 9;
|
||||
this.profile_label.Text = "Profiles:";
|
||||
this.profile_label.Click += new System.EventHandler(this.label7_Click);
|
||||
//
|
||||
// load_profile_button
|
||||
//
|
||||
this.load_profile_button.Location = new System.Drawing.Point(285, 276);
|
||||
this.load_profile_button.Name = "load_profile_button";
|
||||
this.load_profile_button.Size = new System.Drawing.Size(75, 23);
|
||||
this.load_profile_button.TabIndex = 10;
|
||||
this.load_profile_button.Text = "Load Profile";
|
||||
this.load_profile_button.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(612, 293);
|
||||
this.ClientSize = new System.Drawing.Size(612, 339);
|
||||
this.Controls.Add(this.load_profile_button);
|
||||
this.Controls.Add(this.profile_label);
|
||||
this.Controls.Add(this.profile_drop_box);
|
||||
this.Controls.Add(this.uicolor);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
@@ -326,6 +359,9 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem onToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem offToolStripMenuItem;
|
||||
private System.Windows.Forms.Button uicolor;
|
||||
private System.Windows.Forms.ComboBox profile_drop_box;
|
||||
private System.Windows.Forms.Label profile_label;
|
||||
private System.Windows.Forms.Button load_profile_button;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ namespace RadioDJViewer
|
||||
marqueeTimerAlbum.Tick += MarqueeTimerAlbum_Tick;
|
||||
// Wire up dark mode button
|
||||
this.uicolor.Click += Uicolor_Click;
|
||||
this.load_profile_button.Click += load_profile_button_Click;
|
||||
PopulateProfileDropBox();
|
||||
UpdateTheme();
|
||||
// Auto-load profiles if profiles.json exists
|
||||
AutoLoadProfiles();
|
||||
@@ -124,9 +126,28 @@ namespace RadioDJViewer
|
||||
catch { }
|
||||
}
|
||||
|
||||
private int GetVisibleChars(Label label)
|
||||
{
|
||||
// Use the label's actual width and font to estimate visible characters
|
||||
using (Graphics g = label.CreateGraphics())
|
||||
{
|
||||
// Use the full label width for measurement
|
||||
SizeF size = g.MeasureString("W", label.Font);
|
||||
int chars = (int)(label.Width / size.Width);
|
||||
// If the label is single-line, ensure we use the full width
|
||||
return Math.Max(chars, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetLabelTextFull(Label label, string text)
|
||||
{
|
||||
// Always set the full text, and let marquee logic handle scrolling
|
||||
label.Text = text;
|
||||
}
|
||||
|
||||
private void MarqueeTimerTitle_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int visibleChars = 30; // Adjust for label width
|
||||
int visibleChars = GetVisibleChars(label4);
|
||||
if (marqueeTextTitle.Length > visibleChars)
|
||||
{
|
||||
string separator = string.IsNullOrEmpty(marqueeSeparator) ? "" : marqueeSeparator;
|
||||
@@ -152,13 +173,13 @@ namespace RadioDJViewer
|
||||
}
|
||||
else
|
||||
{
|
||||
label4.Text = marqueeTextTitle;
|
||||
SetLabelTextFull(label4, marqueeTextTitle);
|
||||
}
|
||||
}
|
||||
|
||||
private void MarqueeTimerArtist_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int visibleChars = 30;
|
||||
int visibleChars = GetVisibleChars(label5);
|
||||
if (marqueeTextArtist.Length > visibleChars)
|
||||
{
|
||||
string separator = string.IsNullOrEmpty(marqueeSeparator) ? "" : marqueeSeparator;
|
||||
@@ -184,13 +205,13 @@ namespace RadioDJViewer
|
||||
}
|
||||
else
|
||||
{
|
||||
label5.Text = marqueeTextArtist;
|
||||
SetLabelTextFull(label5, marqueeTextArtist);
|
||||
}
|
||||
}
|
||||
|
||||
private void MarqueeTimerAlbum_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int visibleChars = 30;
|
||||
int visibleChars = GetVisibleChars(label6);
|
||||
if (marqueeTextAlbum.Length > visibleChars)
|
||||
{
|
||||
string separator = string.IsNullOrEmpty(marqueeSeparator) ? "" : marqueeSeparator;
|
||||
@@ -216,7 +237,7 @@ namespace RadioDJViewer
|
||||
}
|
||||
else
|
||||
{
|
||||
label6.Text = marqueeTextAlbum;
|
||||
SetLabelTextFull(label6, marqueeTextAlbum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,5 +614,42 @@ namespace RadioDJViewer
|
||||
ApplyThemeRecursive(child, backColor, foreColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void label7_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string GetCurrentProfileName()
|
||||
{
|
||||
return currentProfile;
|
||||
}
|
||||
|
||||
private void PopulateProfileDropBox()
|
||||
{
|
||||
profile_drop_box.Items.Clear();
|
||||
var profileNames = ProfileStorage.GetProfileNames();
|
||||
profile_drop_box.Items.AddRange(profileNames.ToArray());
|
||||
// Set selected item to current profile if available
|
||||
string currentProfile = GetCurrentProfileName();
|
||||
if (!string.IsNullOrEmpty(currentProfile) && profileNames.Contains(currentProfile))
|
||||
profile_drop_box.SelectedItem = currentProfile;
|
||||
else if (profile_drop_box.Items.Count > 0)
|
||||
profile_drop_box.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void load_profile_button_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (profile_drop_box.SelectedItem != null)
|
||||
{
|
||||
var profile = ProfileStorage.LoadProfile(profile_drop_box.SelectedItem.ToString());
|
||||
if (profile != null)
|
||||
{
|
||||
LoadProfile(profile);
|
||||
UpdateStatusBar();
|
||||
MessageBox.Show($"Profile '{profile.Name}' loaded.", "Profile Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
RadioDJViewer/radiodj-restapi-template.Designer.cs
generated
56
RadioDJViewer/radiodj-restapi-template.Designer.cs
generated
@@ -32,7 +32,7 @@
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.ok_button_master = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
@@ -51,12 +51,12 @@
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.textBox7 = new System.Windows.Forms.TextBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.comboBoxScrollSpeed = new System.Windows.Forms.ComboBox();
|
||||
this.textBoxPauseTime = new System.Windows.Forms.TextBox();
|
||||
this.separatingcharacterformatbox = new System.Windows.Forms.TextBox();
|
||||
@@ -64,7 +64,6 @@
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -97,14 +96,14 @@
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "URL Format:";
|
||||
//
|
||||
// button1
|
||||
// ok_button_master
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(35, 584);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(157, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "Save";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.ok_button_master.Location = new System.Drawing.Point(35, 584);
|
||||
this.ok_button_master.Name = "ok_button_master";
|
||||
this.ok_button_master.Size = new System.Drawing.Size(157, 23);
|
||||
this.ok_button_master.TabIndex = 1;
|
||||
this.ok_button_master.Text = "OK";
|
||||
this.ok_button_master.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
@@ -182,7 +181,7 @@
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(60, 419);
|
||||
this.button3.Location = new System.Drawing.Point(90, 419);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(120, 30);
|
||||
this.button3.TabIndex = 8;
|
||||
@@ -191,7 +190,7 @@
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(216, 419);
|
||||
this.button4.Location = new System.Drawing.Point(305, 419);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(120, 30);
|
||||
this.button4.TabIndex = 9;
|
||||
@@ -261,15 +260,6 @@
|
||||
this.textBox6.Size = new System.Drawing.Size(290, 20);
|
||||
this.textBox6.TabIndex = 15;
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(382, 419);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(120, 30);
|
||||
this.button5.TabIndex = 16;
|
||||
this.button5.Text = "Load Profile";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Location = new System.Drawing.Point(23, 269);
|
||||
@@ -319,7 +309,6 @@
|
||||
this.groupBox2.Controls.Add(this.label7);
|
||||
this.groupBox2.Controls.Add(this.label6);
|
||||
this.groupBox2.Controls.Add(this.button6);
|
||||
this.groupBox2.Controls.Add(this.button5);
|
||||
this.groupBox2.Controls.Add(this.groupBox3);
|
||||
this.groupBox2.Controls.Add(this.button4);
|
||||
this.groupBox2.Controls.Add(this.button3);
|
||||
@@ -338,6 +327,15 @@
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Profiles";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(20, 240);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(142, 13);
|
||||
this.label13.TabIndex = 32;
|
||||
this.label13.Text = "Separating Character Format";
|
||||
//
|
||||
// comboBoxScrollSpeed
|
||||
//
|
||||
this.comboBoxScrollSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
@@ -402,15 +400,6 @@
|
||||
this.label12.TabIndex = 27;
|
||||
this.label12.Text = "Separating character format";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(20, 240);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(142, 13);
|
||||
this.label13.TabIndex = 32;
|
||||
this.label13.Text = "Separating Character Format";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -418,7 +407,7 @@
|
||||
this.ClientSize = new System.Drawing.Size(543, 619);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.ok_button_master);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "Form1";
|
||||
@@ -438,7 +427,7 @@
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button ok_button_master;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
@@ -457,7 +446,6 @@
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.TextBox textBox6;
|
||||
private System.Windows.Forms.Button button5;
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label7;
|
||||
|
||||
@@ -32,9 +32,8 @@ namespace RadioDJViewer
|
||||
this.buttonSelectOutputFolder.Click += ButtonSelectOutputFolder_Click;
|
||||
this.button6.Click += ButtonSelectMainImagesFolder_Click;
|
||||
this.button3.Click += button3_Click;
|
||||
this.button1.Click += button1_Click;
|
||||
this.ok_button_master.Click += button1_Click;
|
||||
this.button4.Click += button4_Click;
|
||||
this.button5.Click += button5_Click;
|
||||
this.button2.Click += button2_Click;
|
||||
// Populate profile list on open
|
||||
LoadProfileList();
|
||||
@@ -152,33 +151,6 @@ namespace RadioDJViewer
|
||||
}
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Load Profile (Load Profile button)
|
||||
if (comboBox1.SelectedItem != null)
|
||||
{
|
||||
var profile = ProfileStorage.LoadProfile(comboBox1.SelectedItem.ToString());
|
||||
if (profile != null)
|
||||
{
|
||||
textBox6.Text = profile.Name;
|
||||
textBox2.Text = profile.IP;
|
||||
textBox3.Text = profile.Port;
|
||||
textBox4.Text = profile.Password;
|
||||
outputFolderPath = profile.OutputFolder;
|
||||
mainImagesFolderPath = profile.MainImagesFolder;
|
||||
labelOutputFolderPath.Text = outputFolderPath;
|
||||
label6.Text = mainImagesFolderPath;
|
||||
textBox5.Text = profile.OutputImageName;
|
||||
textBox1.Text = profile.UrlFormat;
|
||||
Main mainForm = Application.OpenForms["Main"] as Main;
|
||||
if (mainForm != null)
|
||||
{
|
||||
mainForm.LoadProfile(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Save (bottom Save button) - save all fields to the currently selected or new profile
|
||||
|
||||
Reference in New Issue
Block a user