Make uploader window resizable

This commit is contained in:
Emporex committed 2026-10-25 17:55:34 +01:00
1 parent 132d1968c6
commit 5856a11a2c
3 files changed
+38 -8

No files matched your search

+37 -7
View File
@@ -226,6 +226,7 @@ namespace PlasmaTapUploader
{
private readonly CloudConfig config;
private readonly List<string> files = new List<string>();
private readonly Label hintLabel = new Label();
private readonly ListBox fileList = new ListBox();
private readonly Button chooseButton = new Button();
private readonly Button clearButton = new Button();
@@ -233,6 +234,7 @@ namespace PlasmaTapUploader
private readonly ProgressBar progressBar = new ProgressBar();
private readonly Label statusLabel = new Label();
private readonly BackgroundWorker worker = new BackgroundWorker();
private readonly Label remoteHeading = new Label();
private readonly ListView remoteList = new ListView();
private readonly Button refreshButton = new Button();
private readonly Label remoteStatus = new Label();
@@ -245,16 +247,19 @@ namespace PlasmaTapUploader
Font = new Font("Segoe UI", 9);
ClientSize = new Size(650, 650);
StartPosition = FormStartPosition.CenterScreen;
FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false;
FormBorderStyle = FormBorderStyle.Sizable;
MaximizeBox = true;
AllowDrop = true;
var heading = new Label { Text = "TAP-Dateien hier hineinziehen", Font = new Font("Segoe UI", 15, FontStyle.Bold),
AutoSize = true, Location = new Point(20, 17) };
var hint = new Label { Text = "Ziel: Nextcloud " + config.Folder + " | Gleiche Dateinamen werden ersetzt.",
AutoSize = true, Location = new Point(22, 53) };
hintLabel.Text = "Ziel: Nextcloud " + config.Folder + " | Gleiche Dateinamen werden ersetzt.";
hintLabel.Location = new Point(22, 53);
hintLabel.Size = new Size(605, 22);
hintLabel.AutoEllipsis = true;
fileList.Location = new Point(22, 82);
fileList.Size = new Size(605, 228);
fileList.IntegralHeight = false;
fileList.AllowDrop = true;
chooseButton.Text = "Dateien auswaehlen...";
chooseButton.Location = new Point(22, 322);
@@ -271,8 +276,10 @@ namespace PlasmaTapUploader
statusLabel.Location = new Point(22, 390);
statusLabel.Size = new Size(605, 28);
statusLabel.AutoEllipsis = true;
var remoteHeading = new Label { Text = "Programme in Nextcloud", Font = new Font("Segoe UI", 12, FontStyle.Bold),
AutoSize = true, Location = new Point(22, 432) };
remoteHeading.Text = "Programme in Nextcloud";
remoteHeading.Font = new Font("Segoe UI", 12, FontStyle.Bold);
remoteHeading.AutoSize = true;
remoteHeading.Location = new Point(22, 432);
refreshButton.Text = "Aktualisieren";
refreshButton.Location = new Point(522, 430);
refreshButton.Size = new Size(105, 29);
@@ -288,8 +295,11 @@ namespace PlasmaTapUploader
remoteStatus.Location = new Point(22, 612);
remoteStatus.Size = new Size(605, 25);
remoteStatus.AutoEllipsis = true;
Controls.AddRange(new Control[] { heading, hint, fileList, chooseButton, clearButton, uploadButton,
Controls.AddRange(new Control[] { heading, hintLabel, fileList, chooseButton, clearButton, uploadButton,
progressBar, statusLabel, remoteHeading, refreshButton, remoteList, remoteStatus });
MinimumSize = Size;
ClientSizeChanged += delegate { LayoutControls(); };
LayoutControls();
DragEnter += OnDragEnter;
DragDrop += OnDragDrop;
@@ -332,6 +342,26 @@ namespace PlasmaTapUploader
worker.RunWorkerCompleted += UploadCompleted;
}
private void LayoutControls()
{
int contentWidth = ClientSize.Width - 45;
int extraHeight = Math.Max(0, ClientSize.Height - 650);
int upperExtra = extraHeight / 2;
int lowerExtra = extraHeight - upperExtra;
hintLabel.Width = contentWidth;
fileList.SetBounds(22, 82, contentWidth, 228 + upperExtra);
chooseButton.Top = clearButton.Top = uploadButton.Top = 322 + upperExtra;
uploadButton.Left = ClientSize.Width - 23 - uploadButton.Width;
progressBar.SetBounds(22, 365 + upperExtra, contentWidth, 15);
statusLabel.SetBounds(22, 390 + upperExtra, contentWidth, 28);
refreshButton.SetBounds(ClientSize.Width - 23 - refreshButton.Width, 430 + upperExtra, 105, 29);
remoteHeading.Top = 432 + upperExtra;
remoteList.SetBounds(22, 467 + upperExtra, contentWidth, 136 + lowerExtra);
remoteList.Columns[0].Width = Math.Max(355, contentWidth - 250);
remoteStatus.SetBounds(22, 612 + extraHeight, contentWidth, 25);
}
private void RefreshPrograms()
{
if (listWorker.IsBusy) return;