Simplify UI labels and dialogs: drop clutter, show Sonic as connected/not connected.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-31 08:19:15 +02:00
co-authored by Cursor
parent f98daec656
commit d20e0df618
8 changed files with 97 additions and 222 deletions
+35 -101
View File
@@ -155,7 +155,7 @@ namespace ZA.CoreService.ESBCertificateManager
{
MessageBox.Show(
this,
"Während einer laufenden Aktion können die Einstellungen nicht geöffnet werden.",
"Aktion läuft.",
"Einstellungen",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
@@ -285,7 +285,7 @@ namespace ZA.CoreService.ESBCertificateManager
MessageBox.Show(
this,
ex.Message,
"SQL-Zugriff fehlgeschlagen",
"Fehler",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
@@ -300,7 +300,7 @@ namespace ZA.CoreService.ESBCertificateManager
MessageBox.Show(
this,
ex.Message,
"Konfiguration ungültig",
"Konfiguration",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}
@@ -315,7 +315,7 @@ namespace ZA.CoreService.ESBCertificateManager
MessageBox.Show(
this,
ex.Message,
"Initialisierung fehlgeschlagen",
"Fehler",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
@@ -561,12 +561,12 @@ namespace ZA.CoreService.ESBCertificateManager
progressPanel.Controls.Add(progressTitle);
// -----------------------------
// 3. Footer unten: Einstellungen + Version
// 3. Footer unten: Einstellungen
// -----------------------------
Panel footerPanel = new Panel
{
Dock = DockStyle.Bottom,
Height = 118,
Height = 68,
Padding = new Padding(18, 8, 12, 8)
};
@@ -600,28 +600,8 @@ namespace ZA.CoreService.ESBCertificateManager
btnSettings.Click += async (_, _) =>
await OpenSettingsAsync();
Label versionLabel = new Label
{
Text = "INTERNAL TOOL",
ForeColor = MutedTextColor,
Font = new Font("Segoe UI", 7.5f, FontStyle.Bold),
AutoSize = true,
Location = new Point(18, 62)
};
Label versionNumber = new Label
{
Text = "Version 0.1.0",
ForeColor = BlueColor,
Font = new Font("Segoe UI", 8),
AutoSize = true,
Location = new Point(18, 82)
};
footerPanel.Controls.Add(footerSeparator);
footerPanel.Controls.Add(btnSettings);
footerPanel.Controls.Add(versionLabel);
footerPanel.Controls.Add(versionNumber);
// Dock-Reihenfolge: Bottom, Top, Top
sidebar.Controls.Add(footerPanel);
@@ -809,27 +789,8 @@ namespace ZA.CoreService.ESBCertificateManager
Location = new Point(3, 43)
};
Label environmentBadge = new Label
{
Text = " UMGEBUNG ",
ForeColor = GoldColor,
BackColor = Color.FromArgb(65, 53, 17),
Font = new Font("Segoe UI", 8, FontStyle.Bold),
AutoSize = true,
Padding = new Padding(7, 6, 7, 6),
Anchor = AnchorStyles.Top | AnchorStyles.Right
};
environmentBadge.Location = new Point(900, 9);
header.Resize += (_, _) =>
{
environmentBadge.Left = header.Width - environmentBadge.Width;
};
header.Controls.Add(title);
header.Controls.Add(subtitle);
header.Controls.Add(environmentBadge);
return header;
}
@@ -946,9 +907,8 @@ namespace ZA.CoreService.ESBCertificateManager
{
MessageBox.Show(
this,
"Bitte wähle eine Zertifikatsdatei in einem der folgenden Formate aus:\n" +
".cer, .crt, .pem, .pfx oder .p12",
"Nicht unterstütztes Dateiformat",
"Ungültiges Dateiformat.",
"Dateiformat",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return;
@@ -1012,8 +972,8 @@ namespace ZA.CoreService.ESBCertificateManager
catch (CryptographicException)
{
MessageBox.Show(
"Das angegebene Passwort ist falsch oder die Datei ist beschädigt.",
"Fehler beim Lesen des Zertifikats",
"Falsches Kennwort oder Datei beschädigt.",
"Zertifikat",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return null;
@@ -1023,8 +983,8 @@ namespace ZA.CoreService.ESBCertificateManager
{
MessageBox.Show(
this,
$"Das Zertifikat konnte nicht gelesen werden.\n\n{ex.Message}",
"Fehler beim Lesen des Zertifikats",
"Zertifikat konnte nicht gelesen werden.",
"Zertifikat",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return null;
@@ -1893,7 +1853,7 @@ namespace ZA.CoreService.ESBCertificateManager
SetStatus($"Vorabprüfung ok {selected.Count} Ziel(e) bereit.", isError: false);
MessageBox.Show(
this,
$"Alle Voraussetzungen sind erfüllt.\nAusgewählte Ziele: {selected.Count}",
"Prüfung OK.",
"Vorabprüfung",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
@@ -1927,13 +1887,9 @@ namespace ZA.CoreService.ESBCertificateManager
return;
}
string targetNames = string.Join(", ", selected.Select(t =>
string.IsNullOrWhiteSpace(t.ContainerName) ? t.Name : t.ContainerName));
DialogResult confirm = MessageBox.Show(
this,
$"Container wirklich neu starten?\n\n" +
$"Ziele: {targetNames}\n\n",
"Neu starten?",
"ESB neu starten",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
@@ -2053,23 +2009,9 @@ namespace ZA.CoreService.ESBCertificateManager
return;
}
string targetSummary = string.Join(
Environment.NewLine,
selectedTargets.Select(target =>
$"• {target.Name}"
+ Environment.NewLine
+ $" Datei → {target.FullTargetPath}"
+ Environment.NewLine
+ $" danach Neustart: {target.ContainerName}"));
DialogResult confirm = MessageBox.Show(
this,
"Zertifikat wirklich austauschen?\n\n"
+ "Ablauf je Ziel:\n"
+ "1) Datei kopieren (Backup der alten Datei)\n"
+ "2) Sonic-Container neu starten (MfApi)\n\n"
+ $"Quelle: {Path.GetFileName(txtCertificatePath.Text)}\n\n"
+ targetSummary,
"Zertifikat austauschen?",
"Austauschen + Neustart",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
@@ -2370,7 +2312,7 @@ namespace ZA.CoreService.ESBCertificateManager
lblSonicStatus = new Label
{
ForeColor = MutedTextColor,
Font = new Font("Segoe UI", 8.5f),
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
AutoSize = true,
MaximumSize = new Size(720, 0),
Location = new Point(392, 108)
@@ -2378,8 +2320,8 @@ namespace ZA.CoreService.ESBCertificateManager
cmbSonicConnection.SelectedIndexChanged += (_, _) => RefreshSonicStatusLine();
lblSonicStatus.Text = "Sonic-Verbindungen werden aus SQL geladen ...";
lblSonicStatus.ForeColor = MutedTextColor;
lblSonicStatus.Text = "nicht verbunden";
lblSonicStatus.ForeColor = RedColor;
card.Controls.Add(sonicLabel);
card.Controls.Add(cmbSonicConnection);
@@ -2390,10 +2332,7 @@ namespace ZA.CoreService.ESBCertificateManager
{
if (_databaseSonicConnections.Count == 0)
{
lblSonicStatus.Text =
"Keine aktive Sonic-Verbindung in SQL konfiguriert.";
lblSonicStatus.ForeColor = GoldColor;
SetSonicConnectionStatus(connected: false);
return;
}
@@ -2409,40 +2348,35 @@ namespace ZA.CoreService.ESBCertificateManager
if (connection is null)
{
lblSonicStatus.Text =
"Die ausgewählte SQL-Verbindung wurde nicht gefunden.";
lblSonicStatus.ForeColor = RedColor;
SetSonicConnectionStatus(connected: false);
return;
}
try
{
string connectionUrl = connection.BuildConnectionUrl();
_ = connection.BuildConnectionUrl();
bool hasCredential =
_credentialsByConnectionId.TryGetValue(
connection.Id,
out SonicCredentialProfile? credential);
_credentialsByConnectionId.ContainsKey(connection.Id);
string credentialInfo = hasCredential
? $"Profil '{credential!.CredentialName}'"
: "sichere Zugangsdaten noch nicht konfiguriert";
lblSonicStatus.Text =
$"{connection.Name}: {connectionUrl}, {credentialInfo}";
lblSonicStatus.ForeColor = hasCredential
? GreenColor
: GoldColor;
SetSonicConnectionStatus(connected: hasCredential);
}
catch (InvalidOperationException ex)
catch (InvalidOperationException)
{
lblSonicStatus.Text = ex.Message;
lblSonicStatus.ForeColor = RedColor;
SetSonicConnectionStatus(connected: false);
}
}
private void SetSonicConnectionStatus(bool connected)
{
lblSonicStatus.Text = connected
? "verbunden"
: "nicht verbunden";
lblSonicStatus.ForeColor = connected
? GreenColor
: RedColor;
}
private void Form1_Load(object sender, EventArgs e)
{