From d156da8ee1faf5b054e3c87ba0911043dfe8cc2d Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 26 Apr 2018 12:54:58 +0200 Subject: [PATCH] gestione restart --- IOB-WIN/AdapterForm.Designer.cs | 230 +++++++++++++++++--------------- IOB-WIN/AdapterForm.cs | 20 ++- IOB-WIN/DATA/CONF/3007.ini | 2 +- 3 files changed, 144 insertions(+), 108 deletions(-) diff --git a/IOB-WIN/AdapterForm.Designer.cs b/IOB-WIN/AdapterForm.Designer.cs index bd6bdda7..b55b12f2 100644 --- a/IOB-WIN/AdapterForm.Designer.cs +++ b/IOB-WIN/AdapterForm.Designer.cs @@ -42,11 +42,17 @@ this.tslDataProc = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label6 = new System.Windows.Forms.Label(); + this.lQueueLen = new System.Windows.Forms.Label(); + this.port = new System.Windows.Forms.TextBox(); + this.stop = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.nLines = new System.Windows.Forms.TextBox(); + this.start = new System.Windows.Forms.Button(); this.lblTopCent = new System.Windows.Forms.Label(); this.bIN = new System.Windows.Forms.Button(); this.bOUT = new System.Windows.Forms.Button(); - this.stop = new System.Windows.Forms.Button(); - this.start = new System.Windows.Forms.Button(); this.gbMonitor = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.lblOutMessage = new System.Windows.Forms.Label(); @@ -57,13 +63,8 @@ this.label3 = new System.Windows.Forms.Label(); this.lblOutMessage3 = new System.Windows.Forms.Label(); this.lblOutMessage2 = new System.Windows.Forms.Label(); - this.lQueueLen = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.nLines = new System.Windows.Forms.TextBox(); this.displTimer = new System.Windows.Forms.Timer(this.components); - this.port = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); + this.restart = new System.Windows.Forms.Button(); this.statusStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.gbMonitor.SuspendLayout(); @@ -152,10 +153,11 @@ // this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 11; + this.tableLayoutPanel1.ColumnCount = 12; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); @@ -164,17 +166,18 @@ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F)); - this.tableLayoutPanel1.Controls.Add(this.label6, 6, 0); - this.tableLayoutPanel1.Controls.Add(this.lQueueLen, 7, 0); - this.tableLayoutPanel1.Controls.Add(this.port, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.restart, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.label6, 7, 0); + this.tableLayoutPanel1.Controls.Add(this.lQueueLen, 8, 0); + this.tableLayoutPanel1.Controls.Add(this.port, 5, 0); this.tableLayoutPanel1.Controls.Add(this.stop, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.label5, 8, 0); - this.tableLayoutPanel1.Controls.Add(this.label1, 3, 0); - this.tableLayoutPanel1.Controls.Add(this.nLines, 9, 0); + this.tableLayoutPanel1.Controls.Add(this.label5, 9, 0); + this.tableLayoutPanel1.Controls.Add(this.label1, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.nLines, 10, 0); this.tableLayoutPanel1.Controls.Add(this.start, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.lblTopCent, 5, 0); + this.tableLayoutPanel1.Controls.Add(this.lblTopCent, 6, 0); this.tableLayoutPanel1.Controls.Add(this.bIN, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.bOUT, 10, 0); + this.tableLayoutPanel1.Controls.Add(this.bOUT, 11, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; @@ -182,16 +185,105 @@ this.tableLayoutPanel1.Size = new System.Drawing.Size(1181, 37); this.tableLayoutPanel1.TabIndex = 66; // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(909, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(48, 17); + this.label6.TabIndex = 76; + this.label6.Text = "queue"; + // + // lQueueLen + // + this.lQueueLen.AutoSize = true; + this.lQueueLen.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lQueueLen.Location = new System.Drawing.Point(989, 0); + this.lQueueLen.Name = "lQueueLen"; + this.lQueueLen.Size = new System.Drawing.Size(17, 17); + this.lQueueLen.TabIndex = 77; + this.lQueueLen.Text = "#"; + // + // port + // + this.port.Enabled = false; + this.port.Location = new System.Drawing.Point(459, 4); + this.port.Margin = new System.Windows.Forms.Padding(4); + this.port.Name = "port"; + this.port.Size = new System.Drawing.Size(52, 22); + this.port.TabIndex = 1; + this.port.Text = "7878"; + this.port.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.port.Visible = false; + // + // stop + // + this.stop.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.stop.Location = new System.Drawing.Point(279, 4); + this.stop.Margin = new System.Windows.Forms.Padding(4); + this.stop.Name = "stop"; + this.stop.Size = new System.Drawing.Size(112, 29); + this.stop.TabIndex = 3; + this.stop.Text = "Stop"; + this.stop.UseVisualStyleBackColor = true; + this.stop.Click += new System.EventHandler(this.stop_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(1029, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(37, 17); + this.label5.TabIndex = 74; + this.label5.Text = "rows"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(399, 0); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(34, 17); + this.label1.TabIndex = 0; + this.label1.Text = "Port"; + this.label1.Visible = false; + // + // nLines + // + this.nLines.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.nLines.Location = new System.Drawing.Point(1109, 3); + this.nLines.Name = "nLines"; + this.nLines.Size = new System.Drawing.Size(33, 26); + this.nLines.TabIndex = 73; + this.nLines.Text = "50"; + this.nLines.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // start + // + this.start.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.start.Location = new System.Drawing.Point(159, 4); + this.start.Margin = new System.Windows.Forms.Padding(4); + this.start.Name = "start"; + this.start.Size = new System.Drawing.Size(112, 29); + this.start.TabIndex = 2; + this.start.Text = "Start"; + this.start.UseVisualStyleBackColor = true; + this.start.Click += new System.EventHandler(this.start_Click); + // // lblTopCent // this.lblTopCent.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblTopCent.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblTopCent.Location = new System.Drawing.Point(399, 0); + this.lblTopCent.Location = new System.Drawing.Point(519, 0); this.lblTopCent.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblTopCent.Name = "lblTopCent"; - this.lblTopCent.Size = new System.Drawing.Size(503, 37); + this.lblTopCent.Size = new System.Drawing.Size(383, 37); this.lblTopCent.TabIndex = 68; this.lblTopCent.Text = "IOB loaded: N.A."; this.lblTopCent.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -222,34 +314,6 @@ this.bOUT.Text = "O"; this.bOUT.UseVisualStyleBackColor = true; // - // stop - // - this.stop.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.stop.Location = new System.Drawing.Point(159, 4); - this.stop.Margin = new System.Windows.Forms.Padding(4); - this.stop.Name = "stop"; - this.stop.Size = new System.Drawing.Size(112, 29); - this.stop.TabIndex = 3; - this.stop.Text = "Stop"; - this.stop.UseVisualStyleBackColor = true; - this.stop.Click += new System.EventHandler(this.stop_Click); - // - // start - // - this.start.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.start.Location = new System.Drawing.Point(39, 4); - this.start.Margin = new System.Windows.Forms.Padding(4); - this.start.Name = "start"; - this.start.Size = new System.Drawing.Size(112, 29); - this.start.TabIndex = 2; - this.start.Text = "Start"; - this.start.UseVisualStyleBackColor = true; - this.start.Click += new System.EventHandler(this.start_Click); - // // gbMonitor // this.gbMonitor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -384,70 +448,23 @@ this.lblOutMessage2.TabIndex = 62; this.lblOutMessage2.Text = "..."; // - // lQueueLen - // - this.lQueueLen.AutoSize = true; - this.lQueueLen.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lQueueLen.Location = new System.Drawing.Point(989, 0); - this.lQueueLen.Name = "lQueueLen"; - this.lQueueLen.Size = new System.Drawing.Size(17, 17); - this.lQueueLen.TabIndex = 77; - this.lQueueLen.Text = "#"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(909, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(48, 17); - this.label6.TabIndex = 76; - this.label6.Text = "queue"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(1029, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(37, 17); - this.label5.TabIndex = 74; - this.label5.Text = "rows"; - // - // nLines - // - this.nLines.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.nLines.Location = new System.Drawing.Point(1109, 3); - this.nLines.Name = "nLines"; - this.nLines.Size = new System.Drawing.Size(33, 26); - this.nLines.TabIndex = 73; - this.nLines.Text = "50"; - this.nLines.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // // displTimer // this.displTimer.Tick += new System.EventHandler(this.displTimer_Tick); // - // port + // restart // - this.port.Enabled = false; - this.port.Location = new System.Drawing.Point(339, 4); - this.port.Margin = new System.Windows.Forms.Padding(4); - this.port.Name = "port"; - this.port.Size = new System.Drawing.Size(52, 22); - this.port.TabIndex = 1; - this.port.Text = "7878"; - this.port.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.port.Visible = false; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(279, 0); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(34, 17); - this.label1.TabIndex = 0; - this.label1.Text = "Port"; - this.label1.Visible = false; + this.restart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.restart.Location = new System.Drawing.Point(39, 4); + this.restart.Margin = new System.Windows.Forms.Padding(4); + this.restart.Name = "restart"; + this.restart.Size = new System.Drawing.Size(112, 29); + this.restart.TabIndex = 78; + this.restart.Text = "Restart"; + this.restart.UseVisualStyleBackColor = true; + this.restart.Click += new System.EventHandler(this.restart_Click); // // AdapterForm // @@ -511,5 +528,6 @@ private System.Windows.Forms.Label lblOutMessage2; private System.Windows.Forms.TextBox port; private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button restart; } } \ No newline at end of file diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs index 83c47ac2..45e8594b 100644 --- a/IOB-WIN/AdapterForm.cs +++ b/IOB-WIN/AdapterForm.cs @@ -707,6 +707,24 @@ namespace IOB_WIN } } + private void restart_Click(object sender, EventArgs e) + { + // faccio stop... + fermaAdapter(false); + // salvo che ho fermato adapter + lgInfo("Restart F1: Adapter Stopped"); + + // rileggo INI + loadIniFile(defConfFilePath); + lgInfo("Restart F2: INI RE-LOADED"); + + // faccio start... + avviaAdapter(); + iobObj.loadPersData(); + // salvo che ho avviato adapter + lgInfo("Restart F3: Completato RE-LOAD Adapter"); + + } /// /// fermata dell'adapter /// @@ -877,6 +895,6 @@ namespace IOB_WIN TimeSpan uptime = DateTime.Now.Subtract(firstStart); tslUptime.Text = string.Format("Runtime: {0}gg {1:00}:{2:00}:{3:00}", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds); } - + } } diff --git a/IOB-WIN/DATA/CONF/3007.ini b/IOB-WIN/DATA/CONF/3007.ini index 3262993e..177d9142 100644 --- a/IOB-WIN/DATA/CONF/3007.ini +++ b/IOB-WIN/DATA/CONF/3007.ini @@ -10,7 +10,7 @@ MODEL=SR32J ; STAR SR32J IP=192.168.0.21 PORT=8193 -GETPRGNAME=false +GETPRGNAME=true [SERVER] MPIP=http://192.168.1.7