2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2018-05-22 13:33:07 +00:00
|
|
|
|
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
using System.Text;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
|
|
|
|
using TBF.BenchControl.Generic;
|
|
|
|
|
|
using TBF.BenchControl.GenericDevices;
|
2015-12-04 16:17:20 +00:00
|
|
|
|
using Config.Entities;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using TBF.Resources;
|
|
|
|
|
|
using TBF.UiControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TBF
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class ProcedureDlg : Form, IParentOfListViewEx
|
|
|
|
|
|
{
|
|
|
|
|
|
static readonly ILog log = LogManager.GetLogger(typeof(ProcedureDlg));
|
|
|
|
|
|
|
|
|
|
|
|
/// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi
|
|
|
|
|
|
public readonly int Dpi;
|
|
|
|
|
|
public const int Dpi100pct = 96;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Procedure to be updated by this dialog.
|
|
|
|
|
|
/// Set by the constructor or updated by the parent after creation and before loading.
|
|
|
|
|
|
/// </summary>
|
2015-12-04 16:17:20 +00:00
|
|
|
|
public Procedure LoadedProcedure;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
public int SelectedTestIx; /// -1 = none, 0 = 1st = top
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
IList<string> usedNames; /// Already used names
|
2017-06-29 14:58:59 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Auxiliary public lists used also by user controls in tab pages
|
|
|
|
|
|
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
|
|
|
|
|
public IList<IValve> Valves;
|
|
|
|
|
|
public IList<IRegulValve> RegulValves;
|
|
|
|
|
|
public IList<ITestMethod> TestMethods;
|
|
|
|
|
|
public IList<ITestMethod> UsedTestMethods;
|
|
|
|
|
|
ComboBox methodCBox;
|
|
|
|
|
|
|
|
|
|
|
|
/// Auxiliary private lists
|
|
|
|
|
|
IList<FeedingPath> feedingPaths;
|
|
|
|
|
|
IList<BenchPath> benchPaths;
|
|
|
|
|
|
IList<OutputPath> outputPaths;
|
|
|
|
|
|
IList<MetersPath> metersPaths;
|
2016-06-28 16:04:52 +00:00
|
|
|
|
IList<HeatMetersPath> heatMetersPaths;
|
|
|
|
|
|
IList<TransitionSequence> transitionSequences;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
IList<TestParamsCtrl> testParamsCtrls;
|
|
|
|
|
|
IList<ProcedureParamsCtrl> procedureParamsCtrls;
|
|
|
|
|
|
|
|
|
|
|
|
bool unlocked;
|
|
|
|
|
|
|
|
|
|
|
|
public ProcedureDlg()
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
|
|
|
|
|
Dpi = (int)this.CreateGraphics().DpiX;
|
|
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
/// SharedDlgButtons configuration
|
2018-09-24 12:15:04 +00:00
|
|
|
|
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
|
2014-07-28 07:54:35 +00:00
|
|
|
|
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
|
|
|
|
|
SharedButtons.Buttons.Up | 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;
|
|
|
|
|
|
|
|
|
|
|
|
/// ListViewEx-es configuration
|
2016-08-19 08:43:48 +00:00
|
|
|
|
metrology1ListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(metrology1ListViewEx_SubItemClicked);
|
|
|
|
|
|
metrology1ListViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(metrology1ListViewEx_SubItemRightClicked);
|
|
|
|
|
|
metrology1ListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(metrology1ListViewEx_SubItemEndEditing);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
metrology2ListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(metrology2ListViewEx_SubItemClicked);
|
|
|
|
|
|
metrology2ListViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(metrology2ListViewEx_SubItemRightClicked);
|
|
|
|
|
|
metrology2ListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(metrology2ListViewEx_SubItemEndEditing);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
processListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(processListViewEx_SubItemClicked);
|
|
|
|
|
|
processListViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(processListViewEx_SubItemRightClicked);
|
|
|
|
|
|
processListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(processListViewEx_SubItemEndEditing);
|
2015-01-17 05:34:24 +00:00
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
parametersListViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(parametersListViewEx_SubItemClicked);
|
|
|
|
|
|
parametersListViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(parametersListViewEx_SubItemRightClicked);
|
|
|
|
|
|
parametersListViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(parametersListViewEx_SubItemEndEditing);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
|
|
|
|
|
|
SelectedTestIx = -1;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-06-29 14:58:59 +00:00
|
|
|
|
public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
: this()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (procedure == null) throw new ArgumentNullException("procedure");
|
|
|
|
|
|
|
|
|
|
|
|
LoadedProcedure = procedure;
|
|
|
|
|
|
|
2017-06-29 14:58:59 +00:00
|
|
|
|
this.usedNames = usedNames;
|
|
|
|
|
|
|
2018-09-24 12:15:04 +00:00
|
|
|
|
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists }
|
|
|
|
|
|
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
|
2017-05-03 20:19:26 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Prepare a list of components and a list of all valves in the test bench
|
2017-03-16 20:53:12 +00:00
|
|
|
|
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session);
|
|
|
|
|
|
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);
|
|
|
|
|
|
RegulValves = new List<IRegulValve>();
|
|
|
|
|
|
TestMethods = new List<ITestMethod>();
|
2015-08-30 06:31:53 +00:00
|
|
|
|
dataEntryComboBox.Items.Add("---");
|
2016-05-02 08:19:26 +00:00
|
|
|
|
printer1ComboBox.Items.Add("---");
|
2016-05-03 12:07:26 +00:00
|
|
|
|
printer2ComboBox.Items.Add("---");
|
|
|
|
|
|
fileWriter1ComboBox.Items.Add("---");
|
2016-05-02 08:19:26 +00:00
|
|
|
|
fileWriter2ComboBox.Items.Add("---");
|
2016-05-03 12:07:26 +00:00
|
|
|
|
fileWriter3ComboBox.Items.Add("---");
|
|
|
|
|
|
fileWriter4ComboBox.Items.Add("---");
|
2016-04-29 14:58:23 +00:00
|
|
|
|
foreach (var cmpnt in TbfComponents)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve);
|
|
|
|
|
|
if (cmpnt is ITestMethod) TestMethods.Add(cmpnt as ITestMethod);
|
|
|
|
|
|
if (cmpnt is IDataEntry) dataEntryComboBox.Items.Add(cmpnt.Cfg.Name);
|
2016-05-03 12:07:26 +00:00
|
|
|
|
if (cmpnt is IResultsPrinter)
|
|
|
|
|
|
{
|
|
|
|
|
|
printer1ComboBox.Items.Add(cmpnt.Cfg.Name);
|
|
|
|
|
|
printer2ComboBox.Items.Add(cmpnt.Cfg.Name);
|
|
|
|
|
|
}
|
2016-04-29 14:58:23 +00:00
|
|
|
|
if (cmpnt is IResultsWriter)
|
|
|
|
|
|
{
|
2016-05-02 08:19:26 +00:00
|
|
|
|
fileWriter1ComboBox.Items.Add(cmpnt.Cfg.Name);
|
|
|
|
|
|
fileWriter2ComboBox.Items.Add(cmpnt.Cfg.Name);
|
2016-05-03 12:07:26 +00:00
|
|
|
|
fileWriter3ComboBox.Items.Add(cmpnt.Cfg.Name);
|
|
|
|
|
|
fileWriter4ComboBox.Items.Add(cmpnt.Cfg.Name);
|
2016-04-29 14:58:23 +00:00
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call
|
2017-03-16 20:53:12 +00:00
|
|
|
|
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2016-12-02 10:04:33 +00:00
|
|
|
|
feedingPaths = session.QueryOver<FeedingPath>().List();
|
|
|
|
|
|
benchPaths = session.QueryOver<BenchPath>().List();
|
|
|
|
|
|
outputPaths = session.QueryOver<OutputPath>().List();
|
|
|
|
|
|
metersPaths = session.QueryOver<MetersPath>().List();
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if HEAT_METERS
|
2016-12-02 10:04:33 +00:00
|
|
|
|
heatMetersPaths = session.QueryOver<HeatMetersPath>().List();
|
|
|
|
|
|
#else
|
|
|
|
|
|
heatMetersPaths = new List<HeatMetersPath>();
|
2016-06-28 16:04:52 +00:00
|
|
|
|
#endif
|
2016-12-02 10:04:33 +00:00
|
|
|
|
transitionSequences = session.QueryOver<TransitionSequence>().List();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-08-30 06:31:53 +00:00
|
|
|
|
transitionStartComboBox.Items.Add("---");
|
|
|
|
|
|
transitionEndComboBox.Items.Add("---");
|
2014-07-28 07:54:35 +00:00
|
|
|
|
foreach (var trans in transitionSequences)
|
|
|
|
|
|
{
|
|
|
|
|
|
transitionStartComboBox.Items.Add(trans.Name);
|
|
|
|
|
|
transitionEndComboBox.Items.Add(trans.Name);
|
|
|
|
|
|
}
|
2015-08-30 06:31:53 +00:00
|
|
|
|
|
|
|
|
|
|
///--------------------------------------------------------------------------------------
|
|
|
|
|
|
///-------------------------- Tab pages with test parameters --------------------------
|
|
|
|
|
|
///--------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
testParamsCtrls = new List<TestParamsCtrl>(); /// Initialize the list
|
|
|
|
|
|
|
|
|
|
|
|
///---------------------
|
|
|
|
|
|
/// Used test methods
|
|
|
|
|
|
///---------------------
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Find all test methods used in this procedure
|
|
|
|
|
|
UsedTestMethods = new List<ITestMethod>();
|
|
|
|
|
|
foreach (var test in LoadedProcedure.Tests)
|
|
|
|
|
|
{
|
|
|
|
|
|
ITestMethod method = BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
|
|
|
|
|
|
if (method != null && !UsedTestMethods.Contains(method)) UsedTestMethods.Add(method);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Create a tab with a TestParamsCtrl control for each used test method
|
|
|
|
|
|
foreach (var method in UsedTestMethods)
|
|
|
|
|
|
{
|
2018-05-10 11:25:46 +00:00
|
|
|
|
if (method.Cfg.GetRuntimeTestParamsProvider() != null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
TestParamsCtrl nwCtrl = new TestParamsCtrl(this, method, true);
|
|
|
|
|
|
testParamsCtrls.Add(nwCtrl);
|
|
|
|
|
|
|
|
|
|
|
|
TabPage nwTab = new TabPage(method.Cfg.Name);
|
|
|
|
|
|
nwTab.Controls.Add(nwCtrl);
|
|
|
|
|
|
nwTab.Tag = nwCtrl;
|
|
|
|
|
|
tabControl.TabPages.Add(nwTab);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-08-30 06:31:53 +00:00
|
|
|
|
/// Create a control for another component with Test parameters which was not handled yet
|
|
|
|
|
|
foreach (var cmpnt in TbfComponents)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-05-10 11:25:46 +00:00
|
|
|
|
if ((cmpnt.Cfg.GetRuntimeTestParamsProvider() != null) && !(cmpnt is ITestMethod))
|
2015-08-30 06:31:53 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
TestParamsCtrl nwCtrl = new TestParamsCtrl(this, cmpnt, true);
|
|
|
|
|
|
testParamsCtrls.Add(nwCtrl);
|
|
|
|
|
|
|
|
|
|
|
|
TabPage nwTab = new TabPage(cmpnt.Cfg.Name);
|
2015-08-30 06:31:53 +00:00
|
|
|
|
nwTab.Controls.Add(nwCtrl);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
nwTab.Tag = nwCtrl;
|
|
|
|
|
|
this.tabControl.TabPages.Add(nwTab);
|
2015-08-30 06:31:53 +00:00
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-08-30 06:31:53 +00:00
|
|
|
|
///--------------------------------------------------------------------------------------
|
|
|
|
|
|
///----------------------- Tab pages with procedure parameters ------------------------
|
|
|
|
|
|
///--------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
procedureParamsCtrls = new List<ProcedureParamsCtrl>(); /// Initialize the list
|
|
|
|
|
|
|
|
|
|
|
|
///----------------
|
|
|
|
|
|
/// Water meters
|
|
|
|
|
|
///----------------
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Create a control for the water meters and add it to the list.
|
|
|
|
|
|
IList<IComponent> waterMeters = new List<IComponent>();
|
|
|
|
|
|
foreach (var cmpnt in TbfComponents)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (cmpnt is IWaterMeter) waterMeters.Add(cmpnt);
|
|
|
|
|
|
}
|
2015-08-30 06:31:53 +00:00
|
|
|
|
|
|
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
ProcedureParamsCtrl newCtrl = new ProcedureParamsCtrl(this, waterMeters, false);
|
|
|
|
|
|
procedureParamsCtrls.Add(newCtrl);
|
|
|
|
|
|
|
|
|
|
|
|
TabPage newTab = new TabPage(Strings.Water_meters);
|
2015-08-30 06:31:53 +00:00
|
|
|
|
newTab.Controls.Add(newCtrl);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
newTab.Tag = newCtrl;
|
|
|
|
|
|
tabControl.TabPages.Add(newTab);
|
2015-08-30 06:31:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///---------------------
|
|
|
|
|
|
/// Used sensor paths
|
|
|
|
|
|
///---------------------
|
|
|
|
|
|
|
|
|
|
|
|
/// Prepare a list of all meters paths used in this procedure (in any test)
|
|
|
|
|
|
IList<string> usedMPaths = new List<string>();
|
|
|
|
|
|
foreach (var test in LoadedProcedure.Tests)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (test.MetersPath != null && !usedMPaths.Contains(test.MetersPath)) usedMPaths.Add(test.MetersPath);
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Create controls for each sensors path used in this procedure.
|
|
|
|
|
|
/// Initialize it with its components (sensors or cameras) and add it to the list.
|
|
|
|
|
|
foreach (var usedPathName in usedMPaths)
|
|
|
|
|
|
{
|
2015-12-04 16:17:20 +00:00
|
|
|
|
MetersPath usedPath = null;
|
|
|
|
|
|
try { usedPath = metersPaths.First<MetersPath>(x => (x.Name == usedPathName)); }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
catch { }
|
|
|
|
|
|
if (usedPath != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
IList<IComponent> cmpntsInMPath = new List<IComponent>();
|
2015-12-04 16:17:20 +00:00
|
|
|
|
for (int i = 0; i < Config.Data.WMsCount; i++)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
IComponent sensor = TbfComponents.FirstOrDefault<IComponent>(x => (x.Cfg.Name.Equals(usedPath.GetSensor(i))));
|
|
|
|
|
|
cmpntsInMPath.Add(sensor);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
ProcedureParamsCtrl nwCtrl = new ProcedureParamsCtrl(this, cmpntsInMPath, true);
|
|
|
|
|
|
procedureParamsCtrls.Add(nwCtrl);
|
|
|
|
|
|
|
|
|
|
|
|
TabPage nwTab = new TabPage(usedPathName);
|
2015-08-30 06:31:53 +00:00
|
|
|
|
nwTab.Controls.Add(nwCtrl);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
nwTab.Tag = nwCtrl;
|
|
|
|
|
|
tabControl.TabPages.Add(nwTab);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-03-09 15:13:23 +00:00
|
|
|
|
///---------------------
|
|
|
|
|
|
/// Other components
|
|
|
|
|
|
///---------------------
|
|
|
|
|
|
|
|
|
|
|
|
/// Create a control for the water meters and add it to the list.
|
|
|
|
|
|
IList<IComponent> other = new List<IComponent>();
|
|
|
|
|
|
foreach (var cmpnt in TbfComponents)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2017-03-09 15:13:23 +00:00
|
|
|
|
if (cmpnt is TBF.BenchControl.Modbus.Easytherm.Easytherm) other.Add(cmpnt);
|
2017-03-09 15:13:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (other.Count > 0)
|
|
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
ProcedureParamsCtrl newCtrl = new ProcedureParamsCtrl(this, other, false);
|
|
|
|
|
|
procedureParamsCtrls.Add(newCtrl);
|
|
|
|
|
|
|
|
|
|
|
|
TabPage newTab = new TabPage(Strings.Temperature);
|
2017-03-09 15:13:23 +00:00
|
|
|
|
newTab.Controls.Add(newCtrl);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
newTab.Tag = newCtrl;
|
|
|
|
|
|
tabControl.TabPages.Add(newTab);
|
2015-08-30 06:31:53 +00:00
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ProcedureDlg_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2015-09-25 07:22:11 +00:00
|
|
|
|
Localize();
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (LoadedProcedure == null) return; /// return in case the dialog is open in the designer
|
|
|
|
|
|
|
2014-09-07 07:34:28 +00:00
|
|
|
|
TBF.LocalSettings ls = Program.LocalSettings;
|
|
|
|
|
|
Width = (ls.OneProcedureDlgWidth > 0) ? ls.OneProcedureDlgWidth : 1050;
|
|
|
|
|
|
Height = (ls.OneProcedureDlgHeight > 0) ? ls.OneProcedureDlgHeight : 420;
|
|
|
|
|
|
Left = (ls.OneProcedureDlgLeft != 0) ? ls.OneProcedureDlgLeft : 150;
|
|
|
|
|
|
Top = (ls.OneProcedureDlgTop != 0) ? ls.OneProcedureDlgTop : 150;
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
/// Enable/disable/show/hide controls in General tab
|
2017-07-24 06:32:56 +00:00
|
|
|
|
#if IPERL
|
2018-05-22 13:33:07 +00:00
|
|
|
|
altProcNameLabel.Visible = true;
|
|
|
|
|
|
altProcNameTextBox.Visible = true;
|
|
|
|
|
|
altProcPeriodLabel.Visible = true;
|
|
|
|
|
|
altProcPeriodTextBox.Visible = true;
|
2017-07-24 06:32:56 +00:00
|
|
|
|
#endif
|
2018-05-22 13:33:07 +00:00
|
|
|
|
procNameTextBox.Enabled = false;
|
|
|
|
|
|
descriptionTextBox.Enabled = false;
|
|
|
|
|
|
watermetersTextBox.Enabled = false;
|
2017-05-03 20:19:26 +00:00
|
|
|
|
protectedCheckBox.Enabled = false;
|
|
|
|
|
|
mustBeCompleteCheckBox.Enabled = false;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
manualControlDisabledCheckBox.Enabled = false;
|
2017-06-26 14:11:47 +00:00
|
|
|
|
altProcNameTextBox.Enabled = false;
|
|
|
|
|
|
altProcPeriodTextBox.Enabled = false;
|
2017-05-03 20:19:26 +00:00
|
|
|
|
dataEntryComboBox.Enabled = false;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
transitionStartComboBox.Enabled = false;
|
|
|
|
|
|
transitionEndComboBox.Enabled = false;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
printer1ComboBox.Enabled = false;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
printer2ComboBox.Enabled = false;
|
|
|
|
|
|
fileWriter1ComboBox.Enabled = false;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
fileWriter2ComboBox.Enabled = false;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
fileWriter3ComboBox.Enabled = false;
|
|
|
|
|
|
fileWriter4ComboBox.Enabled = false;
|
|
|
|
|
|
metersKindRadioButton1.Enabled = false;
|
|
|
|
|
|
metersKindRadioButton2.Enabled = false;
|
2016-06-28 16:04:52 +00:00
|
|
|
|
metersKindRadioButton3.Enabled = false;
|
|
|
|
|
|
notesTextBox.Enabled = false;
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if !HEAT_METERS
|
2016-06-28 16:04:52 +00:00
|
|
|
|
metersKindRadioButton3.Visible = false;
|
|
|
|
|
|
#endif
|
2018-05-22 13:33:07 +00:00
|
|
|
|
/// Make some controls readonly
|
2014-07-28 07:54:35 +00:00
|
|
|
|
createdByTextBox.ReadOnly = true;
|
|
|
|
|
|
createdOnTextBox.ReadOnly = true;
|
|
|
|
|
|
lastChangedByTextBox.ReadOnly = true;
|
|
|
|
|
|
lastChangedOnTextBox.ReadOnly = true;
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
/// History tab
|
|
|
|
|
|
InitializeHistoryTab(); /// Create ListViewEx columns for 'History of changes'
|
|
|
|
|
|
|
|
|
|
|
|
/// LisViewEx columns and edit controls for 'Metrology1', 'Metrology2', 'Process' and 'Parameters' tabs
|
|
|
|
|
|
PrepareMetrology1Tab();
|
|
|
|
|
|
PrepareMetrology2Tab();
|
|
|
|
|
|
PrepareProcess();
|
|
|
|
|
|
PrepareParameters();
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Now refresh the content of the dialog
|
2018-05-22 13:33:07 +00:00
|
|
|
|
RefreshGeneralTab();
|
|
|
|
|
|
RefreshMetrology1Tab();
|
|
|
|
|
|
RefreshMetrology2Tab();
|
|
|
|
|
|
RefreshProcessTab();
|
|
|
|
|
|
RefreshParametersTab();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var ctrl in testParamsCtrls)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
ctrl.Initialize();
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var ctrl in procedureParamsCtrls)
|
|
|
|
|
|
{
|
|
|
|
|
|
ctrl.Initialize();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-09-25 07:22:11 +00:00
|
|
|
|
void Localize()
|
|
|
|
|
|
{
|
2016-06-28 16:04:52 +00:00
|
|
|
|
Text = Strings.Procedure;
|
|
|
|
|
|
|
|
|
|
|
|
generalTabPage.Text = Strings.General;
|
|
|
|
|
|
historyTabPage.Text = Strings.History_of_changes;
|
|
|
|
|
|
metrology1TabPage.Text = Strings.Metrology + " I.";
|
|
|
|
|
|
metrology2TabPage.Text = Strings.Metrology + " II.";
|
|
|
|
|
|
processTabPage.Text = Strings.Process;
|
|
|
|
|
|
parametersTabPage.Text = Strings.Parameters;
|
|
|
|
|
|
|
|
|
|
|
|
label1.Text = Strings.Procedure_name;
|
|
|
|
|
|
label12.Text = Strings.Short_description;
|
|
|
|
|
|
label13.Text = Strings.Created_by;
|
|
|
|
|
|
label16.Text = Strings.Last_changed_by;
|
|
|
|
|
|
label14.Text = Strings.Date;
|
|
|
|
|
|
label15.Text = Strings.Date;
|
|
|
|
|
|
label18.Text = Strings.Notes;
|
|
|
|
|
|
watermetersLabel.Text = Strings.Meter_types_tested;
|
2017-05-03 20:19:26 +00:00
|
|
|
|
protectedCheckBox.Text = Strings.Protected_procedure;
|
|
|
|
|
|
mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed;
|
|
|
|
|
|
manualControlDisabledCheckBox.Text = Strings.Manual_control_disabled;
|
2016-06-28 16:04:52 +00:00
|
|
|
|
dataEntryLabel.Text = Strings.Data_entry;
|
|
|
|
|
|
transitionStartLabel.Text = Strings.Purge_Begin;
|
|
|
|
|
|
transitionEndLabel.Text = Strings.Purge_End;
|
|
|
|
|
|
resultsPrinterLabel.Text = Strings.Printing;
|
|
|
|
|
|
resultsWriterLabel.Text = Strings.Saving_results;
|
|
|
|
|
|
|
2015-09-25 07:22:11 +00:00
|
|
|
|
metersKindRadioButton1.Text = Strings.SingleBtnText;
|
2016-06-28 16:04:52 +00:00
|
|
|
|
metersKindRadioButton2.Text = Strings.Compound;
|
|
|
|
|
|
metersKindRadioButton3.Text = Strings.Heat_meter;
|
|
|
|
|
|
}
|
2015-09-25 07:22:11 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
#region General
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshGeneralTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
procNameTextBox.Text = LoadedProcedure.Name;
|
2018-04-27 12:08:34 +00:00
|
|
|
|
Text = string.Format("{0} {1} {2}", Strings.Procedure, LoadedProcedure.ItemNr + 1, LoadedProcedure.Name);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
descriptionTextBox.Text = LoadedProcedure.Description;
|
|
|
|
|
|
createdByTextBox.Text = LoadedProcedure.CreationUser;
|
2016-06-27 13:24:10 +00:00
|
|
|
|
createdOnTextBox.Text = LoadedProcedure.CreationTime.ToString();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
lastChangedByTextBox.Text = LoadedProcedure.LastChgUser;
|
|
|
|
|
|
if (LoadedProcedure.LastChgTime > LoadedProcedure.CreationTime)
|
|
|
|
|
|
{
|
2016-06-27 13:24:10 +00:00
|
|
|
|
lastChangedOnTextBox.Text = LoadedProcedure.LastChgTime.ToString();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2015-01-25 22:43:17 +00:00
|
|
|
|
watermetersTextBox.Text = LoadedProcedure.Watermeters;
|
2017-05-03 20:19:26 +00:00
|
|
|
|
protectedCheckBox.Checked = LoadedProcedure.Protected;
|
|
|
|
|
|
mustBeCompleteCheckBox.Checked = LoadedProcedure.MustBeComplete;
|
|
|
|
|
|
manualControlDisabledCheckBox.Checked = LoadedProcedure.ManualCtrlDisabled;
|
2014-07-28 12:07:47 +00:00
|
|
|
|
dataEntryComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.DataEntry) ? "---" : LoadedProcedure.DataEntry;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
transitionStartComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionStart) ? "---" : LoadedProcedure.TransitionStart;
|
|
|
|
|
|
transitionEndComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionEnd) ? "---" : LoadedProcedure.TransitionEnd;
|
|
|
|
|
|
|
2017-06-26 14:11:47 +00:00
|
|
|
|
altProcNameTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
|
|
|
|
|
|
altProcPeriodTextBox.Text = LoadedProcedure.AltProcPeriod.ToString();
|
|
|
|
|
|
|
2016-05-02 08:19:26 +00:00
|
|
|
|
if (string.IsNullOrEmpty(LoadedProcedure.ResultsPrinter))
|
|
|
|
|
|
{
|
|
|
|
|
|
printer1ComboBox.Text = "---";
|
|
|
|
|
|
printer2ComboBox.Text = "---";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] fields = LoadedProcedure.ResultsPrinter.Split(new char[] { '~' });
|
|
|
|
|
|
printer1ComboBox.Text = fields[0];
|
|
|
|
|
|
printer2ComboBox.Text = (fields.Length == 2) ? fields[1] : "---";
|
|
|
|
|
|
}
|
2016-04-29 14:58:23 +00:00
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(LoadedProcedure.ResultsWriter))
|
|
|
|
|
|
{
|
2016-05-02 08:19:26 +00:00
|
|
|
|
fileWriter1ComboBox.Text = "---";
|
|
|
|
|
|
fileWriter2ComboBox.Text = "---";
|
|
|
|
|
|
fileWriter3ComboBox.Text = "---";
|
|
|
|
|
|
fileWriter4ComboBox.Text = "---";
|
|
|
|
|
|
}
|
2016-04-29 14:58:23 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] fields = LoadedProcedure.ResultsWriter.Split(new char[] { '~' });
|
2016-05-02 08:19:26 +00:00
|
|
|
|
fileWriter1ComboBox.Text = fields[0];
|
|
|
|
|
|
fileWriter2ComboBox.Text = (fields.Length >= 2) ? fields[1] : "---";
|
|
|
|
|
|
fileWriter3ComboBox.Text = (fields.Length >= 3) ? fields[2] : "---";
|
|
|
|
|
|
fileWriter4ComboBox.Text = (fields.Length >= 4) ? fields[3] : "---";
|
|
|
|
|
|
}
|
2016-04-29 14:58:23 +00:00
|
|
|
|
|
2016-06-28 16:04:52 +00:00
|
|
|
|
metersKindRadioButton1.Checked = (LoadedProcedure.MetersKind == MetersKind.Single
|
|
|
|
|
|
|| (LoadedProcedure.MetersKind != MetersKind.Combined && LoadedProcedure.MetersKind != MetersKind.HeatMeter));
|
2016-05-02 08:19:26 +00:00
|
|
|
|
metersKindRadioButton2.Checked = (LoadedProcedure.MetersKind == MetersKind.Combined);
|
2016-06-28 16:04:52 +00:00
|
|
|
|
metersKindRadioButton3.Checked = (LoadedProcedure.MetersKind == MetersKind.HeatMeter);
|
|
|
|
|
|
|
|
|
|
|
|
notesTextBox.Text = LoadedProcedure.LongDescription;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateFromGeneralTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadedProcedure.Name = procNameTextBox.Text;
|
2018-04-27 12:08:34 +00:00
|
|
|
|
Text = string.Format("{0} {1} {2}", Strings.Procedure, LoadedProcedure.ItemNr + 1, LoadedProcedure.Name);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
LoadedProcedure.Description = descriptionTextBox.Text;
|
|
|
|
|
|
LoadedProcedure.Watermeters = watermetersTextBox.Text;
|
2015-01-25 22:43:17 +00:00
|
|
|
|
|
2017-05-03 20:19:26 +00:00
|
|
|
|
LoadedProcedure.Protected = protectedCheckBox.Checked;
|
|
|
|
|
|
LoadedProcedure.MustBeComplete = mustBeCompleteCheckBox.Checked;
|
|
|
|
|
|
LoadedProcedure.ManualCtrlDisabled = manualControlDisabledCheckBox.Checked;
|
|
|
|
|
|
|
2017-06-26 14:11:47 +00:00
|
|
|
|
LoadedProcedure.AltProcName = altProcNameTextBox.Text.Equals("---") ? string.Empty : altProcNameTextBox.Text;
|
|
|
|
|
|
|
|
|
|
|
|
int itmp;
|
|
|
|
|
|
if (int.TryParse(altProcPeriodTextBox.Text, out itmp) && itmp >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadedProcedure.AltProcPeriod = itmp;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-05-02 08:19:26 +00:00
|
|
|
|
if (transitionStartComboBox.Items.Contains(transitionStartComboBox.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadedProcedure.TransitionStart = transitionStartComboBox.Text.Equals("---") ? string.Empty : transitionStartComboBox.Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (transitionEndComboBox.Items.Contains(transitionEndComboBox.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadedProcedure.TransitionEnd = transitionEndComboBox.Text.Equals("---") ? string.Empty : transitionEndComboBox.Text;
|
|
|
|
|
|
}
|
2014-07-28 12:07:47 +00:00
|
|
|
|
if (dataEntryComboBox.Items.Contains(dataEntryComboBox.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadedProcedure.DataEntry = dataEntryComboBox.Text.Equals("---") ? string.Empty : dataEntryComboBox.Text;
|
|
|
|
|
|
}
|
2016-04-29 14:58:23 +00:00
|
|
|
|
|
2016-05-02 08:19:26 +00:00
|
|
|
|
if (printer1ComboBox.Items.Contains(printer1ComboBox.Text) && printer2ComboBox.Items.Contains(printer2ComboBox.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
bool pr = !printer1ComboBox.Text.Equals("---");
|
2017-06-01 10:38:52 +00:00
|
|
|
|
bool pr2 = !printer2ComboBox.Text.Equals("---") && !printer2ComboBox.Text.Equals(printer1ComboBox.Text);
|
2016-05-02 08:19:26 +00:00
|
|
|
|
|
|
|
|
|
|
if (!pr && !pr2) LoadedProcedure.ResultsPrinter = string.Empty;
|
|
|
|
|
|
else if (pr && !pr2) LoadedProcedure.ResultsPrinter = printer1ComboBox.Text;
|
|
|
|
|
|
else if (!pr && pr2) LoadedProcedure.ResultsPrinter = printer2ComboBox.Text;
|
|
|
|
|
|
else LoadedProcedure.ResultsPrinter = printer1ComboBox.Text + '~' + printer2ComboBox.Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fileWriter1ComboBox.Items.Contains(fileWriter1ComboBox.Text) &&
|
|
|
|
|
|
fileWriter2ComboBox.Items.Contains(fileWriter2ComboBox.Text) &&
|
|
|
|
|
|
fileWriter3ComboBox.Items.Contains(fileWriter3ComboBox.Text) &&
|
|
|
|
|
|
fileWriter4ComboBox.Items.Contains(fileWriter4ComboBox.Text))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2016-05-02 08:19:26 +00:00
|
|
|
|
bool first = true;
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
if (!fileWriter1ComboBox.Text.Equals("---"))
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.Append(fileWriter1ComboBox.Text);
|
2016-05-03 12:07:26 +00:00
|
|
|
|
first = false;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
}
|
2017-06-01 10:38:52 +00:00
|
|
|
|
if (!fileWriter2ComboBox.Text.Equals("---") && !fileWriter2ComboBox.Text.Equals(fileWriter1ComboBox.Text))
|
2016-05-02 08:19:26 +00:00
|
|
|
|
{
|
2016-05-03 12:07:26 +00:00
|
|
|
|
if (!first) sb.Append("~");
|
2016-05-02 08:19:26 +00:00
|
|
|
|
sb.Append(fileWriter2ComboBox.Text);
|
2016-05-03 12:07:26 +00:00
|
|
|
|
first = false;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
}
|
2017-06-01 10:38:52 +00:00
|
|
|
|
if (!fileWriter3ComboBox.Text.Equals("---") && !fileWriter3ComboBox.Text.Equals(fileWriter1ComboBox.Text)
|
|
|
|
|
|
&& !fileWriter3ComboBox.Text.Equals(fileWriter2ComboBox.Text))
|
2016-05-02 08:19:26 +00:00
|
|
|
|
{
|
2016-05-03 12:07:26 +00:00
|
|
|
|
if (!first) sb.Append("~"); first = false;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
sb.Append(fileWriter3ComboBox.Text);
|
2016-05-03 12:07:26 +00:00
|
|
|
|
first = false;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
}
|
2017-06-01 10:38:52 +00:00
|
|
|
|
if (!fileWriter4ComboBox.Text.Equals("---") && !fileWriter4ComboBox.Text.Equals(fileWriter1ComboBox.Text)
|
|
|
|
|
|
&& !fileWriter4ComboBox.Text.Equals(fileWriter2ComboBox.Text)
|
|
|
|
|
|
&& !fileWriter4ComboBox.Text.Equals(fileWriter3ComboBox.Text))
|
2016-05-02 08:19:26 +00:00
|
|
|
|
{
|
2016-05-03 12:07:26 +00:00
|
|
|
|
if (!first) sb.Append("~");
|
2016-05-02 08:19:26 +00:00
|
|
|
|
sb.Append(fileWriter4ComboBox.Text);
|
|
|
|
|
|
}
|
|
|
|
|
|
LoadedProcedure.ResultsWriter = sb.ToString();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2016-05-02 08:19:26 +00:00
|
|
|
|
|
2016-06-28 16:04:52 +00:00
|
|
|
|
LoadedProcedure.MetersKind = (metersKindRadioButton1.Checked ? MetersKind.Single
|
|
|
|
|
|
: (metersKindRadioButton2.Checked ? MetersKind.Combined
|
|
|
|
|
|
: MetersKind.HeatMeter));
|
2016-05-02 08:19:26 +00:00
|
|
|
|
LoadedProcedure.LongDescription = notesTextBox.Text;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2015-11-26 22:51:49 +00:00
|
|
|
|
#region History
|
|
|
|
|
|
|
|
|
|
|
|
void InitializeHistoryTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
TBF.LocalSettings ls = Program.LocalSettings;
|
|
|
|
|
|
|
2018-10-11 11:53:24 +00:00
|
|
|
|
historyListViewEx.Columns.Add(Strings.Name, (ls.HistoryColumnCount > 0) ? ls.HistoryColumnWidths[0] : 80);
|
|
|
|
|
|
historyListViewEx.Columns.Add(Strings.Revision, (ls.HistoryColumnCount > 0) ? ls.HistoryColumnWidths[0] : 80);
|
|
|
|
|
|
historyListViewEx.Columns.Add(Strings.Date_and_time, (ls.HistoryColumnCount > 1) ? ls.HistoryColumnWidths[1] : 120);
|
|
|
|
|
|
historyListViewEx.Columns.Add(Strings.User, (ls.HistoryColumnCount > 2) ? ls.HistoryColumnWidths[2] : 55);
|
|
|
|
|
|
historyListViewEx.Columns.Add(Strings.DescriptionColHdr, (ls.HistoryColumnCount > 3) ? ls.HistoryColumnWidths[3] : 150);
|
|
|
|
|
|
historyListViewEx.Columns.Add(Strings.Other, (ls.HistoryColumnCount > 3) ? ls.HistoryColumnWidths[3] : 150);
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
|
|
|
|
|
RefreshHistoryTab();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshHistoryTab()
|
|
|
|
|
|
{
|
2017-03-16 20:53:12 +00:00
|
|
|
|
NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
|
2015-12-04 16:17:20 +00:00
|
|
|
|
IList<Procedure> procedures = session
|
2016-12-02 10:04:33 +00:00
|
|
|
|
.QueryOver<Procedure>()
|
|
|
|
|
|
.Where(x => x.ProcedureState == ProcedureState.History)
|
|
|
|
|
|
.List();
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
|
|
|
|
|
int predecessorId = LoadedProcedure.PredecessorId;
|
|
|
|
|
|
|
2015-12-04 16:17:20 +00:00
|
|
|
|
IList<Procedure> oneProcedure = session
|
2016-12-02 10:04:33 +00:00
|
|
|
|
.QueryOver<Procedure>()
|
|
|
|
|
|
.Where(x => (x.ProcedureState == ProcedureState.Active))
|
|
|
|
|
|
.And(x => (x.Id == predecessorId))
|
|
|
|
|
|
.List();
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
|
|
|
|
|
if (oneProcedure.Count == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
predecessorId = oneProcedure[0].PredecessorId;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while (predecessorId != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool found = false;
|
|
|
|
|
|
foreach (var p in procedures)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (p.Id == predecessorId)
|
|
|
|
|
|
{
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
ListViewItem item = new ListViewItem(p.Name);
|
|
|
|
|
|
item.SubItems.Add(p.Revision.ToString());
|
2016-06-27 13:24:10 +00:00
|
|
|
|
item.SubItems.Add(p.LastChgTime.ToString());
|
2015-11-26 22:51:49 +00:00
|
|
|
|
item.SubItems.Add(p.LastChgUser.ToString());
|
|
|
|
|
|
item.SubItems.Add(p.Description);
|
2018-10-11 11:53:24 +00:00
|
|
|
|
|
|
|
|
|
|
string other = string.Empty;
|
|
|
|
|
|
//if ((p.Watermeters != null) && (p.Watermeters.Count > 0) && (p.Watermeters[0] != null)) other = p.Watermeters[0];
|
|
|
|
|
|
item.SubItems.Add(other);
|
|
|
|
|
|
|
|
|
|
|
|
historyListViewEx.Items.Add(item);
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
|
|
|
|
|
predecessorId = p.PredecessorId; /// Iterate
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!found) break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateFromHistoryTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Do nothing
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
#region Metrology1
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
Control[] metrology1Editors;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
public enum MtrlgyClmn
|
|
|
|
|
|
{
|
|
|
|
|
|
Name,
|
|
|
|
|
|
Part,
|
|
|
|
|
|
Qfrom,
|
|
|
|
|
|
Qto,
|
|
|
|
|
|
Volume,
|
|
|
|
|
|
TestTime,
|
2017-06-08 13:42:47 +00:00
|
|
|
|
ErrLimLo,
|
|
|
|
|
|
ErrLimHi,
|
2015-01-04 22:21:12 +00:00
|
|
|
|
Method,
|
2017-06-08 13:42:47 +00:00
|
|
|
|
Repeats,
|
|
|
|
|
|
CoulumnsCount
|
2015-01-04 22:21:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PrepareMetrology1Tab()
|
|
|
|
|
|
{
|
2017-06-08 13:42:47 +00:00
|
|
|
|
Results.Forms.ListViewEx lv = metrology1ListViewEx;
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_from_m3h, Width = 80 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_to_m3h, Width = 80 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Volume + " [l]", Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_time_s_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 });
|
|
|
|
|
|
//lv.Columns.Add(new ColumnHeader { Text = Strings.Zeroing_chdr, Width = 50 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Method_chdr, Width = 200 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 });
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
methodCBox = new ComboBox();
|
|
|
|
|
|
foreach (var m in TestMethods) methodCBox.Items.Add(m.Cfg.Name);
|
|
|
|
|
|
|
|
|
|
|
|
metrology1Editors = new Control[]
|
|
|
|
|
|
{
|
2015-01-04 22:21:12 +00:00
|
|
|
|
new TextBox(), /// Name
|
|
|
|
|
|
new TextBox(), /// Part
|
|
|
|
|
|
new TextBox(), /// Qfrom
|
|
|
|
|
|
new TextBox(), /// Qto
|
|
|
|
|
|
new TextBox(), /// Volume
|
|
|
|
|
|
new TextBox(), /// Test time
|
2017-06-08 13:42:47 +00:00
|
|
|
|
new TextBox(), /// Err.Lim. -
|
|
|
|
|
|
new TextBox(), /// Err.Lim. +
|
2015-01-04 22:21:12 +00:00
|
|
|
|
methodCBox, /// Method
|
2017-06-08 13:42:47 +00:00
|
|
|
|
new TextBox(), /// Repeats count
|
2014-07-28 07:54:35 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
foreach (var ctrl in metrology1Editors)
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology1TabPage.Controls.Add(ctrl);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void RefreshMetrology1Tab()
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology1ListViewEx.Items.Clear();
|
|
|
|
|
|
foreach (var test in LoadedProcedure.Tests) AddToMetrology1Tab(test);
|
2018-06-04 06:55:50 +00:00
|
|
|
|
|
|
|
|
|
|
if (0 <= SelectedTestIx && SelectedTestIx < metrology1ListViewEx.Items.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology1ListViewEx.Items[SelectedTestIx].Selected = true;
|
|
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AddToMetrology1Tab(Test test)
|
|
|
|
|
|
{
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Metrology 1 item with subitems
|
|
|
|
|
|
///
|
|
|
|
|
|
ListViewItem lvi = new ListViewItem(test.Name); /// Name
|
|
|
|
|
|
lvi.Tag = test;
|
|
|
|
|
|
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
|
|
|
|
|
|
lvi.SubItems.Add(test.Qfrom.ToString()); /// Q_from
|
|
|
|
|
|
lvi.SubItems.Add(test.Qto.ToString()); /// Q_to
|
|
|
|
|
|
lvi.SubItems.Add(test.Volume.ToString()); /// VOlume
|
|
|
|
|
|
lvi.SubItems.Add(test.TstTime.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.ErrLimLo.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.ErrLimHi.ToString());
|
|
|
|
|
|
//lvi.SubItems.Add(test.Zeroing ? Strings.yes : Strings.no);
|
|
|
|
|
|
lvi.SubItems.Add((test.Method != null) ? test.Method.ToString() : string.Empty);
|
|
|
|
|
|
lvi.SubItems.Add(test.Repeats.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
metrology1ListViewEx.Items.Add(lvi);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateFromMetrology1Tab()
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < metrology1ListViewEx.Items.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
ListViewItem lvi = metrology1ListViewEx.Items[i];
|
|
|
|
|
|
Test entity = (Test)lvi.Tag;
|
|
|
|
|
|
|
|
|
|
|
|
entity.Name = lvi.Text;
|
2018-09-04 06:38:57 +00:00
|
|
|
|
entity.ItemNr = i;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
|
|
|
|
|
|
int part = entity.Part;
|
|
|
|
|
|
if (lvi.SubItems[(int)MtrlgyClmn.Part].Text.Equals("-"))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.Part = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Part].Text, out part))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.Part = part;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qfrom].Text, out tmp)) entity.Qfrom = tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qto].Text, out tmp)) entity.Qto = tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Volume].Text, out tmp)) entity.Volume = tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TestTime].Text,out tmp)) entity.TstTime = tmp;
|
|
|
|
|
|
|
|
|
|
|
|
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp;
|
|
|
|
|
|
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp;
|
|
|
|
|
|
|
|
|
|
|
|
if (methodCBox.Items.Contains(lvi.SubItems[(int)MtrlgyClmn.Method].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.Method = lvi.SubItems[(int)MtrlgyClmn.Method].Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int itmp;
|
|
|
|
|
|
if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Repeats].Text, out itmp)) entity.Repeats = itmp;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void metrology1ListViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unlocked && (e.SubItem < (int)MtrlgyClmn.CoulumnsCount))
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void metrology1ListViewEx_SubItemRightClicked(object sender, Results.Forms.SubItemEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!unlocked || e.SubItem >= (int)MtrlgyClmn.CoulumnsCount) 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 metrology1ListViewEx.Items)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (value != null && item.SubItems.Count > columnNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void metrology1ListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
|
|
|
|
|
{
|
2018-06-13 05:41:03 +00:00
|
|
|
|
if (e.SubItem == (int)MtrlgyClmn.Name)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!Utils.IsGoodFName(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
int dummy;
|
|
|
|
|
|
if (e.SubItem == (int)MtrlgyClmn.Part)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.DisplayText.Equals("-")) return; /// OK
|
|
|
|
|
|
if (!int.TryParse(e.DisplayText, out dummy) || dummy < 1 || dummy > Config.Data.MaxPartNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((e.SubItem == (int)MtrlgyClmn.Repeats) && !int.TryParse(e.DisplayText, out dummy))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((e.SubItem != (int)MtrlgyClmn.Qfrom) &&
|
|
|
|
|
|
(e.SubItem != (int)MtrlgyClmn.Qto) &&
|
|
|
|
|
|
(e.SubItem != (int)MtrlgyClmn.Volume) &&
|
|
|
|
|
|
(e.SubItem != (int)MtrlgyClmn.TestTime))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float Qfrom = 1.0f;
|
|
|
|
|
|
float Qto = 1.0f;
|
|
|
|
|
|
float volume = 0.0f;
|
|
|
|
|
|
float testTime = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
bool calculateVolume = false;
|
|
|
|
|
|
bool calculateTime = false;
|
|
|
|
|
|
bool allOk = true;
|
|
|
|
|
|
|
|
|
|
|
|
if ((e.SubItem == (int)MtrlgyClmn.Qfrom) && Utils.TryParseUFloat(e.DisplayText, out Qfrom))
|
|
|
|
|
|
{
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out Qto);
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
|
|
|
|
|
if (allOk) calculateTime = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if ((e.SubItem == (int)MtrlgyClmn.Qto) && Utils.TryParseUFloat(e.DisplayText, out Qto))
|
|
|
|
|
|
{
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out Qfrom);
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
|
|
|
|
|
if (allOk) calculateTime = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if ((e.SubItem == (int)MtrlgyClmn.Volume) && Utils.TryParseUFloat(e.DisplayText, out volume))
|
|
|
|
|
|
{
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out Qfrom);
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out Qto);
|
|
|
|
|
|
if (allOk) calculateTime = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if ((e.SubItem == (int)MtrlgyClmn.TestTime) && Utils.TryParseUFloat(e.DisplayText, out testTime))
|
|
|
|
|
|
{
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out Qfrom);
|
|
|
|
|
|
allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out Qto);
|
|
|
|
|
|
if (allOk) calculateVolume = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float Qave_lps = (Qfrom + Qto) / 7.2f;
|
|
|
|
|
|
if (calculateTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
testTime = volume / Qave_lps;
|
|
|
|
|
|
e.Item.SubItems[(int)MtrlgyClmn.TestTime].Text = testTime.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (calculateVolume)
|
|
|
|
|
|
{
|
|
|
|
|
|
volume = testTime * Qave_lps;
|
|
|
|
|
|
e.Item.SubItems[(int)MtrlgyClmn.Volume].Text = volume.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Metrology2
|
|
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
public enum Mtrlgy2Clmn
|
|
|
|
|
|
{
|
|
|
|
|
|
Name,
|
|
|
|
|
|
Part,
|
2017-06-08 13:42:47 +00:00
|
|
|
|
TankDraining,
|
2016-01-01 23:54:21 +00:00
|
|
|
|
Uncertainty,
|
2017-06-08 13:42:47 +00:00
|
|
|
|
ControlWaterTemp,
|
|
|
|
|
|
TempLimLo,
|
|
|
|
|
|
TempLimHi,
|
2015-01-04 22:21:12 +00:00
|
|
|
|
Filter,
|
2016-01-01 23:54:21 +00:00
|
|
|
|
Publish,
|
|
|
|
|
|
Evaluate,
|
2017-06-08 13:42:47 +00:00
|
|
|
|
ColumnsCount
|
2015-01-04 22:21:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Control[] metrology2Editors;
|
|
|
|
|
|
|
|
|
|
|
|
void PrepareMetrology2Tab()
|
|
|
|
|
|
{
|
2017-06-08 13:42:47 +00:00
|
|
|
|
Results.Forms.ListViewEx lv = metrology2ListViewEx;
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Emptying_chdr, Width = 60 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Uncertainty_pct_chdr, Width = 90 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Control_water_temp_chdr, Width = 110 });
|
2017-11-21 08:31:24 +00:00
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_hi_chdr), Width = 100 });
|
2017-06-08 13:42:47 +00:00
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = "Filter", Width = 80 }); /// Strings.Tol_red_pct_chdr
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Publish, Width = 100 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Evaluate, Width = 100 });
|
|
|
|
|
|
//lv.Columns.Add(new ColumnHeader { Text = Strings.Red_type_chdr, Width = 80 });
|
|
|
|
|
|
//lv.Columns.Add(new ColumnHeader { Text = Strings.Err_cor_neg_pct_chdr, Width = 90 });
|
|
|
|
|
|
//lv.Columns.Add(new ColumnHeader { Text = Strings.Err_cor_pos_pct_chdr, Width = 90 });
|
2015-01-04 22:21:12 +00:00
|
|
|
|
|
2016-02-25 17:04:18 +00:00
|
|
|
|
ComboBox publishCBox = new ComboBox(); /// control for Publish
|
|
|
|
|
|
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
|
|
|
|
|
|
{
|
2016-06-03 12:30:44 +00:00
|
|
|
|
publishCBox.Items.Add(pb.ToDescription());
|
2016-02-25 17:04:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-01 23:54:21 +00:00
|
|
|
|
|
2017-06-08 13:42:47 +00:00
|
|
|
|
ComboBox yesNo1CBox = new ComboBox(); /// control for Emptying
|
|
|
|
|
|
yesNo1CBox.Items.Add(Strings.yes);
|
|
|
|
|
|
yesNo1CBox.Items.Add(Strings.no);
|
|
|
|
|
|
|
|
|
|
|
|
ComboBox yesNo2CBox = new ComboBox(); /// control for Control water temp.
|
|
|
|
|
|
yesNo2CBox.Items.Add(Strings.yes);
|
|
|
|
|
|
yesNo2CBox.Items.Add(Strings.no);
|
|
|
|
|
|
|
|
|
|
|
|
ComboBox yesNo3CBox = new ComboBox(); /// control for Evaluate
|
|
|
|
|
|
yesNo3CBox.Items.Add(Strings.yes);
|
|
|
|
|
|
yesNo3CBox.Items.Add(Strings.no);
|
2016-01-01 23:54:21 +00:00
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
metrology2Editors = new Control[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new TextBox(), /// Name
|
|
|
|
|
|
new TextBox(), /// Part
|
2017-06-08 13:42:47 +00:00
|
|
|
|
yesNo1CBox, /// Emptying
|
2016-01-01 23:54:21 +00:00
|
|
|
|
new TextBox(), /// Uncertainty
|
2017-06-08 13:42:47 +00:00
|
|
|
|
yesNo2CBox, /// Control water temp.
|
|
|
|
|
|
new TextBox(), /// Temp. lim. lo
|
|
|
|
|
|
new TextBox(), /// Temp. lim. hi
|
2015-01-04 22:21:12 +00:00
|
|
|
|
new TextBox(), /// Filter
|
2016-02-25 17:04:18 +00:00
|
|
|
|
publishCBox, /// Publish
|
2017-06-08 13:42:47 +00:00
|
|
|
|
yesNo3CBox, /// Evaluate
|
2015-01-04 22:21:12 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var ctrl in metrology2Editors)
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology2TabPage.Controls.Add(ctrl);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void RefreshMetrology2Tab()
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology2ListViewEx.Items.Clear();
|
|
|
|
|
|
foreach (var test in LoadedProcedure.Tests) AddToMetrology2Tab(test);
|
2018-06-04 06:55:50 +00:00
|
|
|
|
|
|
|
|
|
|
if (0 <= SelectedTestIx && SelectedTestIx < metrology2ListViewEx.Items.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
metrology2ListViewEx.Items[SelectedTestIx].Selected = true;
|
|
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
2015-01-04 22:21:12 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void AddToMetrology2Tab(Test test)
|
|
|
|
|
|
{
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Metrology 2 item with subitems
|
|
|
|
|
|
///
|
|
|
|
|
|
ListViewItem lvi = new ListViewItem(test.Name); /// Name
|
|
|
|
|
|
lvi.Tag = test;
|
|
|
|
|
|
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
|
|
|
|
|
|
lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no);
|
|
|
|
|
|
lvi.SubItems.Add(test.Uncertainty.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.DoControlWaterTemp ? Strings.yes : Strings.no);
|
|
|
|
|
|
lvi.SubItems.Add(test.TempLimLo.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.TempLimHi.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.TolerRed.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(((Config.Entities.Publish)test.Publish).ToDescription());
|
|
|
|
|
|
lvi.SubItems.Add(test.DoEvaluate ? Strings.yes : Strings.no);
|
|
|
|
|
|
|
|
|
|
|
|
metrology2ListViewEx.Items.Add(lvi);
|
|
|
|
|
|
}
|
2015-01-04 22:21:12 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void UpdateFromMetrology2Tab()
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
for (int i = 0; i < metrology2ListViewEx.Items.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
ListViewItem lvi = metrology2ListViewEx.Items[i];
|
|
|
|
|
|
Test entity = (Test)lvi.Tag;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
entity.Name = lvi.Text;
|
2018-09-04 06:38:57 +00:00
|
|
|
|
entity.ItemNr = i;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
|
|
|
|
|
|
int part = entity.Part;
|
|
|
|
|
|
if (lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text.Equals("-"))
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
entity.Part = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (int.TryParse(lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text, out part))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.Part = part;
|
|
|
|
|
|
}
|
2015-01-04 22:21:12 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (lvi.SubItems[(int)Mtrlgy2Clmn.TankDraining].Text.Equals(Strings.yes)) entity.DoDraining = true;
|
|
|
|
|
|
else if (lvi.SubItems[(int)Mtrlgy2Clmn.TankDraining].Text.Equals(Strings.no)) entity.DoDraining = false;
|
2015-01-04 22:21:12 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.yes)) entity.DoControlWaterTemp = true;
|
|
|
|
|
|
else if (lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.no)) entity.DoControlWaterTemp = false;
|
2015-01-04 22:21:12 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
float tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Uncertainty].Text, out tmp)) entity.Uncertainty = tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Filter].Text, out tmp)) entity.TolerRed = (double)tmp;
|
|
|
|
|
|
|
|
|
|
|
|
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(pb.ToDescription()))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.Publish = (sbyte)pb;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.yes)) entity.DoEvaluate = true;
|
|
|
|
|
|
else if (lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.no)) entity.DoEvaluate = false;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void metrology2ListViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
metrology2ListViewEx.StartEditing(metrology2Editors[e.SubItem], e.Item, e.SubItem);
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void metrology2ListViewEx_SubItemRightClicked(object sender, Results.Forms.SubItemEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
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 metrology2ListViewEx.Items)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (value != null && item.SubItems.Count > columnNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void metrology2ListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
|
|
|
|
|
{
|
2018-06-13 05:41:03 +00:00
|
|
|
|
if (e.SubItem == (int)Mtrlgy2Clmn.Name)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!Utils.IsGoodFName(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if ((e.SubItem == (int)Mtrlgy2Clmn.TankDraining) && !(metrology2Editors[(int)Mtrlgy2Clmn.TankDraining] as ComboBox).Items.Contains(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((e.SubItem == (int)Mtrlgy2Clmn.ControlWaterTemp) && !(metrology2Editors[(int)Mtrlgy2Clmn.ControlWaterTemp] as ComboBox).Items.Contains(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((e.SubItem == (int)Mtrlgy2Clmn.Evaluate) && !(metrology2Editors[(int)Mtrlgy2Clmn.Evaluate] as ComboBox).Items.Contains(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int dummy;
|
|
|
|
|
|
if (e.SubItem == (int)Mtrlgy2Clmn.Part)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.DisplayText.Equals("-")) return; /// OK
|
|
|
|
|
|
if (!int.TryParse(e.DisplayText, out dummy) || dummy < 1 || dummy > Config.Data.MaxPartNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (e.SubItem == (int)Mtrlgy2Clmn.Publish)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.DisplayText.Equals(pb.ToDescription())) return;
|
|
|
|
|
|
}
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Process
|
|
|
|
|
|
|
|
|
|
|
|
public enum ProcessClmn
|
2015-01-17 05:34:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
Name,
|
|
|
|
|
|
Part,
|
2018-05-22 13:33:07 +00:00
|
|
|
|
Feeding,
|
|
|
|
|
|
Bench,
|
|
|
|
|
|
Output,
|
|
|
|
|
|
Sensor,
|
|
|
|
|
|
#if HEAT_METERS
|
|
|
|
|
|
HeatMeterSensors,
|
2016-11-17 09:24:07 +00:00
|
|
|
|
#endif
|
2018-05-22 13:33:07 +00:00
|
|
|
|
TrnStart,
|
2018-11-14 07:23:01 +00:00
|
|
|
|
TrnBetween,
|
2018-05-22 13:33:07 +00:00
|
|
|
|
TrnStop,
|
2017-06-08 13:42:47 +00:00
|
|
|
|
ColumnsCount
|
2015-01-17 05:34:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
Control[] processEditors;
|
2015-01-17 05:34:24 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void PrepareProcess()
|
|
|
|
|
|
{
|
|
|
|
|
|
Results.Forms.ListViewEx lv = processListViewEx;
|
2017-06-08 13:42:47 +00:00
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
|
2018-05-22 13:33:07 +00:00
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Feeding_chdr, Width = 80 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Bench_chdr, Width = 80 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Output_chdr, Width = 80 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Sensors_chdr, Width = 80 });
|
|
|
|
|
|
#if HEAT_METERS
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Heat_meter_sensors, Width = 110 });
|
2016-11-17 09:24:07 +00:00
|
|
|
|
#endif
|
2018-05-22 13:33:07 +00:00
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionStart_chdr, Width = 100 });
|
2018-11-14 07:23:01 +00:00
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionBetween_chdr, Width = 100 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionEnd_chdr, Width = 100 });
|
2015-01-17 05:34:24 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
processEditors = new Control[]
|
2015-01-17 05:34:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
new TextBox(), /// Name
|
|
|
|
|
|
new TextBox(), /// Part
|
2018-05-22 13:33:07 +00:00
|
|
|
|
new ComboBox(), /// Feeding
|
|
|
|
|
|
new ComboBox(), /// Table
|
|
|
|
|
|
new ComboBox(), /// Output
|
|
|
|
|
|
new ComboBox(), /// Meters
|
|
|
|
|
|
#if HEAT_METERS
|
|
|
|
|
|
new ComboBox(), /// Heat meters
|
2016-11-17 09:24:07 +00:00
|
|
|
|
#endif
|
2018-11-14 07:23:01 +00:00
|
|
|
|
new ComboBox(), /// Transition-Start
|
|
|
|
|
|
new ComboBox(), /// Transition-Between
|
|
|
|
|
|
new ComboBox(), /// Transition-End
|
2015-01-17 05:34:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
foreach (var path in feedingPaths) ((ComboBox)processEditors[(int)ProcessClmn.Feeding]).Items.Add(path.Name);
|
|
|
|
|
|
foreach (var path in benchPaths) ((ComboBox)processEditors[(int)ProcessClmn.Bench]).Items.Add(path.Name);
|
|
|
|
|
|
foreach (var path in outputPaths) ((ComboBox)processEditors[(int)ProcessClmn.Output]).Items.Add(path.Name);
|
|
|
|
|
|
foreach (var path in metersPaths) ((ComboBox)processEditors[(int)ProcessClmn.Sensor]).Items.Add(path.Name);
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if HEAT_METERS
|
2018-05-22 13:33:07 +00:00
|
|
|
|
foreach (var path in heatMetersPaths) ((ComboBox)processEditors[(int)ProcessClmn.HeatMeterSensors]).Items.Add(path.Name);
|
2016-11-17 09:24:07 +00:00
|
|
|
|
#endif
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
((ComboBox)processEditors[(int)ProcessClmn.TrnStart]).Items.Add("---");
|
2018-11-14 07:23:01 +00:00
|
|
|
|
((ComboBox)processEditors[(int)ProcessClmn.TrnBetween]).Items.Add("---");
|
2018-05-22 13:33:07 +00:00
|
|
|
|
((ComboBox)processEditors[(int)ProcessClmn.TrnStop]).Items.Add("---");
|
|
|
|
|
|
foreach (var trans in transitionSequences)
|
|
|
|
|
|
{
|
|
|
|
|
|
((ComboBox)processEditors[(int)ProcessClmn.TrnStart]).Items.Add(trans.Name);
|
2018-11-14 07:23:01 +00:00
|
|
|
|
((ComboBox)processEditors[(int)ProcessClmn.TrnBetween]).Items.Add(trans.Name);
|
|
|
|
|
|
((ComboBox)processEditors[(int)ProcessClmn.TrnStop]).Items.Add(trans.Name);
|
2017-06-08 13:42:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
foreach (var ctrl in processEditors)
|
|
|
|
|
|
{
|
|
|
|
|
|
processTabPage.Controls.Add(ctrl);
|
2016-01-01 23:54:21 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshProcessTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
processListViewEx.Items.Clear();
|
|
|
|
|
|
foreach (var test in LoadedProcedure.Tests) AddToProcessTab(test);
|
2018-06-04 06:55:50 +00:00
|
|
|
|
|
|
|
|
|
|
if (0 <= SelectedTestIx && SelectedTestIx < processListViewEx.Items.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
processListViewEx.Items[SelectedTestIx].Selected = true;
|
|
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AddToProcessTab(Test test)
|
|
|
|
|
|
{
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Process item with subitems
|
|
|
|
|
|
///
|
|
|
|
|
|
ListViewItem lvi = new ListViewItem(test.Name); /// Name
|
|
|
|
|
|
lvi.Tag = test;
|
|
|
|
|
|
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
|
|
|
|
|
|
lvi.SubItems.Add(test.FeedingPath);
|
|
|
|
|
|
lvi.SubItems.Add(test.BenchPath);
|
|
|
|
|
|
lvi.SubItems.Add(test.OutputPath);
|
|
|
|
|
|
lvi.SubItems.Add(test.MetersPath);
|
|
|
|
|
|
#if HEAT_METERS
|
|
|
|
|
|
lvi.SubItems.Add(test.HeatMetersPath);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
|
2018-11-14 07:23:01 +00:00
|
|
|
|
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
|
|
|
|
|
|
|
|
|
|
|
|
processListViewEx.Items.Add(lvi);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateFromProcessTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < processListViewEx.Items.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
ListViewItem lvi = processListViewEx.Items[i];
|
2015-12-04 16:17:20 +00:00
|
|
|
|
Test entity = (Test)lvi.Tag;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
entity.Name = lvi.Text;
|
2018-09-04 06:38:57 +00:00
|
|
|
|
entity.ItemNr = i;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
int part = entity.Part;
|
2015-01-17 05:34:24 +00:00
|
|
|
|
if (lvi.SubItems[(int)ProcessClmn.Part].Text.Equals("-"))
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
entity.Part = 0;
|
|
|
|
|
|
}
|
2015-01-17 05:34:24 +00:00
|
|
|
|
else if (int.TryParse(lvi.SubItems[(int)ProcessClmn.Part].Text, out part))
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
entity.Part = part;
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-01-04 22:21:12 +00:00
|
|
|
|
if ((processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Feeding].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.FeedingPath = lvi.SubItems[(int)ProcessClmn.Feeding].Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Bench].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.BenchPath = lvi.SubItems[(int)ProcessClmn.Bench].Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Output].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.OutputPath = lvi.SubItems[(int)ProcessClmn.Output].Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((processEditors[(int)ProcessClmn.Sensor] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Sensor].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.MetersPath = lvi.SubItems[(int)ProcessClmn.Sensor].Text;
|
|
|
|
|
|
}
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if HEAT_METERS
|
2016-06-28 16:04:52 +00:00
|
|
|
|
if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2015-01-04 22:21:12 +00:00
|
|
|
|
if ((processEditors[(int)ProcessClmn.TrnStart] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStart].Text))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2015-05-22 08:29:56 +00:00
|
|
|
|
entity.RelTransBefore = lvi.SubItems[(int)ProcessClmn.TrnStart].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStart].Text;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2018-11-14 07:23:01 +00:00
|
|
|
|
if ((processEditors[(int)ProcessClmn.TrnBetween] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnBetween].Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.RelTransBetween = lvi.SubItems[(int)ProcessClmn.TrnBetween].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnBetween].Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((processEditors[(int)ProcessClmn.TrnStop] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStop].Text))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2015-05-22 08:29:56 +00:00
|
|
|
|
entity.TransitionAfter = lvi.SubItems[(int)ProcessClmn.TrnStop].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStop].Text;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
private void processListViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (!unlocked || e.SubItem >= (int)ProcessClmn.ColumnsCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
processListViewEx.StartEditing(processEditors[e.SubItem], e.Item, e.SubItem);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void processListViewEx_SubItemRightClicked(object sender, Results.Forms.SubItemEventArgs e)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (!unlocked || e.SubItem >= (int)ProcessClmn.ColumnsCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
|
|
|
|
|
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;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
foreach (ListViewItem item in processListViewEx.Items)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2017-03-20 20:29:48 +00:00
|
|
|
|
if (value != null && item.SubItems.Count > columnNr)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
private void processListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-06-13 05:41:03 +00:00
|
|
|
|
if (e.SubItem == (int)ProcessClmn.Name)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!Utils.IsGoodFName(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
int dummy;
|
|
|
|
|
|
if (e.SubItem == (int)ProcessClmn.Part)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.DisplayText.Equals("-")) return; /// OK
|
|
|
|
|
|
if (!int.TryParse(e.DisplayText, out dummy) || dummy < 1 || dummy > 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (((e.SubItem == (int)ProcessClmn.Feeding) && !(processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(e.DisplayText)) ||
|
|
|
|
|
|
((e.SubItem == (int)ProcessClmn.Bench) && !(processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(e.DisplayText)) ||
|
|
|
|
|
|
((e.SubItem == (int)ProcessClmn.Output) && !(processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(e.DisplayText)) ||
|
|
|
|
|
|
((e.SubItem == (int)ProcessClmn.Sensor) && !(processEditors[(int)ProcessClmn.Sensor] as ComboBox).Items.Contains(e.DisplayText)) ||
|
|
|
|
|
|
((e.SubItem == (int)ProcessClmn.TrnStart) && !(processEditors[(int)ProcessClmn.TrnStart] as ComboBox).Items.Contains(e.DisplayText)) ||
|
2018-11-14 07:23:01 +00:00
|
|
|
|
((e.SubItem == (int)ProcessClmn.TrnBetween) && !(processEditors[(int)ProcessClmn.TrnBetween] as ComboBox).Items.Contains(e.DisplayText)) ||
|
2018-05-22 13:33:07 +00:00
|
|
|
|
((e.SubItem == (int)ProcessClmn.TrnStop) && !(processEditors[(int)ProcessClmn.TrnStop] as ComboBox).Items.Contains(e.DisplayText)))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
#endregion
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
#region Parameters
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
public enum ParametersClmn
|
|
|
|
|
|
{
|
|
|
|
|
|
Name,
|
|
|
|
|
|
Part,
|
|
|
|
|
|
PumpPower,
|
|
|
|
|
|
MassRepeats,
|
|
|
|
|
|
#if STABLE_MASS_EXTRAS
|
|
|
|
|
|
MassSpread,
|
|
|
|
|
|
MassMethod,
|
|
|
|
|
|
#endif
|
|
|
|
|
|
Time_Pump2StartV,
|
|
|
|
|
|
Time_BeforeFlow,
|
|
|
|
|
|
Time_Flow2Mass,
|
|
|
|
|
|
Time_Stop2Mass,
|
|
|
|
|
|
ColumnsCount
|
|
|
|
|
|
}
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
Control[] parametersEditors;
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void PrepareParameters()
|
|
|
|
|
|
{
|
|
|
|
|
|
Results.Forms.ListViewEx lv = parametersListViewEx;
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Pump_power_pct, Width = 90 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_repeats, Width = 90 });
|
|
|
|
|
|
#if STABLE_MASS_EXTRAS
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_spread_kg, Width = 110 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_method, Width = 90 });
|
|
|
|
|
|
#endif
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.TimePump2StartV_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.TimeBeforeSettingFlow, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.TimeFlow2Start_chdr, Width = 70 });
|
|
|
|
|
|
lv.Columns.Add(new ColumnHeader { Text = Strings.Time2MassMsrmt_chdr, Width = 70 });
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
parametersEditors = new Control[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new TextBox(), /// Name
|
|
|
|
|
|
new TextBox(), /// Part
|
|
|
|
|
|
new ComboBox(), /// PumpPower
|
|
|
|
|
|
new TextBox(), /// MassRepeats
|
|
|
|
|
|
#if STABLE_MASS_EXTRAS
|
|
|
|
|
|
new TextBox(), /// MassSpread
|
|
|
|
|
|
new ComboBox(), /// MassMethod
|
|
|
|
|
|
#endif
|
|
|
|
|
|
new TextBox(), /// Time_Pump2StartV
|
|
|
|
|
|
new TextBox(), /// Time_BeforeFlow
|
|
|
|
|
|
new TextBox(), /// Time_Flow2Mass
|
|
|
|
|
|
new TextBox(), /// Time_Stop2Mass
|
|
|
|
|
|
};
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("0");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("30");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("40");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("50");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("60");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("70");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("75");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("80");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("85");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("90");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("92");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("94");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("96");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("98");
|
|
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("100");
|
|
|
|
|
|
#if STABLE_MASS_EXTRAS
|
|
|
|
|
|
for (MassMethod mm = 0; mm < MassMethod.Count; mm++)
|
2017-06-08 13:42:47 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
((ComboBox)parametersEditors[(int)ParametersClmn.MassMethod]).Items.Add(mm.ToDescription());
|
2017-06-08 13:42:47 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
foreach (var ctrl in parametersEditors)
|
2017-06-08 13:42:47 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
parametersTabPage.Controls.Add(ctrl);
|
2017-06-08 13:42:47 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
2017-06-08 13:42:47 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void RefreshParametersTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
parametersListViewEx.Items.Clear();
|
|
|
|
|
|
foreach (var test in LoadedProcedure.Tests) AddToParametersTab(test);
|
2018-06-04 06:55:50 +00:00
|
|
|
|
|
|
|
|
|
|
if (0 <= SelectedTestIx && SelectedTestIx < parametersListViewEx.Items.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
parametersListViewEx.Items[SelectedTestIx].Selected = true;
|
|
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
2017-06-08 13:42:47 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void AddToParametersTab(Test test)
|
|
|
|
|
|
{
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Parameters item with subitems
|
|
|
|
|
|
///
|
|
|
|
|
|
ListViewItem lvi = new ListViewItem(test.Name); /// Name
|
|
|
|
|
|
lvi.Tag = test;
|
|
|
|
|
|
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); ///
|
|
|
|
|
|
lvi.SubItems.Add(test.PumpPower.ToString("F1"));
|
|
|
|
|
|
lvi.SubItems.Add((test.MassRepeats < 4 ? 5 : test.MassRepeats).ToString());
|
|
|
|
|
|
#if STABLE_MASS_EXTRAS
|
|
|
|
|
|
lvi.SubItems.Add(test.MassSpread.ToString("F4"));
|
|
|
|
|
|
lvi.SubItems.Add(test.MassMethod.ToDescription());
|
|
|
|
|
|
#endif
|
|
|
|
|
|
lvi.SubItems.Add(test.TimePump2StartV.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.TimeBeforeFlow.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.TimeFlow2Mass.ToString());
|
|
|
|
|
|
lvi.SubItems.Add(test.TimeStop2Mass.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
parametersListViewEx.Items.Add(lvi);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateFromParametersTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < parametersListViewEx.Items.Count; i++)
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
ListViewItem lvi = parametersListViewEx.Items[i];
|
|
|
|
|
|
Test entity = (Test)lvi.Tag;
|
|
|
|
|
|
|
|
|
|
|
|
entity.Name = lvi.Text;
|
2018-09-04 06:38:57 +00:00
|
|
|
|
entity.ItemNr = i;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
|
|
|
|
|
|
int part = entity.Part;
|
|
|
|
|
|
if (lvi.SubItems[(int)ParametersClmn.Part].Text.Equals("-"))
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
entity.Part = 0;
|
2015-01-04 22:21:12 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
else if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Part].Text, out part))
|
2016-02-25 17:04:18 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
entity.Part = part;
|
2016-02-25 17:04:18 +00:00
|
|
|
|
}
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
float powerPct;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)ParametersClmn.PumpPower].Text, out powerPct) && powerPct >= 0 && powerPct <= 100.0f)
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.PumpPower = powerPct;
|
|
|
|
|
|
}
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
entity.MassRepeats = int.Parse(lvi.SubItems[(int)ParametersClmn.MassRepeats].Text);
|
2016-08-15 09:23:00 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
#if STABLE_MASS_EXTRAS
|
|
|
|
|
|
float massSpread;
|
|
|
|
|
|
if (Utils.TryParseUFloat(lvi.SubItems[(int)ParametersClmn.MassSpread].Text, out massSpread) && massSpread >= 0)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
entity.MassSpread = massSpread;
|
2016-08-15 09:23:00 +00:00
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
for (MassMethod mm = 0; mm < MassMethod.Count; mm++)
|
2015-01-04 22:21:12 +00:00
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (mm.ToDescription().Equals(lvi.SubItems[(int)ParametersClmn.MassMethod].Text)) entity.MassMethod = mm;
|
2015-01-04 22:21:12 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
int itmp;
|
|
|
|
|
|
if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_Pump2StartV].Text, out itmp)) entity.TimePump2StartV = itmp;
|
|
|
|
|
|
if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_BeforeFlow].Text, out itmp)) entity.TimeBeforeFlow = itmp;
|
|
|
|
|
|
if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_Flow2Mass].Text, out itmp)) entity.TimeFlow2Mass = itmp;
|
|
|
|
|
|
if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_Stop2Mass].Text, out itmp)) entity.TimeStop2Mass = itmp;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
private void parametersListViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
|
|
|
|
|
{
|
2017-06-08 13:42:47 +00:00
|
|
|
|
if (!unlocked || e.SubItem >= (int)ParametersClmn.ColumnsCount)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
parametersListViewEx.StartEditing(parametersEditors[e.SubItem], e.Item, e.SubItem);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
2015-01-17 05:34:24 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void parametersListViewEx_SubItemRightClicked(object sender, Results.Forms.SubItemEventArgs e)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2017-06-08 13:42:47 +00:00
|
|
|
|
if (!unlocked || e.SubItem >= (int)ParametersClmn.ColumnsCount)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
|
|
|
|
|
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 parametersListViewEx.Items)
|
|
|
|
|
|
{
|
2017-03-20 20:29:48 +00:00
|
|
|
|
if (value != null && item.SubItems.Count > columnNr)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
private void parametersListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
|
|
|
|
|
{
|
2018-06-13 05:41:03 +00:00
|
|
|
|
if (e.SubItem == (int)ParametersClmn.Name)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!Utils.IsGoodFName(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
int dummy;
|
|
|
|
|
|
if (e.SubItem == (int)ParametersClmn.Part)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.DisplayText.Equals("-")) return; /// OK
|
|
|
|
|
|
if (!int.TryParse(e.DisplayText, out dummy) || dummy < 1 || dummy > 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return; /// NOK
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-01-17 05:34:24 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
float powerPct;
|
|
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.PumpPower) &&
|
|
|
|
|
|
(!Utils.TryParseUFloat(e.DisplayText, out powerPct) || powerPct < 0 || powerPct > 100.0f))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
2016-03-17 04:05:30 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
int itmp;
|
|
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.Time_Pump2StartV) &&
|
|
|
|
|
|
(!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.Time_BeforeFlow) &&
|
|
|
|
|
|
(!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.Time_Flow2Mass) &&
|
|
|
|
|
|
(!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.Time_Stop2Mass) &&
|
|
|
|
|
|
(!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.MassRepeats) &&
|
|
|
|
|
|
(!int.TryParse(e.DisplayText, out itmp) || itmp < 4 || itmp > 100))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
2017-03-28 19:40:27 +00:00
|
|
|
|
|
|
|
|
|
|
#if STABLE_MASS_EXTRAS
|
2017-03-27 14:08:32 +00:00
|
|
|
|
if ((e.SubItem == (int)ParametersClmn.MassSpread) && !Utils.TryParseUFloat(e.DisplayText, out powerPct))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
2017-03-28 19:40:27 +00:00
|
|
|
|
|
|
|
|
|
|
if (e.SubItem == (int)ParametersClmn.MassMethod)
|
2017-03-27 14:08:32 +00:00
|
|
|
|
{
|
2017-03-28 19:40:27 +00:00
|
|
|
|
bool mmIsOk = false;
|
|
|
|
|
|
for (MassMethod mm = 0; mm < MassMethod.Count; mm++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (mm.ToDescription().Equals(e.DisplayText))
|
|
|
|
|
|
{
|
|
|
|
|
|
mmIsOk = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!mmIsOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
2017-03-27 14:08:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2018-05-22 13:33:07 +00:00
|
|
|
|
}
|
2015-01-17 05:34:24 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
void RefreshMetrology12AndProcessTabs()
|
|
|
|
|
|
{
|
|
|
|
|
|
RefreshMetrology1Tab();
|
|
|
|
|
|
RefreshMetrology2Tab();
|
|
|
|
|
|
RefreshProcessTab();
|
|
|
|
|
|
RefreshParametersTab();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshOtherTabs()
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var ctrl in testParamsCtrls) ctrl.RedrawAll();
|
|
|
|
|
|
foreach (var ctrl in procedureParamsCtrls) ctrl.RedrawAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
private void Unlocked(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
unlocked = true;
|
|
|
|
|
|
if (testParamsCtrls != null) foreach (var ctrl in testParamsCtrls) ctrl.Unlock();
|
|
|
|
|
|
if (procedureParamsCtrls != null) foreach (var ctrl in procedureParamsCtrls) ctrl.Unlock();
|
|
|
|
|
|
|
|
|
|
|
|
procNameTextBox.Enabled = true;
|
|
|
|
|
|
descriptionTextBox.Enabled = true;
|
|
|
|
|
|
watermetersTextBox.Enabled = true;
|
2017-05-09 14:55:32 +00:00
|
|
|
|
protectedCheckBox.Enabled = Users.GlobalData.CurrentUser.IsMemberOf(Users.Grp.GID.Metrologists);
|
2017-05-03 20:19:26 +00:00
|
|
|
|
mustBeCompleteCheckBox.Enabled = true;
|
|
|
|
|
|
manualControlDisabledCheckBox.Enabled = true;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
dataEntryComboBox.Enabled = true;
|
2014-12-11 21:35:16 +00:00
|
|
|
|
metersKindRadioButton1.Enabled = true;
|
|
|
|
|
|
metersKindRadioButton2.Enabled = true;
|
2017-06-26 14:11:47 +00:00
|
|
|
|
altProcNameTextBox.Enabled = true;
|
|
|
|
|
|
altProcPeriodTextBox.Enabled = true;
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if HEAT_METERS
|
2016-06-28 16:04:52 +00:00
|
|
|
|
metersKindRadioButton3.Enabled = true;
|
|
|
|
|
|
#endif
|
2016-05-02 08:19:26 +00:00
|
|
|
|
printer1ComboBox.Enabled = true;
|
2016-05-03 12:07:26 +00:00
|
|
|
|
printer2ComboBox.Enabled = true;
|
|
|
|
|
|
fileWriter1ComboBox.Enabled = true;
|
2016-05-02 08:19:26 +00:00
|
|
|
|
fileWriter2ComboBox.Enabled = true;
|
2016-05-03 12:07:26 +00:00
|
|
|
|
fileWriter3ComboBox.Enabled = true;
|
|
|
|
|
|
fileWriter4ComboBox.Enabled = true;
|
2016-04-29 14:58:23 +00:00
|
|
|
|
transitionStartComboBox.Enabled = true;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
transitionEndComboBox.Enabled = true;
|
|
|
|
|
|
notesTextBox.Enabled = true;
|
|
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
Results.Forms.ListViewEx listViewEx;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ProcedureTabs.Metrology1:
|
|
|
|
|
|
listViewEx = metrology1ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ProcedureTabs.Metrology2:
|
|
|
|
|
|
listViewEx = metrology2ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ProcedureTabs.Process:
|
|
|
|
|
|
listViewEx = processListViewEx;
|
|
|
|
|
|
break;
|
2015-01-17 05:34:24 +00:00
|
|
|
|
case ProcedureTabs.Parameters:
|
|
|
|
|
|
listViewEx = parametersListViewEx;
|
|
|
|
|
|
break;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
default:
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (listViewEx.SelectedItems.Count == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
int ix = listViewEx.SelectedIndices[0];
|
|
|
|
|
|
listViewEx.Focus();
|
|
|
|
|
|
listViewEx.Items[ix].Selected = true;
|
|
|
|
|
|
listViewEx.Items[ix].EnsureVisible();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void okButton_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
2016-03-14 07:51:09 +00:00
|
|
|
|
case ProcedureTabs.General: UpdateFromGeneralTab(); break;
|
|
|
|
|
|
case ProcedureTabs.Metrology1: UpdateFromMetrology1Tab(); break;
|
|
|
|
|
|
case ProcedureTabs.Metrology2: UpdateFromMetrology2Tab(); break;
|
|
|
|
|
|
case ProcedureTabs.Process: UpdateFromProcessTab(); break;
|
|
|
|
|
|
case ProcedureTabs.Parameters: UpdateFromParametersTab(); break;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var ctrl in testParamsCtrls) ctrl.UpdateAll();
|
|
|
|
|
|
foreach (var ctrl in procedureParamsCtrls) ctrl.UpdateAll();
|
|
|
|
|
|
|
2017-06-29 14:58:59 +00:00
|
|
|
|
if (usedNames != null && usedNames.Contains(LoadedProcedure.Name))
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProcedure.Name, Environment.NewLine),
|
|
|
|
|
|
Strings.Warning,
|
|
|
|
|
|
MessageBoxButtons.OK,
|
|
|
|
|
|
MessageBoxIcon.Exclamation);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-09-07 07:34:28 +00:00
|
|
|
|
Program.LocalSettings.OneProcedureDlgLeft = Location.X;
|
|
|
|
|
|
Program.LocalSettings.OneProcedureDlgTop = Location.Y;
|
|
|
|
|
|
Program.LocalSettings.OneProcedureDlgWidth = Size.Width;
|
|
|
|
|
|
Program.LocalSettings.OneProcedureDlgHeight = Size.Height;
|
|
|
|
|
|
Program.LocalSettings.Save();
|
|
|
|
|
|
|
|
|
|
|
|
DialogResult = DialogResult.OK;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
Close();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void cancelButton_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2014-09-07 07:34:28 +00:00
|
|
|
|
Program.LocalSettings.OneProcedureDlgLeft = Location.X;
|
|
|
|
|
|
Program.LocalSettings.OneProcedureDlgTop = Location.Y;
|
|
|
|
|
|
Program.LocalSettings.OneProcedureDlgWidth = Size.Width;
|
|
|
|
|
|
Program.LocalSettings.OneProcedureDlgHeight = Size.Height;
|
|
|
|
|
|
Program.LocalSettings.Save();
|
|
|
|
|
|
|
|
|
|
|
|
DialogResult = DialogResult.Cancel;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
Close();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Tab switching
|
|
|
|
|
|
|
2015-01-17 05:34:24 +00:00
|
|
|
|
enum ProcedureTabs
|
|
|
|
|
|
{
|
|
|
|
|
|
General,
|
|
|
|
|
|
History,
|
|
|
|
|
|
Metrology1,
|
|
|
|
|
|
Metrology2,
|
|
|
|
|
|
Process,
|
|
|
|
|
|
Parameters,
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
ProcedureTabs selectedTab = ProcedureTabs.General;
|
|
|
|
|
|
|
|
|
|
|
|
private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
2018-05-22 13:33:07 +00:00
|
|
|
|
case ProcedureTabs.General:
|
|
|
|
|
|
UpdateFromGeneralTab();
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ProcedureTabs.Metrology1:
|
|
|
|
|
|
UpdateFromMetrology1Tab();
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ProcedureTabs.Metrology2:
|
|
|
|
|
|
UpdateFromMetrology2Tab();
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ProcedureTabs.Process:
|
|
|
|
|
|
UpdateFromProcessTab();
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ProcedureTabs.Parameters:
|
|
|
|
|
|
UpdateFromParametersTab();
|
|
|
|
|
|
break;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
selectedTab = (ProcedureTabs)tabControl.SelectedIndex;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
bool isMetr12ProcOrParams = selectedTab == ProcedureTabs.Metrology1 ||
|
|
|
|
|
|
selectedTab == ProcedureTabs.Metrology2 ||
|
|
|
|
|
|
selectedTab == ProcedureTabs.Process ||
|
|
|
|
|
|
selectedTab == ProcedureTabs.Parameters;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
sharedButtons.SetEnabled(SharedButtons.Buttons.Add, isMetr12ProcOrParams);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
//bool removeBtnEnabled = (selectedTab != ProcedureTabs.General &&
|
|
|
|
|
|
// selectedTab != ProcedureTabs.History &&
|
|
|
|
|
|
// selectedTab != ProcedureTabs.Calibration);
|
|
|
|
|
|
|
|
|
|
|
|
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
Results.Forms.ListViewEx lv = null;
|
|
|
|
|
|
///
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ProcedureTabs.General:
|
|
|
|
|
|
RefreshGeneralTab();
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Metrology1:
|
|
|
|
|
|
RefreshMetrology1Tab();
|
|
|
|
|
|
lv = metrology1ListViewEx; /// ListVIewEx for test selection
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Metrology2:
|
|
|
|
|
|
RefreshMetrology2Tab();
|
|
|
|
|
|
lv = metrology2ListViewEx; /// ListVIewEx for test selection
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Process:
|
|
|
|
|
|
RefreshProcessTab();
|
|
|
|
|
|
lv = processListViewEx; /// ListVIewEx for test selection
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Parameters:
|
|
|
|
|
|
RefreshParametersTab();
|
|
|
|
|
|
lv = parametersListViewEx; /// ListVIewEx for test selection
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
object ctrl = tabControl.SelectedTab.Tag;
|
|
|
|
|
|
if (ctrl is TestParamsCtrl)
|
|
|
|
|
|
{
|
|
|
|
|
|
(ctrl as TestParamsCtrl).RedrawAll();
|
|
|
|
|
|
lv = (ctrl as TestParamsCtrl).LVEx; /// ListVIewEx for test selection
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ctrl is ProcedureParamsCtrl)
|
|
|
|
|
|
{
|
|
|
|
|
|
(ctrl as ProcedureParamsCtrl).RedrawAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Highlight the selected test
|
|
|
|
|
|
///
|
2018-06-04 06:55:50 +00:00
|
|
|
|
if (lv != null && 0 <= SelectedTestIx && SelectedTestIx < lv.Items.Count)
|
2018-05-22 13:33:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
lv.Focus();
|
|
|
|
|
|
lv.Items[SelectedTestIx].Selected = true;
|
|
|
|
|
|
lv.Items[SelectedTestIx].EnsureVisible();
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 'Add', 'Remove', 'Up' and 'Down'
|
|
|
|
|
|
|
|
|
|
|
|
private void addButton_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2016-08-19 08:43:48 +00:00
|
|
|
|
Results.Forms.ListViewEx listViewEx;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ProcedureTabs.Metrology1: listViewEx = metrology1ListViewEx; break;
|
|
|
|
|
|
case ProcedureTabs.Metrology2: listViewEx = metrology2ListViewEx; break;
|
2018-05-22 13:33:07 +00:00
|
|
|
|
case ProcedureTabs.Process: listViewEx = processListViewEx; break;
|
2015-01-17 05:34:24 +00:00
|
|
|
|
case ProcedureTabs.Parameters: listViewEx = parametersListViewEx; break;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
default: return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Find an unused test name
|
|
|
|
|
|
string newName;
|
|
|
|
|
|
for (int nameId = 1; true; nameId++)
|
|
|
|
|
|
{
|
|
|
|
|
|
newName = Strings.New_test_name + nameId.ToString();
|
|
|
|
|
|
bool notUsed = true;
|
|
|
|
|
|
foreach (var t in LoadedProcedure.Tests) if (t.Name.Equals(newName)) notUsed = false;
|
|
|
|
|
|
if (notUsed) break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Add a test
|
|
|
|
|
|
Test test = new Test(newName, listViewEx.Items.Count, LoadedProcedure);
|
2017-04-10 05:55:34 +00:00
|
|
|
|
TestWizard.RoiData roiData = new TestWizard.RoiData();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Run a create new test wizard
|
2015-02-19 07:37:37 +00:00
|
|
|
|
TestWizard.MethodSelection methodDlg = new TestWizard.MethodSelection(true, false, test, TestMethods);
|
|
|
|
|
|
TestWizard.FlowSelection flowDlg = new TestWizard.FlowSelection(false, false, test, metersPaths);
|
|
|
|
|
|
TestWizard.VolumeAndErrorSelection volumeDlg = new TestWizard.VolumeAndErrorSelection(false, true, test);
|
|
|
|
|
|
TestWizard.PressureSelection pressureDlg = new TestWizard.PressureSelection(false, true, test);
|
2016-08-04 14:22:41 +00:00
|
|
|
|
TestWizard.HeatMetersSelection heatMetersDlg = new TestWizard.HeatMetersSelection(false, false, test);
|
2017-04-10 05:55:34 +00:00
|
|
|
|
TestWizard.Roi1 roi1Dlg = new TestWizard.Roi1(false, false, roiData);
|
|
|
|
|
|
TestWizard.Roi2 roi2Dlg = new TestWizard.Roi2(false, false, roiData);
|
|
|
|
|
|
TestWizard.Roi3 roi3Dlg = new TestWizard.Roi3(false, false, roiData);
|
|
|
|
|
|
//test.
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
methodLabel:
|
2017-04-10 05:55:34 +00:00
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
switch (methodDlg.ShowDialog())
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
ITestMethod selectedMethod = TestMethods.FirstOrDefault<ITestMethod>(x => x.Name.Equals(test.Method));
|
|
|
|
|
|
|
2016-12-10 15:27:51 +00:00
|
|
|
|
if (selectedMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component
|
|
|
|
|
|
|| selectedMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component)
|
|
|
|
|
|
{
|
|
|
|
|
|
test.Publish = (sbyte)Publish.Never;
|
2017-06-08 13:42:47 +00:00
|
|
|
|
test.DoEvaluate = false;
|
2016-12-10 15:27:51 +00:00
|
|
|
|
goto done;
|
|
|
|
|
|
}
|
2015-02-19 07:37:37 +00:00
|
|
|
|
if (selectedMethod is BenchControl.TestMethods.PMaxTest.TestMethod) goto pressure_label;
|
|
|
|
|
|
if (selectedMethod is BenchControl.TestMethods.LeakTest.TestMethod) goto pressure_label;
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if HEAT_METERS
|
2016-08-17 10:24:24 +00:00
|
|
|
|
if (selectedMethod.CanTest(MetersKind.HeatMeter)) goto heat_meters_label;
|
2016-12-02 10:04:33 +00:00
|
|
|
|
#endif
|
2017-04-10 05:55:34 +00:00
|
|
|
|
if (!(selectedMethod is BenchControl.TestMethods.RoiDetection.RoiDetection)) goto flowLabel;
|
|
|
|
|
|
|
|
|
|
|
|
roi_detection_label_1:
|
|
|
|
|
|
switch (roi1Dlg.ShowDialog())
|
|
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
|
|
|
|
|
case DialogResult.Retry: goto methodLabel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
roi_detection_label_2:
|
|
|
|
|
|
switch (roi2Dlg.ShowDialog())
|
|
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
|
|
|
|
|
case DialogResult.Retry: goto roi_detection_label_1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (roi3Dlg.ShowDialog())
|
|
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
|
|
|
|
|
case DialogResult.Retry: goto roi_detection_label_2;
|
|
|
|
|
|
}
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2017-10-17 16:24:03 +00:00
|
|
|
|
/// Pre-calculate additional data and flow for ROI detection
|
|
|
|
|
|
roiData.Calculate();
|
|
|
|
|
|
test.Qfrom = (float)(roiData.Q * 0.95);
|
|
|
|
|
|
test.Qto = (float)(roiData.Q * 1.05);
|
|
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
flowLabel:
|
|
|
|
|
|
switch (flowDlg.ShowDialog())
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
2015-02-19 07:37:37 +00:00
|
|
|
|
case DialogResult.Retry: goto methodLabel;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-04-10 05:55:34 +00:00
|
|
|
|
if (selectedMethod is BenchControl.TestMethods.RoiDetection.RoiDetection)
|
|
|
|
|
|
{
|
2017-05-01 12:33:22 +00:00
|
|
|
|
AddProcedureParamsToRoiComponents(LoadedProcedure, test.MetersPath, roiData);
|
2017-04-10 05:55:34 +00:00
|
|
|
|
goto select_paths;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
switch (volumeDlg.ShowDialog())
|
|
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
2015-02-19 07:37:37 +00:00
|
|
|
|
case DialogResult.Retry: goto flowLabel;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-04-10 05:55:34 +00:00
|
|
|
|
select_paths:
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Depending on the chosen Q select the paths
|
|
|
|
|
|
float Qaver = (test.Qfrom + test.Qto) / 2.0f;
|
|
|
|
|
|
foreach (var path in feedingPaths)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto))
|
|
|
|
|
|
{
|
|
|
|
|
|
test.FeedingPath = path.Name;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var path in benchPaths)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto))
|
|
|
|
|
|
{
|
|
|
|
|
|
test.BenchPath = path.Name;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var path in outputPaths)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto))
|
|
|
|
|
|
{
|
|
|
|
|
|
test.OutputPath = path.Name;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
goto done;
|
2016-08-04 14:22:41 +00:00
|
|
|
|
|
2017-02-14 12:25:43 +00:00
|
|
|
|
#if HEAT_METERS
|
2016-08-04 14:22:41 +00:00
|
|
|
|
heat_meters_label:
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-08-04 14:22:41 +00:00
|
|
|
|
DialogResult dr = heatMetersDlg.ShowDialog();
|
|
|
|
|
|
switch (dr)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
|
|
|
|
|
case DialogResult.Retry: goto methodLabel;
|
|
|
|
|
|
}
|
|
|
|
|
|
goto flowLabel;
|
2016-12-09 09:57:27 +00:00
|
|
|
|
#endif
|
2017-04-10 05:55:34 +00:00
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
pressure_label:
|
|
|
|
|
|
|
|
|
|
|
|
switch (pressureDlg.ShowDialog())
|
|
|
|
|
|
{
|
|
|
|
|
|
case DialogResult.Cancel: return;
|
|
|
|
|
|
case DialogResult.Retry: goto methodLabel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
LoadedProcedure.Tests.Add(test);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
///
|
|
|
|
|
|
AddToMetrology1Tab(test);
|
|
|
|
|
|
AddToMetrology2Tab(test);
|
|
|
|
|
|
AddToProcessTab(test);
|
|
|
|
|
|
AddToParametersTab(test);
|
|
|
|
|
|
foreach (var ctrl in testParamsCtrls) ctrl.AddOne(test);
|
2017-05-01 08:28:43 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
listViewEx.Focus();
|
|
|
|
|
|
listViewEx.SelectedItems.Clear();
|
|
|
|
|
|
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
|
|
|
|
|
|
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void removeButton_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2016-08-19 08:43:48 +00:00
|
|
|
|
Results.Forms.ListViewEx listViewEx;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ProcedureTabs.Metrology1:
|
|
|
|
|
|
UpdateFromMetrology1Tab();
|
|
|
|
|
|
listViewEx = metrology1ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Metrology2:
|
|
|
|
|
|
UpdateFromMetrology2Tab();
|
|
|
|
|
|
listViewEx = metrology2ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Process:
|
|
|
|
|
|
UpdateFromProcessTab();
|
|
|
|
|
|
listViewEx = processListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2015-01-17 05:34:24 +00:00
|
|
|
|
case ProcedureTabs.Parameters:
|
|
|
|
|
|
UpdateFromParametersTab();
|
|
|
|
|
|
listViewEx = parametersListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
default: return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Check the selected index validity
|
|
|
|
|
|
if (listViewEx.SelectedItems.Count != 1) return;
|
|
|
|
|
|
int removeItemNr = listViewEx.SelectedIndices[0];
|
|
|
|
|
|
|
|
|
|
|
|
/// Remove the selected test
|
2015-12-04 16:17:20 +00:00
|
|
|
|
Test toBeDeleted = LoadedProcedure.Tests[removeItemNr];
|
2014-07-28 07:54:35 +00:00
|
|
|
|
LoadedProcedure.Tests.Remove(toBeDeleted);
|
|
|
|
|
|
for (int i = removeItemNr; i < LoadedProcedure.Tests.Count; i++) LoadedProcedure.Tests[i].ItemNr--;
|
|
|
|
|
|
|
|
|
|
|
|
RefreshMetrology12AndProcessTabs();
|
|
|
|
|
|
foreach (var ctrl in testParamsCtrls) ctrl.RedrawAll();
|
|
|
|
|
|
|
|
|
|
|
|
if (removeItemNr < listViewEx.Items.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
listViewEx.Focus();
|
|
|
|
|
|
listViewEx.Items[removeItemNr].Selected = true;
|
|
|
|
|
|
listViewEx.Items[removeItemNr].EnsureVisible();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void upButton_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2016-08-19 08:43:48 +00:00
|
|
|
|
Results.Forms.ListViewEx listViewEx;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ProcedureTabs.Metrology1:
|
|
|
|
|
|
UpdateFromMetrology1Tab();
|
|
|
|
|
|
listViewEx = metrology1ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Metrology2:
|
|
|
|
|
|
UpdateFromMetrology2Tab();
|
|
|
|
|
|
listViewEx = metrology2ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Process:
|
|
|
|
|
|
UpdateFromProcessTab();
|
|
|
|
|
|
listViewEx = processListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2015-01-17 05:34:24 +00:00
|
|
|
|
case ProcedureTabs.Parameters:
|
|
|
|
|
|
UpdateFromParametersTab();
|
|
|
|
|
|
listViewEx = parametersListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
default: return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Check the selected index validity
|
|
|
|
|
|
if (listViewEx.SelectedItems.Count != 1) return;
|
|
|
|
|
|
int ix = listViewEx.SelectedIndices[0];
|
|
|
|
|
|
if (ix <= 0 || ix >= listViewEx.Items.Count) return;
|
|
|
|
|
|
|
|
|
|
|
|
/// Swap two items (move the selected item up)
|
2015-12-04 16:17:20 +00:00
|
|
|
|
Test test1 = LoadedProcedure.Tests[ix - 1];
|
|
|
|
|
|
Test test2 = LoadedProcedure.Tests[ix];
|
2014-07-28 07:54:35 +00:00
|
|
|
|
test1.ItemNr++;
|
|
|
|
|
|
test2.ItemNr--;
|
|
|
|
|
|
LoadedProcedure.Tests.RemoveAt(ix);
|
|
|
|
|
|
LoadedProcedure.Tests.Insert(ix - 1, test2);
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if (SelectedTestIx >= 1) SelectedTestIx--;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
RefreshMetrology12AndProcessTabs();
|
|
|
|
|
|
|
|
|
|
|
|
listViewEx.Focus();
|
|
|
|
|
|
listViewEx.Items[ix - 1].Selected = true;
|
|
|
|
|
|
listViewEx.Items[ix - 1].EnsureVisible();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void downButton_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2016-08-19 08:43:48 +00:00
|
|
|
|
Results.Forms.ListViewEx listViewEx;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
switch (selectedTab)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ProcedureTabs.Metrology1:
|
|
|
|
|
|
UpdateFromMetrology1Tab();
|
|
|
|
|
|
listViewEx = metrology1ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Metrology2:
|
|
|
|
|
|
UpdateFromMetrology2Tab();
|
|
|
|
|
|
listViewEx = metrology2ListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ProcedureTabs.Process:
|
|
|
|
|
|
UpdateFromProcessTab();
|
|
|
|
|
|
listViewEx = processListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2015-01-17 05:34:24 +00:00
|
|
|
|
case ProcedureTabs.Parameters:
|
|
|
|
|
|
UpdateFromParametersTab();
|
|
|
|
|
|
listViewEx = parametersListViewEx;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
default: return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Check the selected index validity
|
|
|
|
|
|
if (listViewEx.SelectedItems.Count != 1) return;
|
|
|
|
|
|
int ix = listViewEx.SelectedIndices[0];
|
|
|
|
|
|
if (ix < 0 || ix >= listViewEx.Items.Count - 1) return;
|
|
|
|
|
|
|
|
|
|
|
|
/// Swap two items (move the selected item down)
|
2015-12-04 16:17:20 +00:00
|
|
|
|
Test test1 = LoadedProcedure.Tests[ix];
|
|
|
|
|
|
Test test2 = LoadedProcedure.Tests[ix + 1];
|
2014-07-28 07:54:35 +00:00
|
|
|
|
test1.ItemNr++;
|
|
|
|
|
|
test2.ItemNr--;
|
|
|
|
|
|
LoadedProcedure.Tests.RemoveAt(ix + 1);
|
|
|
|
|
|
LoadedProcedure.Tests.Insert(ix, test2);
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
if ((SelectedTestIx >= 0) && (SelectedTestIx < listViewEx.Items.Count - 1)) SelectedTestIx++;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
RefreshMetrology12AndProcessTabs();
|
|
|
|
|
|
|
|
|
|
|
|
listViewEx.Focus();
|
|
|
|
|
|
listViewEx.Items[ix + 1].Selected = true;
|
|
|
|
|
|
listViewEx.Items[ix + 1].EnsureVisible();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
private void metrology1ListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); }
|
|
|
|
|
|
private void metrology2ListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); }
|
|
|
|
|
|
private void processListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); }
|
|
|
|
|
|
private void parametersListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-05-22 13:33:07 +00:00
|
|
|
|
/// Common part for four xxxListViewEx_SelectedIndexChanged event handlers
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
void SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2016-08-19 08:43:48 +00:00
|
|
|
|
Results.Forms.ListViewEx listViewEx = sender as Results.Forms.ListViewEx;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (listViewEx.SelectedItems.Count != 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
2018-05-22 13:33:07 +00:00
|
|
|
|
SelectedTestIx = -1;
|
|
|
|
|
|
return;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
|
|
|
|
|
|
SelectedTestIx = listViewEx.SelectedIndices[0];
|
|
|
|
|
|
|
|
|
|
|
|
if (listViewEx.Items.Count == 1)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
|
|
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
else if (SelectedTestIx == 0)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.First);
|
|
|
|
|
|
}
|
2018-05-22 13:33:07 +00:00
|
|
|
|
else if (SelectedTestIx == (listViewEx.Items.Count - 1))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-04-10 05:55:34 +00:00
|
|
|
|
|
2018-05-22 13:33:07 +00:00
|
|
|
|
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
|
|
|
|
|
|
{
|
|
|
|
|
|
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
|
|
|
|
|
|
{
|
|
|
|
|
|
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Down);
|
|
|
|
|
|
sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
|
|
|
|
|
|
{
|
|
|
|
|
|
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up);
|
|
|
|
|
|
sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
|
|
|
|
|
|
{
|
|
|
|
|
|
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
|
|
|
|
|
|
sharedButtons.DisableButtons(SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-04-10 05:55:34 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Adds ROI data/process data prepared by the wizard to ROI-components in the selected sensors path
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="procedure">Loaded procedure</param>
|
|
|
|
|
|
/// <param name="sensorsPath">Selected sensors path</param>
|
|
|
|
|
|
/// <param name="roiData">ROI data</param>
|
2017-05-01 08:28:43 +00:00
|
|
|
|
void AddProcedureParamsToRoiComponents(Config.Entities.Procedure procedure, string sensorsPathName, TestWizard.RoiData roiData)
|
2017-04-10 05:55:34 +00:00
|
|
|
|
{
|
2017-05-01 12:33:22 +00:00
|
|
|
|
IList<IComponent> cmpntsInSensPath = new List<IComponent>();
|
2017-04-10 05:55:34 +00:00
|
|
|
|
|
2017-05-01 12:33:22 +00:00
|
|
|
|
MetersPath sensorsPath = metersPaths.FirstOrDefault<MetersPath>(x => (x.Name == sensorsPathName));
|
|
|
|
|
|
if (sensorsPath != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < Config.Data.WMsCount; i++)
|
2017-04-10 05:55:34 +00:00
|
|
|
|
{
|
2017-05-01 12:33:22 +00:00
|
|
|
|
IComponent sensor = TbfComponents.FirstOrDefault<IComponent>(x => (x.Cfg.Name.Equals(sensorsPath.GetSensor(i))));
|
|
|
|
|
|
cmpntsInSensPath.Add(sensor);
|
2017-04-10 05:55:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-05-01 12:33:22 +00:00
|
|
|
|
|
|
|
|
|
|
foreach (var cmpnt in cmpntsInSensPath)
|
2017-04-10 05:55:34 +00:00
|
|
|
|
{
|
2017-05-01 12:33:22 +00:00
|
|
|
|
if (cmpnt != null && (cmpnt.Cfg is BenchControl.Network.Camera.Roi.RoiCfg))
|
|
|
|
|
|
{
|
|
|
|
|
|
BenchControl.Network.Camera.Roi.ProcedureParams roiParams =
|
|
|
|
|
|
new BenchControl.Network.Camera.Roi.ProcedureParams()
|
|
|
|
|
|
{
|
|
|
|
|
|
PulsesPerLtr = (float)roiData.PulsesPerLiter,
|
|
|
|
|
|
DetectionImagesCount = roiData.N,
|
|
|
|
|
|
DetectionPeriod1 = roiData.P1,
|
|
|
|
|
|
DetectionPeriod2 = roiData.P2,
|
|
|
|
|
|
RoiParams = roiData.GetRoiParams()
|
|
|
|
|
|
};
|
2018-05-10 11:25:46 +00:00
|
|
|
|
roiParams.FromDbEntity(cmpnt.Name, LoadedProcedure);
|
2017-05-01 12:33:22 +00:00
|
|
|
|
}
|
2017-04-10 05:55:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|