Endurance cycle steps dialog added.
This commit is contained in:
@@ -30,6 +30,8 @@ namespace TBF.BenchControl.Elde.Valve
|
|||||||
|
|
||||||
public readonly ulong Mask; /// derived from bitPosition in the constructor
|
public readonly ulong Mask; /// derived from bitPosition in the constructor
|
||||||
|
|
||||||
|
public int BitPosition { get { return valveCfg.BitPosition; } }
|
||||||
|
|
||||||
|
|
||||||
public Valve()
|
public Valve()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,265 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2016 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using log4net;
|
||||||
|
using NHibernate;
|
||||||
|
using Config.Entities;
|
||||||
|
using TBF.BenchControl.GenericDevices;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.BenchControl.TestMethods.Endurance
|
||||||
|
{
|
||||||
|
public partial class CycleDlg : Form, TBF.UiControls.IParentOfListViewEx
|
||||||
|
{
|
||||||
|
static readonly ILog log = LogManager.GetLogger(typeof(CycleDlg));
|
||||||
|
|
||||||
|
/// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi
|
||||||
|
public readonly int Dpi;
|
||||||
|
public const int Dpi100pct = 96;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Transition sequences to be updated by this dialog.
|
||||||
|
/// Set by the constructor or updated by the parent after creation and before loading.
|
||||||
|
/// </summary>
|
||||||
|
public IList<CycleStep> EnduranceCycle;
|
||||||
|
|
||||||
|
|
||||||
|
/// Auxiliary public lists used also by user controls in tab pages
|
||||||
|
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
||||||
|
public IList<IValve> Valves;
|
||||||
|
|
||||||
|
|
||||||
|
TBF.UiControls.ITabWithListViewEx seqStepsCtrl;
|
||||||
|
|
||||||
|
|
||||||
|
public CycleDlg()
|
||||||
|
: this(new List<CycleStep>())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public CycleDlg(IList<CycleStep> cycle)
|
||||||
|
{
|
||||||
|
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
||||||
|
Dpi = (int)this.CreateGraphics().DpiX;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
/// SharedDlgButtons configuration
|
||||||
|
sharedButtons.RequiredGroupMembership = Config.Grp.GID.Metrologists;
|
||||||
|
sharedButtons.OptionalButtons = TBF.UiControls.SharedButtons.Buttons.Add |
|
||||||
|
TBF.UiControls.SharedButtons.Buttons.Remove |
|
||||||
|
TBF.UiControls.SharedButtons.Buttons.Up |
|
||||||
|
TBF.UiControls.SharedButtons.Buttons.Down;
|
||||||
|
sharedButtons.Unlocked += Unlocked;
|
||||||
|
sharedButtons.OKClicked += okButton_Click;
|
||||||
|
sharedButtons.CancelClicked += cancelButton_Click;
|
||||||
|
sharedButtons.AddClicked += addButton_Click;
|
||||||
|
sharedButtons.RemoveClicked += removeButton_Click;
|
||||||
|
sharedButtons.UpClicked += upButton_Click;
|
||||||
|
sharedButtons.DownClicked += downButton_Click;
|
||||||
|
|
||||||
|
seqStepsCtrl = new CycleStepsCtrl();
|
||||||
|
|
||||||
|
/// Prepare a list of valves for the endurance test
|
||||||
|
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Config.Entities.DBKind.Config));
|
||||||
|
Valves = new List<IValve>();
|
||||||
|
for (int bitNr = 0; bitNr < 8; bitNr++)
|
||||||
|
{
|
||||||
|
foreach (var vlv in TbfComponents)
|
||||||
|
{
|
||||||
|
if (vlv is BenchControl.Elde.Valve.Valve && (vlv as BenchControl.Elde.Valve.Valve).BitPosition == bitNr)
|
||||||
|
{
|
||||||
|
Valves.Add(vlv as IValve);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EnduranceCycle = (cycle != null) ? cycle : new List<CycleStep>(); /// TODO: Load from component parameters
|
||||||
|
|
||||||
|
/// Create a tab with sequence steps for each sequence ordered by ItemNr.
|
||||||
|
AddCycleStepsTab(EnduranceCycle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddCycleStepsTab(IList<CycleStep> sequence)
|
||||||
|
{
|
||||||
|
TabPage nwTab = new TabPage();
|
||||||
|
nwTab.Tag = sequence;
|
||||||
|
CycleStepsCtrl newCtrl = new CycleStepsCtrl();
|
||||||
|
seqStepsCtrl = newCtrl;
|
||||||
|
nwTab.Controls.Add(newCtrl);
|
||||||
|
tabControl.TabPages.Add(nwTab);
|
||||||
|
newCtrl.Initialize(sequence, this, tabControl.TabPages[tabControl.TabPages.Count - 1]);
|
||||||
|
newCtrl.SelectedIndexChanged += new System.EventHandler(SelectedIndexChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CycleDlg_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Localize();
|
||||||
|
|
||||||
|
TBF.LocalSettings ls = Program.LocalSettings;
|
||||||
|
Width = (ls.EnduranceDlgWidth > 0) ? ls.EnduranceDlgWidth : 1050;
|
||||||
|
Height = (ls.EnduranceDlgHeight > 0) ? ls.EnduranceDlgHeight : 360;
|
||||||
|
Left = (ls.EnduranceDlgLeft != 0) ? ls.EnduranceDlgLeft : 150;
|
||||||
|
Top = (ls.EnduranceDlgTop != 0) ? ls.EnduranceDlgTop : 150;
|
||||||
|
|
||||||
|
/// Now refresh the content of the dialog
|
||||||
|
RefreshAllTabs();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Localize()
|
||||||
|
{
|
||||||
|
Text = Strings.Endurance_cycle_steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefreshAllTabs()
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) (seqStepsCtrl as Results.Forms.ListViewEx).Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Unlocked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) seqStepsCtrl.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void okButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) seqStepsCtrl.OkBtnClicked();
|
||||||
|
|
||||||
|
//if (EnduranceCycle != null)
|
||||||
|
//{
|
||||||
|
// using (var transaction = Session.BeginTransaction())
|
||||||
|
// {
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// Session.SaveOrUpdate(EnduranceCycle);
|
||||||
|
// transaction.Commit();
|
||||||
|
// }
|
||||||
|
// catch (Exception e2)
|
||||||
|
// {
|
||||||
|
// MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
// log.ErrorFormat("Update of sequence 'Tr1' in the database failed: {0}", e2.Message);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
Program.LocalSettings.EnduranceDlgLeft = Location.X;
|
||||||
|
Program.LocalSettings.EnduranceDlgTop = Location.Y;
|
||||||
|
Program.LocalSettings.EnduranceDlgWidth = Size.Width;
|
||||||
|
Program.LocalSettings.EnduranceDlgHeight = Size.Height;
|
||||||
|
Program.LocalSettings.Save();
|
||||||
|
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Program.LocalSettings.EnduranceDlgLeft = Location.X;
|
||||||
|
Program.LocalSettings.EnduranceDlgTop = Location.Y;
|
||||||
|
Program.LocalSettings.EnduranceDlgWidth = Size.Width;
|
||||||
|
Program.LocalSettings.EnduranceDlgHeight = Size.Height;
|
||||||
|
Program.LocalSettings.Save();
|
||||||
|
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slctdTab;
|
||||||
|
|
||||||
|
private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null)
|
||||||
|
{
|
||||||
|
seqStepsCtrl.OkBtnClicked();
|
||||||
|
}
|
||||||
|
slctdTab = tabControl.SelectedIndex;
|
||||||
|
sharedButtons.SetEnabled(TBF.UiControls.SharedButtons.Buttons.Add, true);
|
||||||
|
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Remove);
|
||||||
|
RefreshAllTabs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) seqStepsCtrl.AddOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) seqStepsCtrl.RemoveSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void upButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) seqStepsCtrl.MoveUpSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void downButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (seqStepsCtrl != null) seqStepsCtrl.MoveDownSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos selectedItemPos)
|
||||||
|
{
|
||||||
|
if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.None)
|
||||||
|
{
|
||||||
|
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
|
||||||
|
TBF.UiControls.SharedButtons.Buttons.Down);
|
||||||
|
}
|
||||||
|
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.First)
|
||||||
|
{
|
||||||
|
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Down);
|
||||||
|
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up);
|
||||||
|
}
|
||||||
|
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.Last)
|
||||||
|
{
|
||||||
|
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Up);
|
||||||
|
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Down);
|
||||||
|
}
|
||||||
|
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.FirstAndLast)
|
||||||
|
{
|
||||||
|
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
|
||||||
|
TBF.UiControls.SharedButtons.Buttons.Down);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
|
||||||
|
TBF.UiControls.SharedButtons.Buttons.Down);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Common part for three xxxListViewEx_SelectedIndexChanged event handlers
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="listViewEx"></param>
|
||||||
|
void SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Results.Forms.ListViewEx listViewEx = sender as Results.Forms.ListViewEx;
|
||||||
|
if (listViewEx.SelectedItems.Count != 1)
|
||||||
|
{
|
||||||
|
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
|
||||||
|
}
|
||||||
|
else if (listViewEx.Items.Count == 1)
|
||||||
|
{
|
||||||
|
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.FirstAndLast);
|
||||||
|
}
|
||||||
|
else if (listViewEx.SelectedIndices[0] == 0)
|
||||||
|
{
|
||||||
|
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.First);
|
||||||
|
}
|
||||||
|
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
|
||||||
|
{
|
||||||
|
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.Last);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.Middle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2016 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
namespace TBF.BenchControl.TestMethods.Endurance
|
||||||
|
{
|
||||||
|
partial class CycleDlg
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleDlg));
|
||||||
|
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.tabControl = new System.Windows.Forms.TabControl();
|
||||||
|
this.sharedButtons = new TBF.UiControls.SharedButtons();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
|
||||||
|
this.mainSplitContainer.Panel1.SuspendLayout();
|
||||||
|
this.mainSplitContainer.Panel2.SuspendLayout();
|
||||||
|
this.mainSplitContainer.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// mainSplitContainer
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.mainSplitContainer, "mainSplitContainer");
|
||||||
|
this.mainSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||||
|
this.mainSplitContainer.Name = "mainSplitContainer";
|
||||||
|
//
|
||||||
|
// mainSplitContainer.Panel1
|
||||||
|
//
|
||||||
|
this.mainSplitContainer.Panel1.Controls.Add(this.tabControl);
|
||||||
|
//
|
||||||
|
// mainSplitContainer.Panel2
|
||||||
|
//
|
||||||
|
this.mainSplitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||||
|
//
|
||||||
|
// tabControl
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.tabControl, "tabControl");
|
||||||
|
this.tabControl.Name = "tabControl";
|
||||||
|
this.tabControl.SelectedIndex = 0;
|
||||||
|
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// sharedButtons
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.sharedButtons, "sharedButtons");
|
||||||
|
this.sharedButtons.Name = "sharedButtons";
|
||||||
|
//
|
||||||
|
// CycleDlg
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this, "$this");
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.mainSplitContainer);
|
||||||
|
this.Name = "CycleDlg";
|
||||||
|
this.Load += new System.EventHandler(this.CycleDlg_Load);
|
||||||
|
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
||||||
|
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).EndInit();
|
||||||
|
this.mainSplitContainer.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.SplitContainer mainSplitContainer;
|
||||||
|
private System.Windows.Forms.TabControl tabControl;
|
||||||
|
private UiControls.SharedButtons sharedButtons;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="mainSplitContainer.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
|
<value>Fill</value>
|
||||||
|
</data>
|
||||||
|
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="mainSplitContainer.IsSplitterFixed" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="mainSplitContainer.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>0, 0</value>
|
||||||
|
</data>
|
||||||
|
<data name="tabControl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
|
<value>Fill</value>
|
||||||
|
</data>
|
||||||
|
<data name="tabControl.ItemSize" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>1, 1</value>
|
||||||
|
</data>
|
||||||
|
<data name="tabControl.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>0, 0</value>
|
||||||
|
</data>
|
||||||
|
<data name="tabControl.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>760, 366</value>
|
||||||
|
</data>
|
||||||
|
<data name="tabControl.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>tabControl.Name" xml:space="preserve">
|
||||||
|
<value>tabControl</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>tabControl.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>tabControl.Parent" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer.Panel1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>tabControl.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel1.Name" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer.Panel1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel1.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel1.Parent" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel1.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name="sharedButtons.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>-1, 0</value>
|
||||||
|
</data>
|
||||||
|
<data name="sharedButtons.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>100, 636</value>
|
||||||
|
</data>
|
||||||
|
<data name="sharedButtons.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>sharedButtons.Name" xml:space="preserve">
|
||||||
|
<value>sharedButtons</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||||
|
<value>TBF.UiControls.SharedButtons, TBF, Version=2.12.404.1, Culture=neutral, PublicKeyToken=null</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer.Panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>sharedButtons.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel2.Name" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer.Panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel2.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel2.Parent" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Panel2.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name="mainSplitContainer.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>863, 366</value>
|
||||||
|
</data>
|
||||||
|
<data name="mainSplitContainer.SplitterDistance" type="System.Int32, mscorlib">
|
||||||
|
<value>760</value>
|
||||||
|
</data>
|
||||||
|
<data name="mainSplitContainer.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Name" xml:space="preserve">
|
||||||
|
<value>mainSplitContainer</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.Parent" xml:space="preserve">
|
||||||
|
<value>$this</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>mainSplitContainer.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||||
|
<value>6, 13</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>863, 366</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||||
|
<value>CenterParent</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.Text" xml:space="preserve">
|
||||||
|
<value>Cycle steps</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>$this.Name" xml:space="preserve">
|
||||||
|
<value>CycleDlg</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>$this.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace TBF.BenchControl.TestMethods.Endurance
|
||||||
|
{
|
||||||
|
public class CycleStep
|
||||||
|
{
|
||||||
|
public virtual int Duration { get; set; } /// Duration in seconds
|
||||||
|
public virtual string Message { get; set; } /// Message
|
||||||
|
public virtual int ValvesOpen { get; set; } /// List of valves to be opened
|
||||||
|
public virtual int ValvesClose { get; set; } /// List of valves to be closed
|
||||||
|
|
||||||
|
|
||||||
|
public CycleStep()
|
||||||
|
{
|
||||||
|
Duration = 1;
|
||||||
|
Message = string.Empty;
|
||||||
|
ValvesOpen = 0;
|
||||||
|
ValvesClose = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("{0}~{1}~{2}~{3}", Duration, Message, ValvesOpen, ValvesClose);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create CycleStep from a string generated previously by ToString() function
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="savedStr">String generated by ToString()</param>
|
||||||
|
public CycleStep(string savedStr)
|
||||||
|
|
||||||
|
{
|
||||||
|
string[] strArr = savedStr.Split(new char[] { '~' });
|
||||||
|
int duration;
|
||||||
|
int vO;
|
||||||
|
int vC;
|
||||||
|
if (strArr.Length != 4 || !int.TryParse(strArr[0], out duration)
|
||||||
|
|| !int.TryParse(strArr[2], out vO)
|
||||||
|
|| !int.TryParse(strArr[3], out vC))
|
||||||
|
{
|
||||||
|
Duration = 1;
|
||||||
|
Message = string.Empty;
|
||||||
|
ValvesOpen = 0;
|
||||||
|
ValvesClose = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Duration = duration;
|
||||||
|
Message = strArr[1];
|
||||||
|
ValvesOpen = vO;
|
||||||
|
ValvesClose = vC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string CycleToString(IList<CycleStep> cycle)
|
||||||
|
{
|
||||||
|
if (cycle == null) return string.Empty;
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (var step in cycle)
|
||||||
|
{
|
||||||
|
if (sb.Length > 0) sb.Append('§');
|
||||||
|
sb.Append(step.ToString());
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static IList<CycleStep> StringToCycle(string savedCycle)
|
||||||
|
{
|
||||||
|
IList<CycleStep> cycle = new List<CycleStep>();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(savedCycle))
|
||||||
|
{
|
||||||
|
|
||||||
|
string[] lines = savedCycle.Split(new char[] { '§' });
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
cycle.Add(new CycleStep(line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cycle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,258 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2016 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using log4net;
|
||||||
|
using Config.Entities;
|
||||||
|
using TBF.BenchControl.GenericDevices;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.BenchControl.TestMethods.Endurance
|
||||||
|
{
|
||||||
|
public partial class CycleStepsCtrl : TBF.UiControls.BaseWithListViewEx<CycleStep>, TBF.UiControls.ITabWithListViewEx
|
||||||
|
{
|
||||||
|
static readonly ILog log = LogManager.GetLogger(typeof(CycleStepsCtrl));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fixed ListViewEx columns
|
||||||
|
/// </summary>
|
||||||
|
enum Column
|
||||||
|
{
|
||||||
|
Duration,
|
||||||
|
Message,
|
||||||
|
FixedColumnsCount,
|
||||||
|
}
|
||||||
|
readonly int fixedCount = (int)Column.FixedColumnsCount;
|
||||||
|
|
||||||
|
IList<CycleStep> sequence;
|
||||||
|
|
||||||
|
CycleDlg parent;
|
||||||
|
Control parentControl;
|
||||||
|
Control[] editors;
|
||||||
|
|
||||||
|
int vCount; /// Number of valves
|
||||||
|
|
||||||
|
public CycleStepsCtrl()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize(IList<CycleStep> sequence, CycleDlg parent, Control parentControl)
|
||||||
|
{
|
||||||
|
this.sequence = sequence;
|
||||||
|
this.parent = parent;
|
||||||
|
this.parentControl = parentControl;
|
||||||
|
Name = "Dummy";
|
||||||
|
MyItems = sequence;
|
||||||
|
|
||||||
|
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||||
|
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||||
|
SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// ListViewEx columns
|
||||||
|
///
|
||||||
|
Columns.Add(Strings.Duration_s, 70 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||||
|
Columns.Add(Strings.Message, 100 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||||
|
///
|
||||||
|
vCount = 0;
|
||||||
|
foreach (var vlv in parent.Valves)
|
||||||
|
{
|
||||||
|
Columns.Add(vlv.Cfg.Name, 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||||
|
vCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Prepare valve combo-boxes
|
||||||
|
///
|
||||||
|
TextBox tb;
|
||||||
|
ComboBox cb;
|
||||||
|
editors = new Control[fixedCount + vCount];
|
||||||
|
|
||||||
|
/// Duration
|
||||||
|
editors[(int)Column.Duration] = tb = new TextBox();
|
||||||
|
tb.Visible = false;
|
||||||
|
parent.Controls.Add(tb);
|
||||||
|
|
||||||
|
/// Message
|
||||||
|
editors[(int)Column.Message] = tb = new TextBox();
|
||||||
|
tb.Visible = false;
|
||||||
|
parent.Controls.Add(tb);
|
||||||
|
|
||||||
|
/// Valves
|
||||||
|
for (int i = fixedCount; i < fixedCount + vCount; i++)
|
||||||
|
{
|
||||||
|
editors[i] = cb = new ComboBox();
|
||||||
|
cb.Visible = false;
|
||||||
|
cb.Items.Add("---");
|
||||||
|
cb.Items.Add(Strings.open);
|
||||||
|
cb.Items.Add(Strings.close);
|
||||||
|
parent.Controls.Add(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.RedrawAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void listViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
||||||
|
{
|
||||||
|
if (!Unlocked || e.SubItem >= editors.Length) return;
|
||||||
|
StartEditing(editors[e.SubItem], e.Item, e.SubItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void listViewEx_SubItemRightClicked(object sender, Results.Forms.SubItemEventArgs e)
|
||||||
|
{
|
||||||
|
if (!Unlocked || e.SubItem >= editors.Length) return;
|
||||||
|
|
||||||
|
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
|
||||||
|
Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
|
||||||
|
{
|
||||||
|
int columnNr = e.SubItem;
|
||||||
|
string value = null;
|
||||||
|
System.Drawing.Color backColor = System.Drawing.Color.White;
|
||||||
|
foreach (ListViewItem item in Items)
|
||||||
|
{
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
item.SubItems[columnNr].Text = value;
|
||||||
|
item.SubItems[columnNr].BackColor = backColor;
|
||||||
|
}
|
||||||
|
else if (item == e.Item)
|
||||||
|
{
|
||||||
|
value = item.SubItems[columnNr].Text;
|
||||||
|
backColor = item.SubItems[columnNr].BackColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void listViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.SubItem == (int)Column.Duration)
|
||||||
|
{
|
||||||
|
int duration;
|
||||||
|
if (!int.TryParse(e.DisplayText, out duration) || duration <= 0)
|
||||||
|
{
|
||||||
|
e.DisplayText = e.Item.Text;
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.SubItem == (int)Column.Message)
|
||||||
|
{
|
||||||
|
if (e.DisplayText.Length >= 255)
|
||||||
|
{
|
||||||
|
// Message too long
|
||||||
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((e.SubItem >= fixedCount) && (e.SubItem < fixedCount + vCount))
|
||||||
|
{
|
||||||
|
if ((e.DisplayText != Strings.open) && (e.DisplayText != Strings.close) && (e.DisplayText != "---"))
|
||||||
|
{
|
||||||
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Item.SubItems[e.SubItem].BackColor = e.DisplayText == Strings.open ? Color.LightGray : Color.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DrawOne(object myItem)
|
||||||
|
{
|
||||||
|
CycleStep step = (CycleStep)myItem;
|
||||||
|
|
||||||
|
ListViewItem lvi = new ListViewItem(step.Duration.ToString());
|
||||||
|
lvi.UseItemStyleForSubItems = false;
|
||||||
|
|
||||||
|
lvi.SubItems.Add(string.IsNullOrEmpty(step.Message) ? string.Empty : step.Message);
|
||||||
|
|
||||||
|
for (int i = 0; i < parent.Valves.Count; i++)
|
||||||
|
{
|
||||||
|
if ((step.ValvesOpen & (1 << i)) != 0)
|
||||||
|
{
|
||||||
|
lvi.SubItems.Add(Strings.open);
|
||||||
|
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = Color.LightGray;
|
||||||
|
}
|
||||||
|
else if ((step.ValvesClose & (1 << i)) != 0)
|
||||||
|
{
|
||||||
|
lvi.SubItems.Add(Strings.close);
|
||||||
|
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = Color.White;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lvi.SubItems.Add("---");
|
||||||
|
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = Color.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lvi.Tag = step;
|
||||||
|
|
||||||
|
Items.Add(lvi);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateOne(ListViewItem lvi, object myItem)
|
||||||
|
{
|
||||||
|
CycleStep step = (CycleStep)myItem;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Duration
|
||||||
|
///
|
||||||
|
int duration;
|
||||||
|
if (int.TryParse(lvi.Text, out duration) && duration > 0)
|
||||||
|
step.Duration = duration;
|
||||||
|
else
|
||||||
|
lvi.Text = step.Duration.ToString();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Message
|
||||||
|
///
|
||||||
|
if (lvi.SubItems[(int)Column.Message].Text.Length == 0)
|
||||||
|
step.Message = string.Empty;
|
||||||
|
else
|
||||||
|
step.Message = lvi.SubItems[(int)Column.Message].Text;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Valves
|
||||||
|
///
|
||||||
|
int k = 0;
|
||||||
|
int valvesOpen = 0;
|
||||||
|
int valvesClose = 0;
|
||||||
|
///
|
||||||
|
for (int i = 0; i < parent.Valves.Count; i++)
|
||||||
|
{
|
||||||
|
IValve valve = parent.Valves[i];
|
||||||
|
string lviSubitText = lvi.SubItems[fixedCount + k++].Text;
|
||||||
|
if (lviSubitText.Equals(Strings.open))
|
||||||
|
{
|
||||||
|
valvesOpen += (1 << i);
|
||||||
|
}
|
||||||
|
if (lviSubitText.Equals(Strings.close))
|
||||||
|
{
|
||||||
|
valvesClose += (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
step.ValvesOpen = valvesOpen;
|
||||||
|
step.ValvesClose = valvesClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddOne()
|
||||||
|
{
|
||||||
|
base.AddOne(new CycleStep());
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void RemoveSelected()
|
||||||
|
{
|
||||||
|
bool lastItemRemoved = base.RemoveSelected();
|
||||||
|
if (lastItemRemoved && parent != null)
|
||||||
|
{
|
||||||
|
parent.UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
{
|
{
|
||||||
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
|
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
|
||||||
|
|
||||||
|
public string Cycle;
|
||||||
|
|
||||||
/// <summary> Test parameters </summary>
|
/// <summary> Test parameters </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public TestParams TestParams;
|
public TestParams TestParams;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using log4net;
|
using log4net;
|
||||||
using TBF.BenchControl.Generic;
|
using TBF.BenchControl.Generic;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
namespace TBF.BenchControl.TestMethods.Endurance
|
namespace TBF.BenchControl.TestMethods.Endurance
|
||||||
{
|
{
|
||||||
@@ -14,6 +15,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
|
|
||||||
public bool ShowMore { get { return false; } }
|
public bool ShowMore { get { return false; } }
|
||||||
|
|
||||||
|
string cycle;
|
||||||
|
|
||||||
TestMethodCfg config;
|
TestMethodCfg config;
|
||||||
public IComponentCfg Config
|
public IComponentCfg Config
|
||||||
{
|
{
|
||||||
@@ -32,6 +35,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
|
|
||||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
enduranceCycleButton.Text = Strings.Endurance_cycle;
|
||||||
|
cycle = config.Cycle;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +54,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
public void Unlock()
|
public void Unlock()
|
||||||
{
|
{
|
||||||
nameTextBox.Enabled = true;
|
nameTextBox.Enabled = true;
|
||||||
|
enduranceCycleButton.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||||
@@ -64,8 +70,18 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||||
|
|
||||||
config.Name = nameTextBox.Text;
|
config.Name = nameTextBox.Text;
|
||||||
|
config.Cycle = cycle;
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void enduranceCycleButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CycleDlg dlg = new CycleDlg(CycleStep.StringToCycle(cycle));
|
||||||
|
if (dlg.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
cycle = CycleStep.CycleToString(dlg.EnduranceCycle);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-2
@@ -34,6 +34,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.nameLabel = new System.Windows.Forms.Label();
|
this.nameLabel = new System.Windows.Forms.Label();
|
||||||
this.classNameLabel = new System.Windows.Forms.Label();
|
this.classNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.enduranceCycleButton = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// nameTextBox
|
// nameTextBox
|
||||||
@@ -62,14 +63,26 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
this.classNameLabel.TabIndex = 3;
|
this.classNameLabel.TabIndex = 3;
|
||||||
this.classNameLabel.Text = "ComonentName";
|
this.classNameLabel.Text = "ComonentName";
|
||||||
//
|
//
|
||||||
// BasicPrinterCfgCtrl
|
// enduranceCycleButton
|
||||||
|
//
|
||||||
|
this.enduranceCycleButton.Enabled = false;
|
||||||
|
this.enduranceCycleButton.Location = new System.Drawing.Point(137, 83);
|
||||||
|
this.enduranceCycleButton.Name = "enduranceCycleButton";
|
||||||
|
this.enduranceCycleButton.Size = new System.Drawing.Size(130, 31);
|
||||||
|
this.enduranceCycleButton.TabIndex = 6;
|
||||||
|
this.enduranceCycleButton.Text = "Endurance cycle";
|
||||||
|
this.enduranceCycleButton.UseVisualStyleBackColor = true;
|
||||||
|
this.enduranceCycleButton.Click += new System.EventHandler(this.enduranceCycleButton_Click);
|
||||||
|
//
|
||||||
|
// TestMethodCfgCtrl
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.enduranceCycleButton);
|
||||||
this.Controls.Add(this.nameTextBox);
|
this.Controls.Add(this.nameTextBox);
|
||||||
this.Controls.Add(this.nameLabel);
|
this.Controls.Add(this.nameLabel);
|
||||||
this.Controls.Add(this.classNameLabel);
|
this.Controls.Add(this.classNameLabel);
|
||||||
this.Name = "BasicPrinterCfgCtrl";
|
this.Name = "TestMethodCfgCtrl";
|
||||||
this.Size = new System.Drawing.Size(300, 200);
|
this.Size = new System.Drawing.Size(300, 200);
|
||||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@@ -82,5 +95,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
private System.Windows.Forms.TextBox nameTextBox;
|
private System.Windows.Forms.TextBox nameTextBox;
|
||||||
private System.Windows.Forms.Label nameLabel;
|
private System.Windows.Forms.Label nameLabel;
|
||||||
private System.Windows.Forms.Label classNameLabel;
|
private System.Windows.Forms.Label classNameLabel;
|
||||||
|
private System.Windows.Forms.Button enduranceCycleButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,11 @@ namespace TBF
|
|||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int HistoryColumnCount { get { return (HistoryColumnWidths != null) ? HistoryColumnWidths.Length : 0; } }
|
public int HistoryColumnCount { get { return (HistoryColumnWidths != null) ? HistoryColumnWidths.Length : 0; } }
|
||||||
|
|
||||||
|
/// Endurance test cycle steps
|
||||||
|
public int EnduranceDlgLeft;
|
||||||
|
public int EnduranceDlgTop;
|
||||||
|
public int EnduranceDlgWidth;
|
||||||
|
public int EnduranceDlgHeight;
|
||||||
|
|
||||||
/// Serial numbers
|
/// Serial numbers
|
||||||
public string[] LastSNTexts;
|
public string[] LastSNTexts;
|
||||||
|
|||||||
+18
@@ -1176,6 +1176,24 @@ namespace TBF.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Endurance cycle.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Endurance_cycle {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Endurance_cycle", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Endurance cycle steps.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Endurance_cycle_steps {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Endurance_cycle_steps", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Energy.
|
/// Looks up a localized string similar to Energy.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1594,4 +1594,10 @@
|
|||||||
<data name="Do_you_want_to_save_changes" xml:space="preserve">
|
<data name="Do_you_want_to_save_changes" xml:space="preserve">
|
||||||
<value>Do you want to save changes?</value>
|
<value>Do you want to save changes?</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Endurance_cycle_steps" xml:space="preserve">
|
||||||
|
<value>Endurance cycle steps</value>
|
||||||
|
</data>
|
||||||
|
<data name="Endurance_cycle" xml:space="preserve">
|
||||||
|
<value>Endurance cycle</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -567,6 +567,7 @@
|
|||||||
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
|
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BenchControl\TestMethods\Endurance\Component.cs" />
|
<Compile Include="BenchControl\TestMethods\Endurance\Component.cs" />
|
||||||
|
<Compile Include="BenchControl\TestMethods\Endurance\CycleStep.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" />
|
<Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\Endurance\Factory.cs" />
|
<Compile Include="BenchControl\TestMethods\Endurance\Factory.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\Endurance\TestMethodCfg.cs" />
|
<Compile Include="BenchControl\TestMethods\Endurance\TestMethodCfg.cs" />
|
||||||
@@ -577,6 +578,15 @@
|
|||||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BenchControl\TestMethods\Endurance\TestParams.cs" />
|
<Compile Include="BenchControl\TestMethods\Endurance\TestParams.cs" />
|
||||||
|
<Compile Include="BenchControl\TestMethods\Endurance\CycleDlg.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="BenchControl\TestMethods\Endurance\CycleDlg.designer.cs">
|
||||||
|
<DependentUpon>CycleDlg.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="BenchControl\TestMethods\Endurance\CycleStepsCtrl.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\FixedStartAdvancedSeq.cs" />
|
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\FixedStartAdvancedSeq.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\Single\Component.cs" />
|
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\Single\Component.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\Single\Factory.cs" />
|
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\Single\Factory.cs" />
|
||||||
@@ -1818,6 +1828,9 @@
|
|||||||
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\TestMethodCfgCtrl.resx">
|
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\TestMethodCfgCtrl.resx">
|
||||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\CycleDlg.resx">
|
||||||
|
<DependentUpon>CycleDlg.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="BenchControl\TestMethods\FixedStartMassCollection\HeatMeters\TestMethodCfgCtrl.resx">
|
<EmbeddedResource Include="BenchControl\TestMethods\FixedStartMassCollection\HeatMeters\TestMethodCfgCtrl.resx">
|
||||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
Reference in New Issue
Block a user