diff --git a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs index b567d7954..1c6df0218 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs @@ -189,7 +189,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 if (cameraDetected) { - /// Open telnet clint and start the log-in process + UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} s/n={1} IP={2} SD={3}", Name, CameraCfg.HardwareAddress, ipAddress, sdCardVer)); + + /// Open telnet clint and start the log-in process Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, TelnetPrompt, TelnetSkipFirstLine, CameraCfg.DisplayTerminal); if (CameraCfg.DisplayTerminal) @@ -229,6 +231,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 } else { + 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); } } diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index e24a9b7bb..1ce0d3640 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.16.668.1")] -[assembly: AssemblyFileVersion("2.16.668.1")] +[assembly: AssemblyVersion("2.16.669.1")] +[assembly: AssemblyFileVersion("2.16.669.1")] diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index 8434a0b33..855f2014f 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -1671,15 +1671,6 @@ namespace TBF.Resources { } } - /// - /// Looks up a localized string similar to Focus. - /// - internal static string Focus { - get { - return ResourceManager.GetString("Focus", resourceCulture); - } - } - /// /// Looks up a localized string similar to Footer. /// diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index a42e1554d..e33bbaaa8 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1150,9 +1150,6 @@ ID - - Focus - Grab diff --git a/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs b/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs index b6a5e8c7d..171afbf56 100644 --- a/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs +++ b/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs @@ -31,131 +31,105 @@ namespace TBF.Screens /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PicturesTabPageCtrl)); - this.logTextBox = new System.Windows.Forms.TextBox(); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - this.focusButton = new System.Windows.Forms.Button(); - this.liveButton = new System.Windows.Forms.Button(); - this.grabButton = new System.Windows.Forms.Button(); - this.configureButton = new System.Windows.Forms.Button(); - this.cameraPictureCtrl6 = new TBF.UiControls.CameraPictureCtrl(); - this.cameraPictureCtrl5 = new TBF.UiControls.CameraPictureCtrl(); - this.cameraPictureCtrl4 = new TBF.UiControls.CameraPictureCtrl(); - this.cameraPictureCtrl3 = new TBF.UiControls.CameraPictureCtrl(); - this.cameraPictureCtrl2 = new TBF.UiControls.CameraPictureCtrl(); - this.cameraPictureCtrl1 = new TBF.UiControls.CameraPictureCtrl(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - this.SuspendLayout(); - // - // logTextBox - // - resources.ApplyResources(this.logTextBox, "logTextBox"); - this.logTextBox.Name = "logTextBox"; - // - // splitContainer - // - resources.ApplyResources(this.splitContainer, "splitContainer"); - this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer.Name = "splitContainer"; - // - // splitContainer.Panel1 - // - this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control; - this.splitContainer.Panel1.Controls.Add(this.focusButton); - this.splitContainer.Panel1.Controls.Add(this.liveButton); - this.splitContainer.Panel1.Controls.Add(this.grabButton); - this.splitContainer.Panel1.Controls.Add(this.configureButton); - // - // splitContainer.Panel2 - // - this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl6); - this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl5); - this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl4); - this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl3); - this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl2); - this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl1); - // - // focusButton - // - resources.ApplyResources(this.focusButton, "focusButton"); - this.focusButton.Name = "focusButton"; - this.focusButton.UseVisualStyleBackColor = true; - this.focusButton.Click += new System.EventHandler(this.focusButton_Click); - // - // liveButton - // - resources.ApplyResources(this.liveButton, "liveButton"); - this.liveButton.Name = "liveButton"; - this.liveButton.UseVisualStyleBackColor = true; - this.liveButton.Click += new System.EventHandler(this.liveButton_Click); - // - // grabButton - // - resources.ApplyResources(this.grabButton, "grabButton"); - this.grabButton.Name = "grabButton"; - this.grabButton.UseVisualStyleBackColor = true; - this.grabButton.Click += new System.EventHandler(this.grabButton_Click); - // - // configureButton - // - resources.ApplyResources(this.configureButton, "configureButton"); - this.configureButton.Name = "configureButton"; - this.configureButton.UseVisualStyleBackColor = true; - this.configureButton.Click += new System.EventHandler(this.configureButton_Click); - // - // cameraPictureCtrl6 - // - this.cameraPictureCtrl6.BackColor = System.Drawing.SystemColors.ButtonShadow; - resources.ApplyResources(this.cameraPictureCtrl6, "cameraPictureCtrl6"); - this.cameraPictureCtrl6.Name = "cameraPictureCtrl6"; - // - // cameraPictureCtrl5 - // - this.cameraPictureCtrl5.BackColor = System.Drawing.SystemColors.ButtonShadow; - resources.ApplyResources(this.cameraPictureCtrl5, "cameraPictureCtrl5"); - this.cameraPictureCtrl5.Name = "cameraPictureCtrl5"; - // - // cameraPictureCtrl4 - // - this.cameraPictureCtrl4.BackColor = System.Drawing.SystemColors.ButtonShadow; - resources.ApplyResources(this.cameraPictureCtrl4, "cameraPictureCtrl4"); - this.cameraPictureCtrl4.Name = "cameraPictureCtrl4"; - // - // cameraPictureCtrl3 - // - this.cameraPictureCtrl3.BackColor = System.Drawing.SystemColors.ButtonShadow; - resources.ApplyResources(this.cameraPictureCtrl3, "cameraPictureCtrl3"); - this.cameraPictureCtrl3.Name = "cameraPictureCtrl3"; - // - // cameraPictureCtrl2 - // - this.cameraPictureCtrl2.BackColor = System.Drawing.SystemColors.ButtonShadow; - resources.ApplyResources(this.cameraPictureCtrl2, "cameraPictureCtrl2"); - this.cameraPictureCtrl2.Name = "cameraPictureCtrl2"; - // - // cameraPictureCtrl1 - // - this.cameraPictureCtrl1.BackColor = System.Drawing.SystemColors.ButtonShadow; - resources.ApplyResources(this.cameraPictureCtrl1, "cameraPictureCtrl1"); - this.cameraPictureCtrl1.Name = "cameraPictureCtrl1"; - // - // PicturesTabPageCtrl - // - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Silver; - this.Controls.Add(this.splitContainer); - this.Controls.Add(this.logTextBox); - this.Name = "PicturesTabPageCtrl"; - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); - this.splitContainer.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PicturesTabPageCtrl)); + this.logTextBox = new System.Windows.Forms.TextBox(); + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.configureButton = new System.Windows.Forms.Button(); + this.cameraPictureCtrl6 = new TBF.UiControls.CameraPictureCtrl(); + this.cameraPictureCtrl5 = new TBF.UiControls.CameraPictureCtrl(); + this.cameraPictureCtrl4 = new TBF.UiControls.CameraPictureCtrl(); + this.cameraPictureCtrl3 = new TBF.UiControls.CameraPictureCtrl(); + this.cameraPictureCtrl2 = new TBF.UiControls.CameraPictureCtrl(); + this.cameraPictureCtrl1 = new TBF.UiControls.CameraPictureCtrl(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); + this.SuspendLayout(); + // + // logTextBox + // + resources.ApplyResources(this.logTextBox, "logTextBox"); + this.logTextBox.Name = "logTextBox"; + // + // splitContainer + // + resources.ApplyResources(this.splitContainer, "splitContainer"); + this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer.Name = "splitContainer"; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control; + this.splitContainer.Panel1.Controls.Add(this.configureButton); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control; + this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl6); + this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl5); + this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl4); + this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl3); + this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl2); + this.splitContainer.Panel2.Controls.Add(this.cameraPictureCtrl1); + // + // configureButton + // + resources.ApplyResources(this.configureButton, "configureButton"); + this.configureButton.Name = "configureButton"; + this.configureButton.UseVisualStyleBackColor = true; + this.configureButton.Click += new System.EventHandler(this.configureButton_Click); + // + // cameraPictureCtrl6 + // + this.cameraPictureCtrl6.BackColor = System.Drawing.SystemColors.ButtonShadow; + resources.ApplyResources(this.cameraPictureCtrl6, "cameraPictureCtrl6"); + this.cameraPictureCtrl6.Name = "cameraPictureCtrl6"; + // + // cameraPictureCtrl5 + // + this.cameraPictureCtrl5.BackColor = System.Drawing.SystemColors.ButtonShadow; + resources.ApplyResources(this.cameraPictureCtrl5, "cameraPictureCtrl5"); + this.cameraPictureCtrl5.Name = "cameraPictureCtrl5"; + // + // cameraPictureCtrl4 + // + this.cameraPictureCtrl4.BackColor = System.Drawing.SystemColors.ButtonShadow; + resources.ApplyResources(this.cameraPictureCtrl4, "cameraPictureCtrl4"); + this.cameraPictureCtrl4.Name = "cameraPictureCtrl4"; + // + // cameraPictureCtrl3 + // + this.cameraPictureCtrl3.BackColor = System.Drawing.SystemColors.ButtonShadow; + resources.ApplyResources(this.cameraPictureCtrl3, "cameraPictureCtrl3"); + this.cameraPictureCtrl3.Name = "cameraPictureCtrl3"; + // + // cameraPictureCtrl2 + // + this.cameraPictureCtrl2.BackColor = System.Drawing.SystemColors.ButtonShadow; + resources.ApplyResources(this.cameraPictureCtrl2, "cameraPictureCtrl2"); + this.cameraPictureCtrl2.Name = "cameraPictureCtrl2"; + // + // cameraPictureCtrl1 + // + this.cameraPictureCtrl1.BackColor = System.Drawing.SystemColors.ButtonShadow; + resources.ApplyResources(this.cameraPictureCtrl1, "cameraPictureCtrl1"); + this.cameraPictureCtrl1.Name = "cameraPictureCtrl1"; + // + // PicturesTabPageCtrl + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Silver; + this.Controls.Add(this.splitContainer); + this.Controls.Add(this.logTextBox); + this.Name = "PicturesTabPageCtrl"; + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -169,9 +143,6 @@ namespace TBF.Screens private UiControls.CameraPictureCtrl cameraPictureCtrl4; private UiControls.CameraPictureCtrl cameraPictureCtrl3; private UiControls.CameraPictureCtrl cameraPictureCtrl2; - private UiControls.CameraPictureCtrl cameraPictureCtrl1; - private System.Windows.Forms.Button focusButton; - private System.Windows.Forms.Button liveButton; - private System.Windows.Forms.Button grabButton; + private UiControls.CameraPictureCtrl cameraPictureCtrl1; } } diff --git a/TestBenchFramework/Screens/PicturesTabPageCtrl.cs b/TestBenchFramework/Screens/PicturesTabPageCtrl.cs index 2a2f3ca44..76824711e 100644 --- a/TestBenchFramework/Screens/PicturesTabPageCtrl.cs +++ b/TestBenchFramework/Screens/PicturesTabPageCtrl.cs @@ -16,59 +16,76 @@ namespace TBF.Screens Localize(); + System.Windows.Forms.Timer timer; + timer = new System.Windows.Forms.Timer(); + timer.Tick += (s, e) => { TimerTick(); }; + timer.Interval = 250; + timer.Start(); + Bridge.ImageHandler += delegate(object sender, ImageEventArgs args) - { - if (InvokeRequired) - { - Invoke(new EventHandler(ShowImage), sender, args); - } - else - { - ShowImage(sender, args); - } - }; - } + { + if (InvokeRequired) + Invoke(new EventHandler(ShowImage), sender, args); + else + ShowImage(sender, args); + }; + + Bridge.CameraInfoHandler += delegate(object sender, CameraInfoEventArgs args) + { + if (InvokeRequired) + Invoke(new EventHandler(ShowInfo), sender, args); + else + ShowInfo(sender, args); + }; + } private void Localize() { configureButton.Text = Strings.Configure; - grabButton.Text = Strings.Grab; - liveButton.Text = Strings.Live; - focusButton.Text = Strings.Focus; } + private void TimerTick() + { + DateTime now = DateTime.Now; + cameraPictureCtrl1.UpdateLed(now); + cameraPictureCtrl2.UpdateLed(now); + cameraPictureCtrl3.UpdateLed(now); + cameraPictureCtrl4.UpdateLed(now); + cameraPictureCtrl5.UpdateLed(now); + cameraPictureCtrl6.UpdateLed(now); + } + void ShowImage(object sender, ImageEventArgs args) { switch (args.CameraIdx) { - case 0: cameraPictureCtrl1.PictureBox.Image = args.Image; break; - case 1: cameraPictureCtrl2.PictureBox.Image = args.Image; break; - case 2: cameraPictureCtrl3.PictureBox.Image = args.Image; break; - case 3: cameraPictureCtrl4.PictureBox.Image = args.Image; break; - case 4: cameraPictureCtrl5.PictureBox.Image = args.Image; break; - case 5: cameraPictureCtrl6.PictureBox.Image = args.Image; break; + case 0: cameraPictureCtrl1.Image = args.Image; break; + case 1: cameraPictureCtrl2.Image = args.Image; break; + case 2: cameraPictureCtrl3.Image = args.Image; break; + case 3: cameraPictureCtrl4.Image = args.Image; break; + case 4: cameraPictureCtrl5.Image = args.Image; break; + case 5: cameraPictureCtrl6.Image = args.Image; break; default: break; } } + void ShowInfo(object sender, CameraInfoEventArgs args) + { + switch (args.CameraIdx) + { + case 0: cameraPictureCtrl1.Caption = args.Info; break; + case 1: cameraPictureCtrl2.Caption = args.Info; break; + case 2: cameraPictureCtrl3.Caption = args.Info; break; + case 3: cameraPictureCtrl4.Caption = args.Info; break; + case 4: cameraPictureCtrl5.Caption = args.Info; break; + case 5: cameraPictureCtrl6.Caption = args.Info; break; + default: break; + } + } + private void configureButton_Click(object sender, EventArgs e) { } - - private void grabButton_Click(object sender, EventArgs e) - { - - } - - private void liveButton_Click(object sender, EventArgs e) - { - - } - - private void focusButton_Click(object sender, EventArgs e) - { - - } } } diff --git a/TestBenchFramework/Screens/PicturesTabPageCtrl.resx b/TestBenchFramework/Screens/PicturesTabPageCtrl.resx index b6b1a68d9..af4f6e4d7 100644 --- a/TestBenchFramework/Screens/PicturesTabPageCtrl.resx +++ b/TestBenchFramework/Screens/PicturesTabPageCtrl.resx @@ -162,92 +162,14 @@ Horizontal - + NoControl - - 386, 7 - - - 100, 30 - - - 5 - - - Focus - - - focusButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - splitContainer.Panel1 - - - 0 - - - NoControl - - - 280, 7 - - - 100, 30 - - - 4 - - - Live - - - liveButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - splitContainer.Panel1 - - - 1 - - - 174, 7 - - - 100, 30 - - - 3 - - - Grab - - - grabButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - splitContainer.Panel1 - - - 2 - - - False - - 20, 7 + 2, 5 - 100, 30 + 100, 21 2 @@ -255,9 +177,6 @@ Configure - - False - configureButton @@ -268,7 +187,7 @@ splitContainer.Panel1 - 3 + 0 splitContainer.Panel1 @@ -283,10 +202,10 @@ 0 - 673, 323 + 667, 290 - 334, 320 + 333, 288 5 @@ -295,7 +214,7 @@ cameraPictureCtrl6 - TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.655.1, Culture=neutral, PublicKeyToken=null + TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.668.1, Culture=neutral, PublicKeyToken=null splitContainer.Panel2 @@ -304,10 +223,10 @@ 0 - 338, 323 + 335, 290 - 334, 320 + 333, 288 4 @@ -316,7 +235,7 @@ cameraPictureCtrl5 - TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.655.1, Culture=neutral, PublicKeyToken=null + TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.668.1, Culture=neutral, PublicKeyToken=null splitContainer.Panel2 @@ -325,10 +244,10 @@ 1 - 3, 323 + 3, 290 - 334, 320 + 333, 288 3 @@ -337,7 +256,7 @@ cameraPictureCtrl4 - TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.655.1, Culture=neutral, PublicKeyToken=null + TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.668.1, Culture=neutral, PublicKeyToken=null splitContainer.Panel2 @@ -346,10 +265,10 @@ 2 - 673, 3 + 667, 3 - 334, 320 + 333, 288 2 @@ -358,7 +277,7 @@ cameraPictureCtrl3 - TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.655.1, Culture=neutral, PublicKeyToken=null + TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.668.1, Culture=neutral, PublicKeyToken=null splitContainer.Panel2 @@ -367,10 +286,10 @@ 3 - 338, 3 + 335, 3 - 334, 320 + 333, 288 1 @@ -379,7 +298,7 @@ cameraPictureCtrl2 - TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.655.1, Culture=neutral, PublicKeyToken=null + TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.668.1, Culture=neutral, PublicKeyToken=null splitContainer.Panel2 @@ -391,7 +310,7 @@ 3, 3 - 334, 320 + 333, 288 0 @@ -400,7 +319,7 @@ cameraPictureCtrl1 - TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.655.1, Culture=neutral, PublicKeyToken=null + TBF.UiControls.CameraPictureCtrl, TBF, Version=2.16.668.1, Culture=neutral, PublicKeyToken=null splitContainer.Panel2 @@ -424,7 +343,7 @@ 1033, 689 - 42 + 30 2 diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 6ed562b89..4b04ad9da 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -1692,6 +1692,7 @@ + diff --git a/TestBenchFramework/UiBridge/Bridge.cs b/TestBenchFramework/UiBridge/Bridge.cs index c9201ddc1..af03599bf 100644 --- a/TestBenchFramework/UiBridge/Bridge.cs +++ b/TestBenchFramework/UiBridge/Bridge.cs @@ -142,6 +142,17 @@ namespace TBF.UiBridge public static event EventHandler ProcedureCompletedHandler; + /// + /// Called from a camera when camera state (shown as a caption in PicturesTabPage) changes + /// + public static void OnCameraInfo(int cameraIdx, string info) + { + if (CameraInfoHandler == null) return; + try { CameraInfoHandler(null, new CameraInfoEventArgs(cameraIdx, info)); } + catch (Exception e) { log.Error("CameraInfoHandler(...) failed", e); } + } + public static event EventHandler CameraInfoHandler; + /// /// Called from any RTP listener thread (e.g. MJpeg RTP listener thread) /// diff --git a/TestBenchFramework/UiBridge/CameraInfoEventArgs.cs b/TestBenchFramework/UiBridge/CameraInfoEventArgs.cs new file mode 100644 index 000000000..9904d4fdd --- /dev/null +++ b/TestBenchFramework/UiBridge/CameraInfoEventArgs.cs @@ -0,0 +1,22 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TBF.UiBridge +{ + public class CameraInfoEventArgs : EventArgs + { + public int CameraIdx; + public string Info; + + public CameraInfoEventArgs(int cameraIdx, string info) + { + this.CameraIdx = cameraIdx; + this.Info = info; + } + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl.Designer.cs b/TestBenchFramework/UiControls/CameraPictureCtrl.Designer.cs index 717182b91..4dc3c5f2a 100644 --- a/TestBenchFramework/UiControls/CameraPictureCtrl.Designer.cs +++ b/TestBenchFramework/UiControls/CameraPictureCtrl.Designer.cs @@ -34,14 +34,9 @@ namespace TBF.UiControls this.pictureBox = new System.Windows.Forms.PictureBox(); this.groupBox = new System.Windows.Forms.GroupBox(); this.ledPictureBox = new System.Windows.Forms.PictureBox(); - this.trackBar = new System.Windows.Forms.TrackBar(); - this.liveButton = new System.Windows.Forms.Button(); - this.focusButton = new System.Windows.Forms.Button(); - this.grabButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.groupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); this.SuspendLayout(); // // pictureBox @@ -55,65 +50,25 @@ namespace TBF.UiControls // // groupBox // + this.groupBox.BackColor = System.Drawing.SystemColors.Control; this.groupBox.Controls.Add(this.ledPictureBox); - this.groupBox.Controls.Add(this.trackBar); - this.groupBox.Controls.Add(this.liveButton); - this.groupBox.Controls.Add(this.focusButton); - this.groupBox.Controls.Add(this.grabButton); this.groupBox.Controls.Add(this.pictureBox); + this.groupBox.ForeColor = System.Drawing.Color.Black; this.groupBox.Location = new System.Drawing.Point(0, 0); this.groupBox.Name = "groupBox"; - this.groupBox.Size = new System.Drawing.Size(332, 315); + this.groupBox.Size = new System.Drawing.Size(332, 280); this.groupBox.TabIndex = 1; this.groupBox.TabStop = false; this.groupBox.Text = "Camera "; // // ledPictureBox // - this.ledPictureBox.Location = new System.Drawing.Point(6, 279); + this.ledPictureBox.Location = new System.Drawing.Point(6, 261); this.ledPictureBox.Name = "ledPictureBox"; this.ledPictureBox.Size = new System.Drawing.Size(15, 15); this.ledPictureBox.TabIndex = 5; this.ledPictureBox.TabStop = false; // - // trackBar - // - this.trackBar.Location = new System.Drawing.Point(200, 264); - this.trackBar.Name = "trackBar"; - this.trackBar.Size = new System.Drawing.Size(126, 45); - this.trackBar.TabIndex = 4; - this.trackBar.Scroll += new System.EventHandler(this.trackBar_Scroll); - // - // liveButton - // - this.liveButton.Location = new System.Drawing.Point(81, 264); - this.liveButton.Name = "liveButton"; - this.liveButton.Size = new System.Drawing.Size(56, 45); - this.liveButton.TabIndex = 3; - this.liveButton.Text = "Live"; - this.liveButton.UseVisualStyleBackColor = true; - this.liveButton.Click += new System.EventHandler(this.liveButton_Click); - // - // focusButton - // - this.focusButton.Location = new System.Drawing.Point(138, 264); - this.focusButton.Name = "focusButton"; - this.focusButton.Size = new System.Drawing.Size(56, 45); - this.focusButton.TabIndex = 2; - this.focusButton.Text = "Focus"; - this.focusButton.UseVisualStyleBackColor = true; - this.focusButton.Click += new System.EventHandler(this.focusButton_Click); - // - // grabButton - // - this.grabButton.Location = new System.Drawing.Point(24, 264); - this.grabButton.Name = "grabButton"; - this.grabButton.Size = new System.Drawing.Size(56, 45); - this.grabButton.TabIndex = 1; - this.grabButton.Text = "Grab"; - this.grabButton.UseVisualStyleBackColor = true; - this.grabButton.Click += new System.EventHandler(this.grabButton_Click); - // // CameraPictureCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -121,12 +76,10 @@ namespace TBF.UiControls this.BackColor = System.Drawing.SystemColors.ButtonShadow; this.Controls.Add(this.groupBox); this.Name = "CameraPictureCtrl"; - this.Size = new System.Drawing.Size(334, 320); + this.Size = new System.Drawing.Size(332, 280); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.groupBox.ResumeLayout(false); - this.groupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar)).EndInit(); this.ResumeLayout(false); } @@ -134,11 +87,7 @@ namespace TBF.UiControls #endregion private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.GroupBox groupBox; - private System.Windows.Forms.Button liveButton; - private System.Windows.Forms.Button focusButton; - private System.Windows.Forms.Button grabButton; - private System.Windows.Forms.PictureBox ledPictureBox; - private System.Windows.Forms.TrackBar trackBar; + private System.Windows.Forms.GroupBox groupBox; + private System.Windows.Forms.PictureBox ledPictureBox; } } diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl.cs b/TestBenchFramework/UiControls/CameraPictureCtrl.cs index 5a4a24194..54b07b6cf 100644 --- a/TestBenchFramework/UiControls/CameraPictureCtrl.cs +++ b/TestBenchFramework/UiControls/CameraPictureCtrl.cs @@ -10,36 +10,35 @@ namespace TBF.UiControls { public partial class CameraPictureCtrl : UserControl { - public PictureBox PictureBox { get { return pictureBox; } } + private DateTime imageTimeStamp; + + public Image Image + { + set + { + pictureBox.Image = value; + imageTimeStamp = DateTime.Now; + ledPictureBox.BackColor = Color.Red; + } + } + + public string Caption + { + set { groupBox.Text = value; } + } public CameraPictureCtrl() { InitializeComponent(); - groupBox.Text = Strings.Camera; - grabButton.Text = Strings.Grab; - liveButton.Text = Strings.Live; - focusButton.Text = Strings.Focus; + groupBox.Text = "No info available"; } - private void grabButton_Click(object sender, EventArgs e) - { - - } - - private void liveButton_Click(object sender, EventArgs e) - { - - } - - private void focusButton_Click(object sender, EventArgs e) - { - - } - - private void trackBar_Scroll(object sender, EventArgs e) - { - - } + public void UpdateLed(DateTime now) + { + ledPictureBox.BackColor = (now - imageTimeStamp > TimeSpan.FromMilliseconds(500)) + ? SystemColors.Control + : Color.Red; + } } }