From 80bb277386af62f28445cb7d112fc9a8b1da9452 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 16 Oct 2017 12:21:45 +0200 Subject: [PATCH] Resizing of camera pictures using '+' and '-' buttons implemented. TODO: Full screen mode, ver. 2.17.699 --- Config/Entities/Enums.cs | 9 + Config/Properties/AssemblyInfo.cs | 4 +- TestBenchFramework/LocalSettings.cs | 2 + TestBenchFramework/MainWnd.cs | 15 +- TestBenchFramework/Properties/AssemblyInfo.cs | 4 +- .../Screens/PicturesTabPageCtrl.Designer.cs | 47 ++++- .../Screens/PicturesTabPageCtrl.cs | 76 ++++++++- .../Screens/PicturesTabPageCtrl.resx | 118 ++++++++++++- TestBenchFramework/TBF.csproj | 28 +++ .../UiControls/CameraPictureCtrl.cs | 32 +++- .../UiControls/CameraPictureCtrl2.Designer.cs | 130 ++++++++++++++ .../UiControls/CameraPictureCtrl2.cs | 85 +++++++++ .../UiControls/CameraPictureCtrl2.resx | 120 +++++++++++++ .../UiControls/CameraPictureCtrl3.Designer.cs | 130 ++++++++++++++ .../UiControls/CameraPictureCtrl3.cs | 84 +++++++++ .../UiControls/CameraPictureCtrl3.resx | 120 +++++++++++++ .../CameraPictureFullCtrl.Designer.cs | 161 ++++++++++++++++++ .../UiControls/CameraPictureFullCtrl.cs | 72 ++++++++ .../UiControls/CameraPictureFullCtrl.resx | 120 +++++++++++++ .../UiControls/ICameraPicture.cs | 16 ++ 20 files changed, 1351 insertions(+), 22 deletions(-) create mode 100644 TestBenchFramework/UiControls/CameraPictureCtrl2.Designer.cs create mode 100644 TestBenchFramework/UiControls/CameraPictureCtrl2.cs create mode 100644 TestBenchFramework/UiControls/CameraPictureCtrl2.resx create mode 100644 TestBenchFramework/UiControls/CameraPictureCtrl3.Designer.cs create mode 100644 TestBenchFramework/UiControls/CameraPictureCtrl3.cs create mode 100644 TestBenchFramework/UiControls/CameraPictureCtrl3.resx create mode 100644 TestBenchFramework/UiControls/CameraPictureFullCtrl.Designer.cs create mode 100644 TestBenchFramework/UiControls/CameraPictureFullCtrl.cs create mode 100644 TestBenchFramework/UiControls/CameraPictureFullCtrl.resx create mode 100644 TestBenchFramework/UiControls/ICameraPicture.cs diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs index f00d64fc0..2e808642b 100644 --- a/Config/Entities/Enums.cs +++ b/Config/Entities/Enums.cs @@ -383,6 +383,15 @@ namespace Config.Entities Count } + public enum CameraDisplayResolution + { + Small, + Medium, + Large, + // FullScreen, + Count, + } + public enum ErrorFlagsMode : sbyte { #if LANG_DE diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs index 9cedeaaaa..344376624 100644 --- a/Config/Properties/AssemblyInfo.cs +++ b/Config/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.17.693.0")] -[assembly: AssemblyFileVersion("2.17.693.0")] +[assembly: AssemblyVersion("2.17.700.0")] +[assembly: AssemblyFileVersion("2.17.700.0")] diff --git a/TestBenchFramework/LocalSettings.cs b/TestBenchFramework/LocalSettings.cs index 41aa0aa50..01d0b4287 100644 --- a/TestBenchFramework/LocalSettings.cs +++ b/TestBenchFramework/LocalSettings.cs @@ -76,6 +76,8 @@ namespace TBF public int PopupResultsTop; public int PopupResultsWidth; public int PopupResultsHeight; + + public Config.Entities.CameraDisplayResolution Resolution; [XmlArrayAttribute("ComponentsColumnWidths")] diff --git a/TestBenchFramework/MainWnd.cs b/TestBenchFramework/MainWnd.cs index e485657ea..e754719af 100644 --- a/TestBenchFramework/MainWnd.cs +++ b/TestBenchFramework/MainWnd.cs @@ -302,11 +302,16 @@ namespace TBF /// private void MainWnd_KeyPress(object sender, KeyPressEventArgs e) { - if (BenchControlPanel != null && BenchControlPanel.ProcessKey(e.KeyChar)) - { - e.Handled = true; - } - } + if (BenchControlPanel != null && BenchControlPanel.ProcessKey(e.KeyChar)) + { + e.Handled = true; + log.WarnFormat("'{0}' key pressed, handled by BenchControlPanel", e.KeyChar); + } + else + { + log.WarnFormat("'{0}' key pressed, not handled", e.KeyChar); + } + } /// /// Invoked from the UiBridge to update the activity label. diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index f783fc310..cdbb7ce74 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.697.1")] -[assembly: AssemblyFileVersion("2.17.697.1")] +[assembly: AssemblyVersion("2.17.699.1")] +[assembly: AssemblyFileVersion("2.17.699.1")] diff --git a/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs b/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs index 8f764d4f1..ba42cf296 100644 --- a/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs +++ b/TestBenchFramework/Screens/PicturesTabPageCtrl.Designer.cs @@ -33,6 +33,13 @@ namespace TBF.Screens { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PicturesTabPageCtrl)); this.picturesFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.minusButton = new System.Windows.Forms.Button(); + this.plusButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // // picturesFlowLayoutPanel @@ -42,13 +49,48 @@ namespace TBF.Screens this.picturesFlowLayoutPanel.ForeColor = System.Drawing.SystemColors.Control; this.picturesFlowLayoutPanel.Name = "picturesFlowLayoutPanel"; // + // splitContainer1 + // + this.splitContainer1.BackColor = System.Drawing.SystemColors.ControlLight; + resources.ApplyResources(this.splitContainer1, "splitContainer1"); + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.picturesFlowLayoutPanel); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.BackColor = System.Drawing.SystemColors.ControlLight; + this.splitContainer1.Panel2.Controls.Add(this.minusButton); + this.splitContainer1.Panel2.Controls.Add(this.plusButton); + // + // minusButton + // + resources.ApplyResources(this.minusButton, "minusButton"); + this.minusButton.Name = "minusButton"; + this.minusButton.UseVisualStyleBackColor = true; + this.minusButton.Click += new System.EventHandler(this.minusButton_Click); + // + // plusButton + // + resources.ApplyResources(this.plusButton, "plusButton"); + this.plusButton.Name = "plusButton"; + this.plusButton.UseVisualStyleBackColor = true; + this.plusButton.Click += new System.EventHandler(this.plusButton_Click); + // // PicturesTabPageCtrl // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Silver; - this.Controls.Add(this.picturesFlowLayoutPanel); + this.Controls.Add(this.splitContainer1); this.Name = "PicturesTabPageCtrl"; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); } @@ -56,5 +98,8 @@ namespace TBF.Screens #endregion private System.Windows.Forms.FlowLayoutPanel picturesFlowLayoutPanel; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Button minusButton; + private System.Windows.Forms.Button plusButton; } } diff --git a/TestBenchFramework/Screens/PicturesTabPageCtrl.cs b/TestBenchFramework/Screens/PicturesTabPageCtrl.cs index 94eecbd3d..f233da117 100644 --- a/TestBenchFramework/Screens/PicturesTabPageCtrl.cs +++ b/TestBenchFramework/Screens/PicturesTabPageCtrl.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; using log4net; +using Config.Entities; using TBF.Resources; using TBF.UiBridge; @@ -14,13 +15,15 @@ namespace TBF.Screens { static readonly ILog log = LogManager.GetLogger(typeof(MainWnd)); - IList cameraPictures; + CameraDisplayResolution resolution; + IList cameraPictures; public PicturesTabPageCtrl() { InitializeComponent(); - cameraPictures = new List(); + cameraPictures = new List(); + resolution = Program.LocalSettings.Resolution; System.Windows.Forms.Timer timer; timer = new System.Windows.Forms.Timer(); @@ -48,7 +51,10 @@ namespace TBF.Screens private void TimerTick() { DateTime now = DateTime.Now; - foreach (var cPic in cameraPictures) cPic.UpdateLed(now); + for (int i = 0; i < cameraPictures.Count; i++) + { + if (cameraPictures[i] != null) cameraPictures[i].UpdateLed(now); + } } void ShowInfo(object sender, CameraInfoEventArgs args) @@ -59,10 +65,17 @@ namespace TBF.Screens } else if (args.CameraIdx == cameraPictures.Count) { - TBF.UiControls.CameraPictureCtrl ctrl = new TBF.UiControls.CameraPictureCtrl(); - cameraPictures.Add(ctrl); + UserControl ctrl; + switch (resolution) + { + default: + case CameraDisplayResolution.Small: ctrl = new TBF.UiControls.CameraPictureCtrl(); break; + case CameraDisplayResolution.Medium: ctrl = new TBF.UiControls.CameraPictureCtrl2(); break; + case CameraDisplayResolution.Large: ctrl = new TBF.UiControls.CameraPictureCtrl3(); break; + } + cameraPictures.Add(ctrl as TBF.UiControls.ICameraPicture); picturesFlowLayoutPanel.Controls.Add(ctrl); - ctrl.Caption = args.Info; + (ctrl as TBF.UiControls.ICameraPicture).Caption = args.Info; } else { @@ -74,8 +87,57 @@ namespace TBF.Screens { if (args.CameraIdx < cameraPictures.Count && cameraPictures[args.CameraIdx] != null) { - cameraPictures[args.CameraIdx].Image = args.Image; + cameraPictures[args.CameraIdx].NewImage = args.Image; } } + + /// + /// Increase image resolution + /// + private void plusButton_Click(object sender, EventArgs e) + { + if (resolution < CameraDisplayResolution.Count - 1) + { + Program.LocalSettings.Resolution = ++resolution; + RedrawPictures(); + } + } + + /// + /// Decrease image resolution + /// + private void minusButton_Click(object sender, EventArgs e) + { + if (resolution > 0) + { + Program.LocalSettings.Resolution = --resolution; + RedrawPictures(); + } + } + + void RedrawPictures() + { + int nrControls = cameraPictures.Count; + TBF.UiControls.ICameraPicture[] oriCamPictures = new TBF.UiControls.ICameraPicture[nrControls]; + for (int i = 0; i < nrControls; i++) oriCamPictures[i] = cameraPictures[i]; + + cameraPictures.Clear(); + picturesFlowLayoutPanel.Controls.Clear(); + + for (int i = 0; i < nrControls; i++) + { + UserControl ctrl; + switch (resolution) + { + default: + case CameraDisplayResolution.Small: ctrl = new TBF.UiControls.CameraPictureCtrl(oriCamPictures[i]); break; + case CameraDisplayResolution.Medium: ctrl = new TBF.UiControls.CameraPictureCtrl2(oriCamPictures[i]); break; + case CameraDisplayResolution.Large: ctrl = new TBF.UiControls.CameraPictureCtrl3(oriCamPictures[i]); break; + } + + cameraPictures.Add(ctrl as TBF.UiControls.ICameraPicture); + picturesFlowLayoutPanel.Controls.Add(ctrl); + } + } } } diff --git a/TestBenchFramework/Screens/PicturesTabPageCtrl.resx b/TestBenchFramework/Screens/PicturesTabPageCtrl.resx index 06e6f4270..659fd39c5 100644 --- a/TestBenchFramework/Screens/PicturesTabPageCtrl.resx +++ b/TestBenchFramework/Screens/PicturesTabPageCtrl.resx @@ -130,7 +130,7 @@ 0, 0 - 1033, 689 + 1009, 689 0 @@ -142,11 +142,125 @@ System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - $this + splitContainer1.Panel1 0 + + Fill + + + 0, 0 + + + splitContainer1.Panel1 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer1 + + + 0 + + + Microsoft Sans Serif, 8.25pt, style=Bold + + + NoControl + + + 0, 33 + + + 23, 23 + + + 1 + + + - + + + minusButton + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer1.Panel2 + + + 0 + + + Microsoft Sans Serif, 8.25pt, style=Bold + + + 0, 7 + + + 23, 23 + + + 0 + + + + + + + plusButton + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer1.Panel2 + + + 1 + + + splitContainer1.Panel2 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer1 + + + 1 + + + 23 + + + 1033, 689 + + + 1009 + + + 1 + + + 1 + + + splitContainer1 + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + True diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 23e0744f3..722695ff1 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -1725,6 +1725,25 @@ CameraPictureCtrl.cs + + UserControl + + + CameraPictureCtrl2.cs + + + UserControl + + + CameraPictureCtrl3.cs + + + UserControl + + + CameraPictureFullCtrl.cs + + @@ -2511,6 +2530,15 @@ CameraPictureCtrl.cs + + CameraPictureCtrl2.cs + + + CameraPictureCtrl3.cs + + + CameraPictureFullCtrl.cs + MetrologyDlgDensityTab.cs diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl.cs b/TestBenchFramework/UiControls/CameraPictureCtrl.cs index 6edaa800d..eb6ff78c6 100644 --- a/TestBenchFramework/UiControls/CameraPictureCtrl.cs +++ b/TestBenchFramework/UiControls/CameraPictureCtrl.cs @@ -8,11 +8,11 @@ using TBF.Resources; namespace TBF.UiControls { - public partial class CameraPictureCtrl : UserControl + public partial class CameraPictureCtrl : UserControl, ICameraPicture { private DateTime imageTimeStamp; - public Image Image + public Image NewImage { set { @@ -21,12 +21,26 @@ namespace TBF.UiControls ledPictureBox.BackColor = Color.Red; } } - + + public Image Image + { + set { pictureBox.Image = value; } + get { return pictureBox.Image; } + } + + public DateTime TimeStamp + { + set { imageTimeStamp = value; } + get { return imageTimeStamp; } + } + public string Caption { set { captionLabel.Text = value; } + get { return captionLabel.Text; } } + public CameraPictureCtrl() { InitializeComponent(); @@ -34,6 +48,18 @@ namespace TBF.UiControls captionLabel.Text = "No info available"; } + public CameraPictureCtrl(ICameraPicture oriCamPicture) + { + InitializeComponent(); + + captionLabel.Text = oriCamPicture.Caption; + pictureBox.Image = oriCamPicture.Image; + imageTimeStamp = oriCamPicture.TimeStamp; + + UpdateLed(DateTime.Now); + } + + public void UpdateLed(DateTime now) { ledPictureBox.BackColor = (now - imageTimeStamp > TimeSpan.FromMilliseconds(500)) diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl2.Designer.cs b/TestBenchFramework/UiControls/CameraPictureCtrl2.Designer.cs new file mode 100644 index 000000000..8aaa2374f --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureCtrl2.Designer.cs @@ -0,0 +1,130 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +namespace TBF.UiControls +{ + partial class CameraPictureCtrl2 + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.captionLabel = new System.Windows.Forms.Label(); + this.ledPictureBox = new System.Windows.Forms.PictureBox(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.stopButton = new System.Windows.Forms.Button(); + this.saveButton = new System.Windows.Forms.Button(); + this.maxButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // captionLabel + // + this.captionLabel.AutoSize = true; + this.captionLabel.ForeColor = System.Drawing.Color.Black; + this.captionLabel.Location = new System.Drawing.Point(16, 4); + this.captionLabel.Name = "captionLabel"; + this.captionLabel.Size = new System.Drawing.Size(86, 13); + this.captionLabel.TabIndex = 6; + this.captionLabel.Text = "No info available"; + // + // ledPictureBox + // + this.ledPictureBox.Location = new System.Drawing.Point(2, 4); + this.ledPictureBox.Name = "ledPictureBox"; + this.ledPictureBox.Size = new System.Drawing.Size(12, 12); + this.ledPictureBox.TabIndex = 5; + this.ledPictureBox.TabStop = false; + // + // pictureBox + // + this.pictureBox.Location = new System.Drawing.Point(2, 20); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(444, 333); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // stopButton + // + this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.stopButton.Location = new System.Drawing.Point(373, 1); + this.stopButton.Name = "stopButton"; + this.stopButton.Size = new System.Drawing.Size(24, 18); + this.stopButton.TabIndex = 7; + this.stopButton.UseVisualStyleBackColor = true; + this.stopButton.Click += new System.EventHandler(this.stopButton_Click); + // + // saveButton + // + this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.saveButton.Location = new System.Drawing.Point(398, 1); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(24, 18); + this.saveButton.TabIndex = 8; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // + // maxButton + // + this.maxButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.maxButton.Location = new System.Drawing.Point(423, 1); + this.maxButton.Name = "maxButton"; + this.maxButton.Size = new System.Drawing.Size(24, 18); + this.maxButton.TabIndex = 9; + this.maxButton.UseVisualStyleBackColor = true; + this.maxButton.Click += new System.EventHandler(this.maxButton_Click); + // + // CameraPictureCtrl2 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlLight; + this.Controls.Add(this.maxButton); + this.Controls.Add(this.saveButton); + this.Controls.Add(this.stopButton); + this.Controls.Add(this.pictureBox); + this.Controls.Add(this.captionLabel); + this.Controls.Add(this.ledPictureBox); + this.Name = "CameraPictureCtrl2"; + this.Size = new System.Drawing.Size(448, 355); + ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox ledPictureBox; + private System.Windows.Forms.Label captionLabel; + private System.Windows.Forms.PictureBox pictureBox; + private System.Windows.Forms.Button stopButton; + private System.Windows.Forms.Button saveButton; + private System.Windows.Forms.Button maxButton; + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl2.cs b/TestBenchFramework/UiControls/CameraPictureCtrl2.cs new file mode 100644 index 000000000..e1343b400 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureCtrl2.cs @@ -0,0 +1,85 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +using System; +using System.Drawing; +using System.Windows.Forms; +using TBF.Resources; + +namespace TBF.UiControls +{ + public partial class CameraPictureCtrl2 : UserControl, ICameraPicture + { + private DateTime imageTimeStamp; + + public Image NewImage + { + set + { + pictureBox.Image = value; + imageTimeStamp = DateTime.Now; + ledPictureBox.BackColor = Color.Red; + } + } + + public Image Image + { + set { pictureBox.Image = value; } + get { return pictureBox.Image; } + } + + public DateTime TimeStamp + { + set { imageTimeStamp = value; } + get { return imageTimeStamp; } + } + + public string Caption + { + set { captionLabel.Text = value; } + get { return captionLabel.Text; } + } + + + public CameraPictureCtrl2() + { + InitializeComponent(); + + captionLabel.Text = "No info available"; + } + + public CameraPictureCtrl2(ICameraPicture oriCamPicture) + { + InitializeComponent(); + + captionLabel.Text = oriCamPicture.Caption; + pictureBox.Image = oriCamPicture.Image; + imageTimeStamp = oriCamPicture.TimeStamp; + + UpdateLed(DateTime.Now); + } + + + public void UpdateLed(DateTime now) + { + ledPictureBox.BackColor = (now - imageTimeStamp > TimeSpan.FromMilliseconds(500)) + ? SystemColors.Control + : Color.Red; + } + + private void stopButton_Click(object sender, EventArgs e) + { + + } + + private void saveButton_Click(object sender, EventArgs e) + { + + } + + private void maxButton_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl2.resx b/TestBenchFramework/UiControls/CameraPictureCtrl2.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureCtrl2.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UiControls/CameraPictureCtrl3.Designer.cs b/TestBenchFramework/UiControls/CameraPictureCtrl3.Designer.cs new file mode 100644 index 000000000..158e88fc6 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureCtrl3.Designer.cs @@ -0,0 +1,130 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +namespace TBF.UiControls +{ + partial class CameraPictureCtrl3 + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.captionLabel = new System.Windows.Forms.Label(); + this.ledPictureBox = new System.Windows.Forms.PictureBox(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.stopButton = new System.Windows.Forms.Button(); + this.saveButton = new System.Windows.Forms.Button(); + this.maxButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // captionLabel + // + this.captionLabel.AutoSize = true; + this.captionLabel.ForeColor = System.Drawing.Color.Black; + this.captionLabel.Location = new System.Drawing.Point(16, 4); + this.captionLabel.Name = "captionLabel"; + this.captionLabel.Size = new System.Drawing.Size(86, 13); + this.captionLabel.TabIndex = 6; + this.captionLabel.Text = "No info available"; + // + // ledPictureBox + // + this.ledPictureBox.Location = new System.Drawing.Point(2, 4); + this.ledPictureBox.Name = "ledPictureBox"; + this.ledPictureBox.Size = new System.Drawing.Size(12, 12); + this.ledPictureBox.TabIndex = 5; + this.ledPictureBox.TabStop = false; + // + // pictureBox + // + this.pictureBox.Location = new System.Drawing.Point(2, 20); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(640, 480); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // stopButton + // + this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.stopButton.Location = new System.Drawing.Point(569, 1); + this.stopButton.Name = "stopButton"; + this.stopButton.Size = new System.Drawing.Size(24, 18); + this.stopButton.TabIndex = 7; + this.stopButton.UseVisualStyleBackColor = true; + this.stopButton.Click += new System.EventHandler(this.stopButton_Click); + // + // saveButton + // + this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.saveButton.Location = new System.Drawing.Point(594, 1); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(24, 18); + this.saveButton.TabIndex = 8; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // + // maxButton + // + this.maxButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.maxButton.Location = new System.Drawing.Point(619, 1); + this.maxButton.Name = "maxButton"; + this.maxButton.Size = new System.Drawing.Size(24, 18); + this.maxButton.TabIndex = 9; + this.maxButton.UseVisualStyleBackColor = true; + this.maxButton.Click += new System.EventHandler(this.maxButton_Click); + // + // CameraPictureCtrl3 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlLight; + this.Controls.Add(this.maxButton); + this.Controls.Add(this.saveButton); + this.Controls.Add(this.stopButton); + this.Controls.Add(this.pictureBox); + this.Controls.Add(this.captionLabel); + this.Controls.Add(this.ledPictureBox); + this.Name = "CameraPictureCtrl3"; + this.Size = new System.Drawing.Size(644, 502); + ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox ledPictureBox; + private System.Windows.Forms.Label captionLabel; + private System.Windows.Forms.PictureBox pictureBox; + private System.Windows.Forms.Button stopButton; + private System.Windows.Forms.Button saveButton; + private System.Windows.Forms.Button maxButton; + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl3.cs b/TestBenchFramework/UiControls/CameraPictureCtrl3.cs new file mode 100644 index 000000000..ea5256969 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureCtrl3.cs @@ -0,0 +1,84 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +using System; +using System.Drawing; +using System.Windows.Forms; +using TBF.Resources; + +namespace TBF.UiControls +{ + public partial class CameraPictureCtrl3 : UserControl, ICameraPicture + { + private DateTime imageTimeStamp; + + public Image NewImage + { + set + { + pictureBox.Image = value; + imageTimeStamp = DateTime.Now; + ledPictureBox.BackColor = Color.Red; + } + } + + public Image Image + { + set { pictureBox.Image = value; } + get { return pictureBox.Image; } + } + + public DateTime TimeStamp + { + set { imageTimeStamp = value; } + get { return imageTimeStamp; } + } + + public string Caption + { + set { captionLabel.Text = value; } + get { return captionLabel.Text; } + } + + public CameraPictureCtrl3() + { + InitializeComponent(); + + captionLabel.Text = "No info available"; + } + + public CameraPictureCtrl3(ICameraPicture oriCamPicture) + { + InitializeComponent(); + + captionLabel.Text = oriCamPicture.Caption; + pictureBox.Image = oriCamPicture.Image; + imageTimeStamp = oriCamPicture.TimeStamp; + + UpdateLed(DateTime.Now); + } + + + public void UpdateLed(DateTime now) + { + ledPictureBox.BackColor = (now - imageTimeStamp > TimeSpan.FromMilliseconds(500)) + ? SystemColors.Control + : Color.Red; + } + + private void stopButton_Click(object sender, EventArgs e) + { + + } + + private void saveButton_Click(object sender, EventArgs e) + { + + } + + private void maxButton_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureCtrl3.resx b/TestBenchFramework/UiControls/CameraPictureCtrl3.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureCtrl3.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UiControls/CameraPictureFullCtrl.Designer.cs b/TestBenchFramework/UiControls/CameraPictureFullCtrl.Designer.cs new file mode 100644 index 000000000..a04971ef6 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureFullCtrl.Designer.cs @@ -0,0 +1,161 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +namespace TBF.UiControls +{ + partial class CameraPictureFullCtrl + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.captionLabel = new System.Windows.Forms.Label(); + this.ledPictureBox = new System.Windows.Forms.PictureBox(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.stopButton = new System.Windows.Forms.Button(); + this.saveButton = new System.Windows.Forms.Button(); + this.maxButton = new System.Windows.Forms.Button(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // captionLabel + // + this.captionLabel.AutoSize = true; + this.captionLabel.ForeColor = System.Drawing.Color.Black; + this.captionLabel.Location = new System.Drawing.Point(16, 2); + this.captionLabel.Name = "captionLabel"; + this.captionLabel.Size = new System.Drawing.Size(86, 13); + this.captionLabel.TabIndex = 6; + this.captionLabel.Text = "No info available"; + // + // ledPictureBox + // + this.ledPictureBox.Location = new System.Drawing.Point(4, 2); + this.ledPictureBox.Name = "ledPictureBox"; + this.ledPictureBox.Size = new System.Drawing.Size(12, 12); + this.ledPictureBox.TabIndex = 5; + this.ledPictureBox.TabStop = false; + // + // pictureBox + // + this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBox.Location = new System.Drawing.Point(0, 0); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(964, 720); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // stopButton + // + this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.stopButton.Location = new System.Drawing.Point(890, 0); + this.stopButton.Name = "stopButton"; + this.stopButton.Size = new System.Drawing.Size(24, 18); + this.stopButton.TabIndex = 7; + this.stopButton.UseVisualStyleBackColor = true; + this.stopButton.Click += new System.EventHandler(this.stopButton_Click); + // + // saveButton + // + this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.saveButton.Location = new System.Drawing.Point(915, 0); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(24, 18); + this.saveButton.TabIndex = 8; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // + // maxButton + // + this.maxButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.maxButton.Location = new System.Drawing.Point(940, 0); + this.maxButton.Name = "maxButton"; + this.maxButton.Size = new System.Drawing.Size(24, 18); + this.maxButton.TabIndex = 9; + this.maxButton.UseVisualStyleBackColor = true; + this.maxButton.Click += new System.EventHandler(this.maxButton_Click); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.IsSplitterFixed = true; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.captionLabel); + this.splitContainer1.Panel1.Controls.Add(this.maxButton); + this.splitContainer1.Panel1.Controls.Add(this.ledPictureBox); + this.splitContainer1.Panel1.Controls.Add(this.saveButton); + this.splitContainer1.Panel1.Controls.Add(this.stopButton); + this.splitContainer1.Panel1MinSize = 18; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.pictureBox); + this.splitContainer1.Size = new System.Drawing.Size(964, 742); + this.splitContainer1.SplitterDistance = 18; + this.splitContainer1.TabIndex = 10; + // + // CameraPictureFullCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlLight; + this.Controls.Add(this.splitContainer1); + this.Name = "CameraPictureFullCtrl"; + this.Size = new System.Drawing.Size(964, 742); + ((System.ComponentModel.ISupportInitialize)(this.ledPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox ledPictureBox; + private System.Windows.Forms.Label captionLabel; + private System.Windows.Forms.PictureBox pictureBox; + private System.Windows.Forms.Button stopButton; + private System.Windows.Forms.Button saveButton; + private System.Windows.Forms.Button maxButton; + private System.Windows.Forms.SplitContainer splitContainer1; + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureFullCtrl.cs b/TestBenchFramework/UiControls/CameraPictureFullCtrl.cs new file mode 100644 index 000000000..1d6e15b88 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureFullCtrl.cs @@ -0,0 +1,72 @@ +/// +/// Copyright (c) 2017 Sensus Metering Systems +/// +using System; +using System.Drawing; +using System.Windows.Forms; +using TBF.Resources; + +namespace TBF.UiControls +{ + public partial class CameraPictureFullCtrl : UserControl, ICameraPicture + { + private DateTime imageTimeStamp; + + public Image NewImage + { + set + { + pictureBox.Image = value; + imageTimeStamp = DateTime.Now; + ledPictureBox.BackColor = Color.Red; + } + } + + public Image Image + { + set { pictureBox.Image = value; } + get { return pictureBox.Image; } + } + + public DateTime TimeStamp + { + set { imageTimeStamp = value; } + get { return imageTimeStamp; } + } + + public string Caption + { + set { captionLabel.Text = value; } + get { return captionLabel.Text; } + } + + public CameraPictureFullCtrl() + { + InitializeComponent(); + + captionLabel.Text = "No info available"; + } + + public void UpdateLed(DateTime now) + { + ledPictureBox.BackColor = (now - imageTimeStamp > TimeSpan.FromMilliseconds(500)) + ? SystemColors.Control + : Color.Red; + } + + private void stopButton_Click(object sender, EventArgs e) + { + + } + + private void saveButton_Click(object sender, EventArgs e) + { + + } + + private void maxButton_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/TestBenchFramework/UiControls/CameraPictureFullCtrl.resx b/TestBenchFramework/UiControls/CameraPictureFullCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/UiControls/CameraPictureFullCtrl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UiControls/ICameraPicture.cs b/TestBenchFramework/UiControls/ICameraPicture.cs new file mode 100644 index 000000000..63c744bce --- /dev/null +++ b/TestBenchFramework/UiControls/ICameraPicture.cs @@ -0,0 +1,16 @@ +using System; +using System.Drawing; + +namespace TBF.UiControls +{ + public interface ICameraPicture + { + Image NewImage { set; } + + string Caption { get; set; } + Image Image { get; set; } + DateTime TimeStamp { get; set; } + + void UpdateLed(DateTime now); + } +}