diff --git a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs index b2c1c3657..00e16ef8d 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs @@ -231,6 +231,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 } else { + rtpUdpLocalPort = RtpUdpPortBase + 2 * cameraIdx; + StartRtpListener(NetAdapter.IPAddress, rtpUdpLocalPort); + UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} s/n {1} was not detected", Name, CameraCfg.HardwareAddress)); log.FatalFormat("'{0}' with address {1} not detected", Name, CameraCfg.HardwareAddress); } @@ -248,7 +251,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 } if (scpThread != null) scpThread.Join(500); - if (rtpListenerThread != null) rtpListenerThread.Join(1000); + if (rtpListenerThread != null) rtpListenerThread.Join(200); if (rtpUdpClient != null) { diff --git a/TestBenchFramework/Forms/ClosingProgram.Designer.cs b/TestBenchFramework/Forms/ClosingProgram.Designer.cs deleted file mode 100644 index f27caf9d7..000000000 --- a/TestBenchFramework/Forms/ClosingProgram.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -/// -/// Copyright (c) 2013-2015 Sensus Metering Systems -/// -namespace TBF.Forms -{ - partial class ClosingProgram - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(60, 68); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(305, 24); - this.label1.TabIndex = 0; - this.label1.Text = "Closing the Test Bench Framework"; - // - // ClosingProgram - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.PeachPuff; - this.ClientSize = new System.Drawing.Size(487, 161); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ClosingProgram"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Closing the Test Bench Framework"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - } -} \ No newline at end of file diff --git a/TestBenchFramework/Forms/ClosingProgram.cs b/TestBenchFramework/Forms/ClosingProgram.cs deleted file mode 100644 index 77cda607c..000000000 --- a/TestBenchFramework/Forms/ClosingProgram.cs +++ /dev/null @@ -1,42 +0,0 @@ -/// -/// Copyright (c) 2013-2017 Sensus Metering Systems -/// -using System; -using System.Drawing; -using System.Windows.Forms; -using TBF.Resources; - -namespace TBF.Forms -{ - public partial class ClosingProgram : Form - { - Timer timer; - - public ClosingProgram() - { - InitializeComponent(); - - label1.Text = Strings.Closing_Test_Bench_Framework; - - float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Width; - - Width = (int)textWidth + 120; /// Form width calculated from the text width - - timer = new Timer(); - timer.Interval = 1000; - timer.Tick += new EventHandler(timer_Tick); - timer.Start(); - } - - void timer_Tick(object sender, EventArgs args) - { - if (!TBF.BenchControl.StateMachine.Running) - { - timer.Stop(); - timer.Dispose(); - DialogResult = DialogResult.OK; - Close(); - } - } - } -} diff --git a/TestBenchFramework/Forms/ClosingProgram.resx b/TestBenchFramework/Forms/ClosingProgram.resx deleted file mode 100644 index 1af7de150..000000000 --- a/TestBenchFramework/Forms/ClosingProgram.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TestBenchFramework/Forms/ModelessActivityForm.cs b/TestBenchFramework/Forms/ModelessActivityForm.cs index cb8a254a3..7f25aa52a 100644 --- a/TestBenchFramework/Forms/ModelessActivityForm.cs +++ b/TestBenchFramework/Forms/ModelessActivityForm.cs @@ -27,6 +27,7 @@ namespace TBF.Forms public string FontFamily; public int FontSize; public FontStyle FontStyle; + public bool StartActivityHandler; /// @@ -61,13 +62,17 @@ namespace TBF.Forms float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Width; float textHeight = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Height; Width = (int)textWidth + 120; /// Form width calculated from the text width - Height += (int)textHeight; /// Form width calculated from the text width - Bridge.ActivityHandler += delegate(object sndr, ActivityEventArgs args) - { - if (InvokeRequired) { Invoke(new EventHandler(OnActivity), sndr, args); } - else OnActivity(sndr, args); - }; + if (StartActivityHandler) + { + Height += (int)textHeight; /// Form height calculated from the text width + + Bridge.ActivityHandler += delegate(object sndr, ActivityEventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnActivity), sndr, args); } + else OnActivity(sndr, args); + }; + } } void OnActivity(object sender, ActivityEventArgs args) diff --git a/TestBenchFramework/Forms/ModelessActivityForm.designer.cs b/TestBenchFramework/Forms/ModelessActivityForm.designer.cs index 55777358e..46ecd15de 100644 --- a/TestBenchFramework/Forms/ModelessActivityForm.designer.cs +++ b/TestBenchFramework/Forms/ModelessActivityForm.designer.cs @@ -28,41 +28,41 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.activityStatusLabel = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(64, 29); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(0, 13); - this.label1.TabIndex = 0; - // - // activityStatusLabel - // - this.activityStatusLabel.AutoSize = true; - this.activityStatusLabel.Location = new System.Drawing.Point(64, 85); - this.activityStatusLabel.Name = "activityStatusLabel"; - this.activityStatusLabel.Size = new System.Drawing.Size(0, 13); - this.activityStatusLabel.TabIndex = 1; - // - // ModelessActivityForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.OliveDrab; - this.ClientSize = new System.Drawing.Size(284, 113); - this.Controls.Add(this.activityStatusLabel); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MinimizeBox = false; - this.Name = "ModelessActivityForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Load += new System.EventHandler(this.ModelessForm_Load); - this.ResumeLayout(false); - this.PerformLayout(); + this.label1 = new System.Windows.Forms.Label(); + this.activityStatusLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(64, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(0, 13); + this.label1.TabIndex = 0; + // + // activityStatusLabel + // + this.activityStatusLabel.AutoSize = true; + this.activityStatusLabel.Location = new System.Drawing.Point(64, 85); + this.activityStatusLabel.Name = "activityStatusLabel"; + this.activityStatusLabel.Size = new System.Drawing.Size(0, 13); + this.activityStatusLabel.TabIndex = 1; + // + // ModelessActivityForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.OliveDrab; + this.ClientSize = new System.Drawing.Size(569, 113); + this.Controls.Add(this.activityStatusLabel); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MinimizeBox = false; + this.Name = "ModelessActivityForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Load += new System.EventHandler(this.ModelessForm_Load); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/TestBenchFramework/MainWnd.cs b/TestBenchFramework/MainWnd.cs index 2fa5c4949..19038963c 100644 --- a/TestBenchFramework/MainWnd.cs +++ b/TestBenchFramework/MainWnd.cs @@ -163,13 +163,14 @@ namespace TBF if (Config.Data.CurrentBench.IsRealBench && !benchInitializationFailed) { var form = new TBF.Forms.ModelessActivityForm() - { - Message = Strings.Starting_system, - FontFamily = "Arial", - FontSize = 24, - FontStyle = FontStyle.Regular, - BackgroundColor = Color.OliveDrab /// or Color.YellowGreen - }; + { + Message = Strings.Starting_system, + FontFamily = "Arial", + FontSize = 24, + FontStyle = FontStyle.Regular, + BackgroundColor = Color.OliveDrab, /// or Color.YellowGreen + StartActivityHandler = true, + }; Thread formThread = new Thread(() => form.ShowDialog()); formThread.Start(); @@ -528,10 +529,29 @@ namespace TBF MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { + /// Show 'Closing_Test_Bench_Framework' modeless window in separate thread + var form = new TBF.Forms.ModelessActivityForm() + { + Message = Strings.Closing_Test_Bench_Framework, + FontFamily = "Arial", + FontSize = 24, + FontStyle = FontStyle.Regular, + BackgroundColor = Color.PeachPuff, + StartActivityHandler = false, + }; + Thread formThread = new Thread(() => form.ShowDialog()); + formThread.Start(); + + /// Stop the system BenchControl.StateMachine.Stop(); - BenchControl.StateMachine.StopDevices(); + BenchControl.StateMachine.StopDevices(); UiBridge.Bridge.OnEmergencyStopChanged(this, UiBridge.EmergencyStopEventArgs.State.CloseForm); - new Forms.ClosingProgram().ShowDialog(); + + /// Close 'Closing_Test_Bench_Framework' modeless window + form.CloseForm(null, new EventArgs()); + formThread.Join(); + + /// Close the main window DialogResult = DialogResult.OK; Close(); return; diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index a89ebf120..b2c9da46f 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.17.679.1")] -[assembly: AssemblyFileVersion("2.17.679.1")] +[assembly: AssemblyVersion("2.17.680.1")] +[assembly: AssemblyFileVersion("2.17.680.1")] diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 2fe7b8389..4ab1396d1 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -1395,12 +1395,6 @@ - - Form - - - ClosingProgram.cs - Form @@ -2272,9 +2266,6 @@ AboutDlg.cs - - ClosingProgram.cs - DatabaseSettingsDlg.cs