From 8bea85a5b143d087a998e779d3c9f0211db76321 Mon Sep 17 00:00:00 2001 From: Andrea Date: Thu, 2 Oct 2025 08:34:35 +0200 Subject: [PATCH] commands overhaul --- SamaPager_Client/Form1.Designer.cs | 46 ++++----- SamaPager_Client/Form1.cs | 10 -- SamaPager_Client/Form1.it-IT.resx | 20 +--- SamaPager_Client/Form1.resx | 134 +++++++++++--------------- SamaPager_Server/MainForm.Designer.cs | 16 +-- SamaPager_Server/Server.cs | 9 +- 6 files changed, 94 insertions(+), 141 deletions(-) diff --git a/SamaPager_Client/Form1.Designer.cs b/SamaPager_Client/Form1.Designer.cs index 2fc5eb4..25cfe24 100644 --- a/SamaPager_Client/Form1.Designer.cs +++ b/SamaPager_Client/Form1.Designer.cs @@ -31,9 +31,8 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.kryptonPanel1 = new Krypton.Toolkit.KryptonPanel(); - this.getDateBtn = new Krypton.Toolkit.KryptonButton(); - this.getTimeBtn = new Krypton.Toolkit.KryptonButton(); - this.kryptonListBox1 = new Krypton.Toolkit.KryptonListBox(); + this.kryptonComboBox1 = new Krypton.Toolkit.KryptonComboBox(); + this.logLst = new Krypton.Toolkit.KryptonListBox(); this.kryptonPictureBox1 = new Krypton.Toolkit.KryptonPictureBox(); this.sendBtn = new Krypton.Toolkit.KryptonButton(); this.kryptonStatusStrip1 = new Krypton.Toolkit.KryptonStatusStrip(); @@ -46,6 +45,7 @@ this.kryptonManager2 = new Krypton.Toolkit.KryptonManager(this.components); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).BeginInit(); this.kryptonPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.kryptonComboBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.kryptonPictureBox1)).BeginInit(); this.kryptonStatusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -53,9 +53,8 @@ // // kryptonPanel1 // - this.kryptonPanel1.Controls.Add(this.getDateBtn); - this.kryptonPanel1.Controls.Add(this.getTimeBtn); - this.kryptonPanel1.Controls.Add(this.kryptonListBox1); + this.kryptonPanel1.Controls.Add(this.kryptonComboBox1); + this.kryptonPanel1.Controls.Add(this.logLst); this.kryptonPanel1.Controls.Add(this.kryptonPictureBox1); this.kryptonPanel1.Controls.Add(this.sendBtn); this.kryptonPanel1.Controls.Add(this.kryptonStatusStrip1); @@ -64,26 +63,21 @@ resources.ApplyResources(this.kryptonPanel1, "kryptonPanel1"); this.kryptonPanel1.Name = "kryptonPanel1"; // - // getDateBtn + // kryptonComboBox1 // - resources.ApplyResources(this.getDateBtn, "getDateBtn"); - this.getDateBtn.Name = "getDateBtn"; - this.getDateBtn.Values.DropDownArrowColor = System.Drawing.Color.Empty; - this.getDateBtn.Values.Text = resources.GetString("getDateBtn.Values.Text"); - this.getDateBtn.Click += new System.EventHandler(this.getDateBtn_Click); + this.kryptonComboBox1.DropDownWidth = 318; + this.kryptonComboBox1.Items.AddRange(new object[] { + resources.GetString("kryptonComboBox1.Items"), + resources.GetString("kryptonComboBox1.Items1"), + resources.GetString("kryptonComboBox1.Items2")}); + resources.ApplyResources(this.kryptonComboBox1, "kryptonComboBox1"); + this.kryptonComboBox1.Name = "kryptonComboBox1"; + this.kryptonComboBox1.StateCommon.ComboBox.Content.TextH = Krypton.Toolkit.PaletteRelativeAlign.Near; // - // getTimeBtn + // logLst // - resources.ApplyResources(this.getTimeBtn, "getTimeBtn"); - this.getTimeBtn.Name = "getTimeBtn"; - this.getTimeBtn.Values.DropDownArrowColor = System.Drawing.Color.Empty; - this.getTimeBtn.Values.Text = resources.GetString("getTimeBtn.Values.Text"); - this.getTimeBtn.Click += new System.EventHandler(this.getTimeBtn_Click); - // - // kryptonListBox1 - // - resources.ApplyResources(this.kryptonListBox1, "kryptonListBox1"); - this.kryptonListBox1.Name = "kryptonListBox1"; + resources.ApplyResources(this.logLst, "logLst"); + this.logLst.Name = "logLst"; // // kryptonPictureBox1 // @@ -163,6 +157,7 @@ ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).EndInit(); this.kryptonPanel1.ResumeLayout(false); this.kryptonPanel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.kryptonComboBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.kryptonPictureBox1)).EndInit(); this.kryptonStatusStrip1.ResumeLayout(false); this.kryptonStatusStrip1.PerformLayout(); @@ -185,9 +180,8 @@ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem changeDestinationAddressToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem restartUDPClientToolStripMenuItem; - private Krypton.Toolkit.KryptonButton getDateBtn; - private Krypton.Toolkit.KryptonButton getTimeBtn; - private Krypton.Toolkit.KryptonListBox kryptonListBox1; + private Krypton.Toolkit.KryptonListBox logLst; + private Krypton.Toolkit.KryptonComboBox kryptonComboBox1; } } diff --git a/SamaPager_Client/Form1.cs b/SamaPager_Client/Form1.cs index 2c6e310..cf3a02c 100644 --- a/SamaPager_Client/Form1.cs +++ b/SamaPager_Client/Form1.cs @@ -59,15 +59,5 @@ namespace SamaPager_Client } } - - private void getTimeBtn_Click(object sender, EventArgs e) - { - pageClient.SendMessage("!time"); - } - - private void getDateBtn_Click(object sender, EventArgs e) - { - pageClient.SendMessage("!date"); - } } } diff --git a/SamaPager_Client/Form1.it-IT.resx b/SamaPager_Client/Form1.it-IT.resx index 65b5c6e..7eb0b11 100644 --- a/SamaPager_Client/Form1.it-IT.resx +++ b/SamaPager_Client/Form1.it-IT.resx @@ -117,27 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Ottieni Data - - - Ottieni Ora - INVIA - 0, 328 + 0, 556 - 650, 22 + 347, 22 - 650, 24 + 347, 24 - 650, 350 + 347, 578 42, 20 @@ -158,10 +152,6 @@ Riavvia il socket UDP - 650, 350 - - - - Inherit + 347, 578 \ No newline at end of file diff --git a/SamaPager_Client/Form1.resx b/SamaPager_Client/Form1.resx index 2fc4295..9e5fab4 100644 --- a/SamaPager_Client/Form1.resx +++ b/SamaPager_Client/Form1.resx @@ -117,83 +117,65 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 349, 78 + + !getDateTime - - 278, 43 + + !getCurrentDir + + + !getCurrentUser + + + + 12, 524 + + + 318, 22 - - 7 - - - Get Date - - - getDateBtn - - - Krypton.Toolkit.KryptonButton, Krypton.Toolkit, Version=95.25.8.235, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e - - - kryptonPanel1 - - - 0 - - - 349, 27 - - - 278, 45 - - + 6 - - Get Time + + kryptonComboBox1 - - getTimeBtn + + Krypton.Toolkit.KryptonComboBox, Krypton.Toolkit, Version=95.25.8.235, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e - - Krypton.Toolkit.KryptonButton, Krypton.Toolkit, Version=95.25.8.235, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e - - + kryptonPanel1 - - 1 + + 0 - - 12, 27 + + 12, 230 - + 318, 215 - + 5 - - kryptonListBox1 + + logLst - + Krypton.Toolkit.KryptonListBox, Krypton.Toolkit, Version=95.25.8.235, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e - + kryptonPanel1 - - 2 + + 1 NoControl - 349, 134 + 31, 38 278, 181 @@ -214,10 +196,10 @@ kryptonPanel1 - 3 + 2 - 250, 248 + 250, 451 80, 67 @@ -238,7 +220,7 @@ kryptonPanel1 - 4 + 3 165, 17 @@ -247,16 +229,16 @@ Segoe UI, 9pt - 68, 17 + 70, 17 STATUS: Off - 0, 326 + 0, 554 - 652, 22 + 344, 22 1 @@ -274,7 +256,7 @@ kryptonPanel1 - 5 + 4 322, 17 @@ -282,18 +264,6 @@ Segoe UI, 9pt - - 220, 22 - - - Change destination address - - - 220, 22 - - - Restart UDP Client - 64, 20 @@ -304,7 +274,7 @@ 0, 0 - 652, 24 + 344, 24 4 @@ -322,10 +292,10 @@ kryptonPanel1 - 6 + 5 - 12, 248 + 12, 451 True @@ -346,7 +316,7 @@ kryptonPanel1 - 7 + 6 Fill @@ -355,7 +325,7 @@ 0, 0 - 652, 348 + 344, 576 0 @@ -372,6 +342,18 @@ 0 + + 220, 22 + + + Change destination address + + + 220, 22 + + + Restart UDP Client + 17, 17 @@ -382,7 +364,7 @@ 6, 13 - 652, 348 + 344, 576 CenterScreen diff --git a/SamaPager_Server/MainForm.Designer.cs b/SamaPager_Server/MainForm.Designer.cs index dbd25b8..7eaa682 100644 --- a/SamaPager_Server/MainForm.Designer.cs +++ b/SamaPager_Server/MainForm.Designer.cs @@ -72,7 +72,7 @@ this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonPanel1.Location = new System.Drawing.Point(0, 0); this.kryptonPanel1.Name = "kryptonPanel1"; - this.kryptonPanel1.Size = new System.Drawing.Size(423, 386); + this.kryptonPanel1.Size = new System.Drawing.Size(427, 374); this.kryptonPanel1.TabIndex = 0; // // logList @@ -89,18 +89,18 @@ this.kryptonStatusStrip1.Font = new System.Drawing.Font("Segoe UI", 9F); this.kryptonStatusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusLabel}); - this.kryptonStatusStrip1.Location = new System.Drawing.Point(0, 364); + this.kryptonStatusStrip1.Location = new System.Drawing.Point(0, 352); this.kryptonStatusStrip1.Name = "kryptonStatusStrip1"; this.kryptonStatusStrip1.ProgressBars = null; this.kryptonStatusStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode; - this.kryptonStatusStrip1.Size = new System.Drawing.Size(423, 22); + this.kryptonStatusStrip1.Size = new System.Drawing.Size(427, 22); this.kryptonStatusStrip1.TabIndex = 3; this.kryptonStatusStrip1.Text = "kryptonStatusStrip1"; // // statusLabel // this.statusLabel.Name = "statusLabel"; - this.statusLabel.Size = new System.Drawing.Size(103, 17); + this.statusLabel.Size = new System.Drawing.Size(105, 17); this.statusLabel.Text = "STATUS: Server Off"; // // menuStrip1 @@ -111,7 +111,7 @@ this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(423, 24); + this.menuStrip1.Size = new System.Drawing.Size(427, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -126,7 +126,7 @@ // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -141,7 +141,7 @@ // infoToolStripMenuItem2 // this.infoToolStripMenuItem2.Name = "infoToolStripMenuItem2"; - this.infoToolStripMenuItem2.Size = new System.Drawing.Size(180, 22); + this.infoToolStripMenuItem2.Size = new System.Drawing.Size(107, 22); this.infoToolStripMenuItem2.Text = "About"; this.infoToolStripMenuItem2.Click += new System.EventHandler(this.infoToolStripMenuItem2_Click); // @@ -192,7 +192,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(423, 386); + this.ClientSize = new System.Drawing.Size(427, 374); this.Controls.Add(this.kryptonPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); diff --git a/SamaPager_Server/Server.cs b/SamaPager_Server/Server.cs index bc95a21..29aee6d 100644 --- a/SamaPager_Server/Server.cs +++ b/SamaPager_Server/Server.cs @@ -40,16 +40,13 @@ namespace SamaPager_Server IPEndPoint receiveEndPoint = ServerEndPoint; byte[] receivedBytes = UdpServer.Receive(ref receiveEndPoint); string receivedMessage = Encoding.UTF8.GetString(receivedBytes); + byte[] bytesToSend; switch (receivedMessage) { - case "!time": - byte[] bytesToSend = Encoding.UTF8.GetBytes($"Hi, it's {DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}"); + case "!getDateTime": + bytesToSend = Encoding.UTF8.GetBytes($"Hi, it's {DateTime.Now}"); this.UdpServer.Send(bytesToSend, bytesToSend.Length, receiveEndPoint); return $"Time command received by {receiveEndPoint}, sent local server time"; - case "!date": - byte[] bytesToSendDate = Encoding.UTF8.GetBytes($"Hi, it's"); - this.UdpServer.Send(bytesToSendDate, bytesToSend.Length, receiveEndPoint); - return $"Time command received by {receiveEndPoint}, sent local server time"; default: return $"[{DateTime.Now}] {receiveEndPoint}: {receivedMessage}"; }