Phase 5-UI: Launcher auf Toolstrip-Modell + SettingsView (Designer-first)
- LauncherForm: lstView-Ansatz entfernt (lstViews/colName/pnlBottom/btnOpen raus). Fenster werden ueber toolstrip_windows-Buttons geoeffnet/fokussiert: btn_settings -> Settings, btn_terminal -> Terminal (Bindung per stabiler View-ID). - statusStrip_info: Live-Status (Trading, Modul-Anzahl, API WSS/Polling) via 1s-Timer. - toolstrip_quickbar bleibt fuer Schnellaktionen (Trading an/aus) reserviert. - Neue SettingsView (UserControl + Designer): ServerSettings-PropertyGrid + Speichern/Neu laden; Verhalten wie bisheriger Settings-Tab. In Program.cs registriert. - Build 0 Fehler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
1781d71983
commit
f112668147
Generated
+82
@@ -0,0 +1,82 @@
|
||||
namespace PolyTraderSharp.Ui.Views
|
||||
{
|
||||
partial class SettingsView
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Vom Komponenten-Designer generierter Code
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pnlTop = new System.Windows.Forms.Panel();
|
||||
this.btnReload = new System.Windows.Forms.Button();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.propertyGrid = new System.Windows.Forms.PropertyGrid();
|
||||
this.pnlTop.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlTop
|
||||
//
|
||||
this.pnlTop.Controls.Add(this.btnReload);
|
||||
this.pnlTop.Controls.Add(this.btnSave);
|
||||
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlTop.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlTop.Name = "pnlTop";
|
||||
this.pnlTop.Size = new System.Drawing.Size(700, 44);
|
||||
this.pnlTop.TabIndex = 0;
|
||||
//
|
||||
// btnReload
|
||||
//
|
||||
this.btnReload.Location = new System.Drawing.Point(140, 8);
|
||||
this.btnReload.Name = "btnReload";
|
||||
this.btnReload.Size = new System.Drawing.Size(120, 28);
|
||||
this.btnReload.TabIndex = 1;
|
||||
this.btnReload.Text = "Neu laden";
|
||||
this.btnReload.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Location = new System.Drawing.Point(12, 8);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(120, 28);
|
||||
this.btnSave.TabIndex = 0;
|
||||
this.btnSave.Text = "Speichern";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// propertyGrid
|
||||
//
|
||||
this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.propertyGrid.Location = new System.Drawing.Point(0, 44);
|
||||
this.propertyGrid.Name = "propertyGrid";
|
||||
this.propertyGrid.Size = new System.Drawing.Size(700, 556);
|
||||
this.propertyGrid.TabIndex = 1;
|
||||
//
|
||||
// SettingsView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.propertyGrid);
|
||||
this.Controls.Add(this.pnlTop);
|
||||
this.Name = "SettingsView";
|
||||
this.Size = new System.Drawing.Size(700, 600);
|
||||
this.pnlTop.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel pnlTop;
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
private System.Windows.Forms.Button btnReload;
|
||||
private System.Windows.Forms.PropertyGrid propertyGrid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using PolyTraderSharp.Models;
|
||||
using PolyTraderSharp.Services;
|
||||
|
||||
namespace PolyTraderSharp.Ui.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Core-Settings-Ansicht: bearbeitet die ServerSettings über ein PropertyGrid.
|
||||
/// Designbar (siehe SettingsView.Designer.cs); Laufzeit-Abhängigkeiten via Initialize.
|
||||
/// Verhalten entspricht dem bisherigen Settings-Tab (Speichern -> XML + Services neu laden).
|
||||
/// </summary>
|
||||
public partial class SettingsView : UserControl
|
||||
{
|
||||
private const string SettingsPath = "server_settings.xml";
|
||||
|
||||
private ServerSettings _settings = new();
|
||||
private ThreemaService? _threema;
|
||||
private MullvadVpnService? _vpn;
|
||||
private TerminalLogger? _logger;
|
||||
|
||||
public SettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
btnSave.Click += (_, _) => Save();
|
||||
btnReload.Click += (_, _) => Reload();
|
||||
}
|
||||
|
||||
public void Initialize(ThreemaService threema, MullvadVpnService vpn, TerminalLogger logger)
|
||||
{
|
||||
_threema = threema;
|
||||
_vpn = vpn;
|
||||
_logger = logger;
|
||||
Reload();
|
||||
}
|
||||
|
||||
private void Reload()
|
||||
{
|
||||
_settings = ServerSettings.Load(SettingsPath);
|
||||
propertyGrid.SelectedObject = _settings;
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
_settings.Save(SettingsPath);
|
||||
_threema?.ReloadSettings();
|
||||
_vpn?.ReloadSettings();
|
||||
_logger?.Info("Server-Einstellungen gespeichert und Services neu geladen.");
|
||||
MessageBox.Show("Server-Einstellungen gespeichert.", "Erfolg",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Fehler beim Speichern: {ex.Message}", "Fehler",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user