(1) TestProfiles and TestWizard.TestProfileSel (2) ErrorFlags and some WM params updated from profiles (3) Proc./Profile names case insensitive, ver. 2.24.1369

This commit is contained in:
Milan Hanajik 2019-11-27 11:22:32 +01:00
parent 511ef6a1f3
commit 531b5d29ae
27 changed files with 1749 additions and 291 deletions

View File

@ -86,8 +86,8 @@ namespace Config.Entities
public enum ProfileType
{
Q3R,
QnClassLT15,
QnClassGT15,
QnClassColdWater,
QnClassHotWater,
QpQi,
Manual,
Count,
@ -327,6 +327,14 @@ namespace Config.Entities
Count
}
public enum TestProfile
{
UserDefined,
UserDefinedHeatMeter,
Protected, /// The first protected one
ProtectedHeatMeter,
}
public enum Progress
{
JustStarted,

View File

@ -86,12 +86,10 @@ namespace Config.Entities
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription;
result.ProcedureState = ProcedureState;
result.Revision = Revision;
result.PredecessorId = Id;
result.ObtainedByCopy = ObtainedByCopy;
result.MetersKind = MetersKind;
result.Watermeters = Watermeters;
result.Protected = Protected;
@ -102,6 +100,8 @@ namespace Config.Entities
result.ResultsWriter = ResultsWriter;
result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd;
result.AltProcName = AltProcName;
result.AltProcPeriod = AltProcPeriod;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }

View File

@ -61,6 +61,7 @@ namespace Config.Entities
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.ProfileType = ProfileType;
result.ErrorLimitType = ErrorLimitType;
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -18,7 +18,8 @@ namespace Config.Entities
public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual TestProfile Profile { get; set; } /// UserDefined, Protected, UserDefinedHeatMeter, ProtectedHeatMeter
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool DoEvaluate { get; set; }
public virtual float Qtg { get; set; } /// Target water flow [m3/h]
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
@ -54,7 +55,6 @@ namespace Config.Entities
#endif
public virtual string RelTransBefore { get; set; }
public virtual string RelTransBetween { get; set; }
public virtual string RelTransAfter { get; set; }
public virtual string TransitionAfter { get; set; }
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
@ -73,7 +73,9 @@ namespace Config.Entities
///
/// Default values
///
Publish = (sbyte)Config.Entities.Publish.Always;
Part = 0;
Profile = TestProfile.UserDefined;
Publish = (sbyte)Config.Entities.Publish.Always;
DoEvaluate = true;
Repeats = 1;
DoDraining = false;
@ -95,7 +97,6 @@ namespace Config.Entities
TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty;
RelTransBetween = string.Empty;
RelTransAfter = string.Empty;
TransitionAfter = string.Empty;
}
@ -113,7 +114,8 @@ namespace Config.Entities
Test result = new Test(Name, ItemNr, Procedure);
result.Part = Part;
result.Publish = Publish;
result.Profile = Profile;
result.Publish = Publish;
result.DoEvaluate = DoEvaluate;
result.Qtg = Qtg;
result.Qfrom = Qfrom;
@ -149,7 +151,6 @@ namespace Config.Entities
#endif
result.RelTransBefore = RelTransBefore;
result.RelTransBetween = RelTransBetween;
result.RelTransAfter = RelTransAfter;
result.TransitionAfter = TransitionAfter;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
@ -193,7 +194,7 @@ namespace Config.Entities
output.WriteLine(MetersPath);
output.WriteLine(RelTransBefore);
output.WriteLine(RelTransBetween);
output.WriteLine(RelTransAfter);
output.WriteLine(Profile);
output.WriteLine(TransitionAfter);
foreach (var prms in MoreParams) { prms.Export(output); }
@ -244,7 +245,10 @@ namespace Config.Entities
tst.MetersPath = input.ReadLine();
tst.RelTransBefore = input.ReadLine();
tst.RelTransBetween = input.ReadLine();
tst.RelTransAfter = input.ReadLine();
string line = input.ReadLine();
tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
tst.TransitionAfter = input.ReadLine();
while (true)
@ -285,7 +289,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
@ -303,7 +307,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); };
ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); };
ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); };
ln = inp.ReadLine(); if (ln != RelTransAfter) { diff.AppendFormat(fmt, "RelTransAfter", RelTransAfter, ln); };
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); };
return diff.ToString();

View File

@ -13,6 +13,7 @@ namespace Config.Mappings
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
Map(x => x.CoefQfrom);
Map(x => x.CoefQto);
Map(x => x.ErrLimLo);

View File

@ -14,7 +14,8 @@ namespace Config.Mappings
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
Map(x => x.Publish);
Map(x => x.Profile);
Map(x => x.Publish);
Map(x => x.DoEvaluate)
.Column("Evaluate");
#if TEST_PROFILES
@ -56,11 +57,14 @@ namespace Config.Mappings
#if HEAT_METERS
Map(x => x.HeatMetersPath);
#endif
Map(x => x.RelTransBefore);
Map(x => x.RelTransBetween);
Map(x => x.RelTransAfter);
Map(x => x.TransitionAfter);
HasMany(x => x.MoreParams)
Map(x => x.RelTransBefore)
.Column("RelTransBefore");
Map(x => x.RelTransBetween)
.Column("RelTransBetween");
Map(x => x.TransitionAfter)
.Column("TransitionAfter");
HasMany(x => x.MoreParams)
.Cascade.All();
References(x => x.Procedure);
}

View File

@ -138,5 +138,119 @@ namespace Config
/// pattern NOT found
return string.Empty;
}
/// <summary>
/// Get either Q1 or Qmin flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q1 or Qmin flow in m3/h</returns>
public static double GetQ1Qmin(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return Qn / (double)metroClassRatio;
}
else
{
if (medium == Entities.Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
default: break;
}
}
}
return Qdflt;
}
/// <summary>
/// Get either Q2 or Qt flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q2 or Qt flow in m3/h</returns>
public static double GetQ2Qt(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return 1.6 * Qn / (double)metroClassRatio;
}
if (medium == Entities.Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
default: break;
}
}
return Qdflt;
}
/// <summary>
/// Get either Q4 or Qmax flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q4 or Qmax flow in m3/h</returns>
public static double GetQ4Qmax(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
switch (metroClass[0])
{
case 'A':
case 'B':
case 'C':
case 'D':
return 2 * Qn;
case 'R':
return 1.25 * Qn;
default:
return Qdflt;
}
}
}
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.24.1368.0")]
[assembly: AssemblyFileVersion("2.24.1368.0")]
[assembly: AssemblyVersion("2.24.1369.0")]
[assembly: AssemblyFileVersion("2.24.1369.0")]

View File

@ -564,6 +564,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to calculated.
/// </summary>
internal static string calculated {
get {
return ResourceManager.GetString("calculated", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calibration.
/// </summary>

View File

@ -2125,4 +2125,7 @@
<data name="Test_profiles_selection" xml:space="preserve">
<value>Test profiles selection</value>
</data>
<data name="calculated" xml:space="preserve">
<value>calculated</value>
</data>
</root>

View File

@ -2274,6 +2274,12 @@
<Compile Include="UI\Procedures\TestWizard\PressureSelection.designer.cs">
<DependentUpon>PressureSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\TestProfileSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\TestProfileSelection.designer.cs">
<DependentUpon>TestProfileSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi1.cs">
<SubType>Form</SubType>
</Compile>
@ -3234,6 +3240,9 @@
<EmbeddedResource Include="UI\Procedures\TestWizard\PressureSelection.resx">
<DependentUpon>PressureSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\TestProfileSelection.resx">
<DependentUpon>TestProfileSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\Roi1.resx">
<DependentUpon>Roi1.cs</DependentUpon>
</EmbeddedResource>

View File

@ -171,11 +171,11 @@ namespace TBF.UI.Bench.TestProfiles
switch(LoadedProfile.ProfileType)
{
default:
case ProfileType.Q3R: profileTypeRadioButton1.Checked = true; break;
case ProfileType.QnClassLT15: profileTypeRadioButton2.Checked = true; break;
case ProfileType.QnClassGT15: profileTypeRadioButton3.Checked = true; break;
case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break;
case ProfileType.Manual: profileTypeRadioButton5.Checked = true; break;
case ProfileType.Q3R: profileTypeRadioButton1.Checked = true; break;
case ProfileType.QnClassColdWater: profileTypeRadioButton2.Checked = true; break;
case ProfileType.QnClassHotWater: profileTypeRadioButton3.Checked = true; break;
case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break;
case ProfileType.Manual: profileTypeRadioButton5.Checked = true; break;
}
switch(LoadedProfile.ErrorLimitType)
@ -194,8 +194,8 @@ namespace TBF.UI.Bench.TestProfiles
LoadedProfile.Description = descriptionTextBox.Text;
LoadedProfile.ProfileType = profileTypeRadioButton1.Checked ? ProfileType.Q3R :
(profileTypeRadioButton2.Checked ? ProfileType.QnClassLT15 :
(profileTypeRadioButton3.Checked ? ProfileType.QnClassGT15 :
(profileTypeRadioButton2.Checked ? ProfileType.QnClassColdWater :
(profileTypeRadioButton3.Checked ? ProfileType.QnClassHotWater :
(profileTypeRadioButton4.Checked ? ProfileType.QpQi
: ProfileType.Manual)));
@ -212,6 +212,7 @@ namespace TBF.UI.Bench.TestProfiles
public enum MtrlgyClmn
{
Name,
Part,
CoefQfrom,
CoefQto,
ErrLimLo,
@ -227,10 +228,11 @@ namespace TBF.UI.Bench.TestProfiles
{
ListViewEx lv = metrologyListViewEx;
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 = string.Format("Coef. {0}", Strings.Q_from), Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_to), Width = 80 });
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.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 = 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 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Press_lim_lo_chdr, Width = 80 });
@ -239,6 +241,7 @@ namespace TBF.UI.Bench.TestProfiles
metrologyEditors = new Control[]
{
new TextBox(), /// Name
new TextBox(), /// Part
new TextBox(), /// CoefQfrom
new TextBox(), /// CoefQto
new TextBox(), /// Err.Lim. -
@ -273,10 +276,19 @@ namespace TBF.UI.Bench.TestProfiles
///
ListViewItem lvi = new ListViewItem(pTest.Name);
lvi.Tag = pTest;
lvi.SubItems.Add((pTest.Part == 0) ? "-" : pTest.Part.ToString());
lvi.SubItems.Add(pTest.CoefQfrom.ToString());
lvi.SubItems.Add(pTest.CoefQto.ToString());
lvi.SubItems.Add(pTest.ErrLimLo.ToString());
lvi.SubItems.Add(pTest.ErrLimHi.ToString());
if (LoadedProfile.ProfileType != ProfileType.QpQi)
{
lvi.SubItems.Add(pTest.ErrLimLo.ToString());
lvi.SubItems.Add(pTest.ErrLimHi.ToString());
}
else
{
lvi.SubItems.Add(Strings.calculated);
lvi.SubItems.Add(Strings.calculated);
}
lvi.SubItems.Add(pTest.TempLimLo.ToString());
lvi.SubItems.Add(pTest.TempLimHi.ToString());
lvi.SubItems.Add(pTest.PressLimLo.ToString());
@ -295,20 +307,44 @@ namespace TBF.UI.Bench.TestProfiles
entity.Name = lvi.Text;
entity.ItemNr = i;
float tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text, out tmp)) entity.CoefQfrom = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text, out tmp)) entity.CoefQto = 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 (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text, out tmp)) entity.PressLimLo = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text, out tmp)) entity.PressLimHi = tmp;
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;
}
double tmp;
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text, out tmp)) entity.CoefQfrom = tmp;
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text, out tmp)) entity.CoefQto = tmp;
if (LoadedProfile.ProfileType != ProfileType.QpQi)
{
if (Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp;
if (Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp;
}
else
{
entity.ErrLimLo = +1.0;
entity.ErrLimHi = -1.0;
}
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text, out tmp)) entity.PressLimLo = tmp;
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text, out tmp)) entity.PressLimHi = tmp;
}
}
private void metrologyListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (LoadedProfile.ProfileType == ProfileType.QpQi &&
((e.SubItem == (int)MtrlgyClmn.ErrLimLo) || (e.SubItem == (int)MtrlgyClmn.ErrLimHi)))
{
return; /// Prevent editing calculated error limits
}
if (unlocked && (e.SubItem < (int)MtrlgyClmn.ColumnsCount))
{
metrologyListViewEx.StartEditing(metrologyEditors[e.SubItem], e.Item, e.SubItem);
@ -353,15 +389,27 @@ namespace TBF.UI.Bench.TestProfiles
}
}
float fdummy;
if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) ||
(e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy)))
int idummy;
if (e.SubItem == (int)MtrlgyClmn.Part)
{
if (e.DisplayText.Equals("-")) return; /// OK
if (!int.TryParse(e.DisplayText, out idummy) || !Test.IsGoodPartNr(idummy))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return; /// NOK
}
}
double dummy;
if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
(e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)))
{
/// Cannot parse => revert content of the cell
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
@ -654,19 +702,19 @@ namespace TBF.UI.Bench.TestProfiles
entity.ItemNr = i;
int j = 1;
entity.Delta_Q_pct = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Delta_T = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Delta_Tup_Tdn = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.TestTime_min = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.TestTime_max = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.AmbTemp_min = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.AmbTemp_max = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Coef_E9 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Coef_E10 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Coef_E11 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Coef_E12 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Offset_E9 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Offset_E12 = Utils.ParseUFloat(lvi.SubItems[j++].Text);
entity.Delta_Q_pct = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Delta_T = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Delta_Tup_Tdn = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.TestTime_min = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.TestTime_max = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.AmbTemp_min = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.AmbTemp_max = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Coef_E9 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Coef_E10 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Coef_E11 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Coef_E12 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Offset_E9 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
entity.Offset_E12 = Utils.ParseUDouble(lvi.SubItems[j++].Text);
}
}
@ -721,8 +769,8 @@ namespace TBF.UI.Bench.TestProfiles
}
}
float dummy;
if ((e.SubItem >= 1) && (e.SubItem < (int)ErrorFlags2Clmn.ColumnsCount) && !Utils.TryParseUFloat(e.DisplayText, out dummy))
double dummy;
if ((e.SubItem >= 1) && (e.SubItem < (int)ErrorFlags2Clmn.ColumnsCount) && !Utils.TryParseUDouble(e.DisplayText, out dummy))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
@ -791,7 +839,7 @@ namespace TBF.UI.Bench.TestProfiles
//foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
//foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
if (usedNames != null && usedNames.Contains(LoadedProfile.Name))
if (usedNames != null && usedNames.Contains(LoadedProfile.Name.ToLower()))
{
MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProfile.Name, Environment.NewLine),
Strings.Warning,
@ -953,19 +1001,118 @@ namespace TBF.UI.Bench.TestProfiles
default: return;
}
///
/// Find an unused test name
///
string newName;
for (int nameId = 1; true; nameId++)
{
newName = Strings.New_test_name + nameId.ToString();
if (nameId >= 5 || (nameId >= 4 && LoadedProfile.ProfileType == ProfileType.QpQi) || LoadedProfile.ProfileType == ProfileType.Manual)
{
newName = Strings.New_test_name + nameId.ToString();
}
else
{
switch (LoadedProfile.ProfileType)
{
default:
case ProfileType.Q3R:
newName = string.Format("Q{0}", 5 - nameId);
break;
case ProfileType.QnClassColdWater:
case ProfileType.QnClassHotWater:
newName = (nameId == 1) ? "Qmax" : (nameId == 2) ? "Qn" : (nameId == 3) ? "Qt" : "Qmin";
break;
case ProfileType.QpQi:
newName = (nameId == 1) ? "qp" : (nameId == 2) ? "0,1qp" : "qi";
break;
}
}
bool notUsed = true;
foreach (var t in LoadedProfile.Tests) if (t.Name.Equals(newName)) notUsed = false;
if (notUsed) break;
}
///
/// Add a profile test
PTest ptest = new PTest(newName, listViewEx.Items.Count, LoadedProfile);
///
int count = listViewEx.Items.Count;
PTest ptest = new PTest(newName, count, LoadedProfile);
///
/// Upper and lower limits of flow
///
switch (LoadedProfile.ProfileType)
{
case ProfileType.Q3R:
case ProfileType.QnClassColdWater:
case ProfileType.QnClassHotWater:
switch (count)
{
case 0:
case 1:
ptest.CoefQfrom = 0.9;
ptest.CoefQto = 1.0;
break;
default:
ptest.CoefQfrom = 1.0;
ptest.CoefQto = 1.1;
break;
}
break;
case ProfileType.QpQi:
switch (count)
{
case 0:
ptest.CoefQfrom = 0.9;
ptest.CoefQto = 1.0;
break;
default:
ptest.CoefQfrom = 1.0;
ptest.CoefQto = 1.1;
break;
}
break;
}
///
/// Upper and lower limits of relative error
///
switch (LoadedProfile.ProfileType)
{
case ProfileType.Q3R:
case ProfileType.QnClassColdWater:
switch (count)
{
case 3:
ptest.ErrLimLo = -5.0;
ptest.ErrLimHi = 5.0;
break;
default:
ptest.ErrLimLo = -2.0;
ptest.ErrLimHi = 2.0;
break;
}
break;
case ProfileType.QnClassHotWater:
switch (count)
{
case 3:
ptest.ErrLimLo = -5.0;
ptest.ErrLimHi = 5.0;
break;
default:
ptest.ErrLimLo = -3.0;
ptest.ErrLimHi = 3.0;
break;
}
break;
}
LoadedProfile.Tests.Add(ptest);
AddToMetrologyTab(ptest);

View File

@ -147,6 +147,9 @@
<data name="errorCalculationRadioButton2.Text" xml:space="preserve">
<value>Qp and Class</value>
</data>
<data name="errorCalculationRadioButton2.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;errorCalculationRadioButton2.Name" xml:space="preserve">
<value>errorCalculationRadioButton2</value>
</data>
@ -177,6 +180,9 @@
<data name="errorCalculationRadioButton1.Text" xml:space="preserve">
<value>Entering numbers manually</value>
</data>
<data name="errorCalculationRadioButton1.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;errorCalculationRadioButton1.Name" xml:space="preserve">
<value>errorCalculationRadioButton1</value>
</data>
@ -201,6 +207,9 @@
<data name="groupBox2.Text" xml:space="preserve">
<value>Error bounds calculation</value>
</data>
<data name="groupBox2.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;groupBox2.Name" xml:space="preserve">
<value>groupBox2</value>
</data>
@ -283,13 +292,13 @@
<value>28, 42</value>
</data>
<data name="profileTypeRadioButton2.Size" type="System.Drawing.Size, System.Drawing">
<value>169, 17</value>
<value>146, 17</value>
</data>
<data name="profileTypeRadioButton2.TabIndex" type="System.Int32, mscorlib">
<value>35</value>
</data>
<data name="profileTypeRadioButton2.Text" xml:space="preserve">
<value>Qn and Class (Qn &lt;= 15 m3/h)</value>
<value>Qn and Class - cold water</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton2.Name" xml:space="preserve">
<value>profileTypeRadioButton2</value>
@ -343,13 +352,13 @@
<value>28, 63</value>
</data>
<data name="profileTypeRadioButton3.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 17</value>
<value>141, 17</value>
</data>
<data name="profileTypeRadioButton3.TabIndex" type="System.Int32, mscorlib">
<value>36</value>
</data>
<data name="profileTypeRadioButton3.Text" xml:space="preserve">
<value>Qn and Class (Qn &gt; 15 m3/h)</value>
<value>Qn and Class - hot water</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton3.Name" xml:space="preserve">
<value>profileTypeRadioButton3</value>
@ -736,7 +745,7 @@
<value>metrologyListViewEx</value>
</data>
<data name="&gt;&gt;metrologyListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.24.1359.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;metrologyListViewEx.Parent" xml:space="preserve">
<value>metrologyTabPage</value>
@ -787,7 +796,7 @@
<value>errorFlagsListViewEx</value>
</data>
<data name="&gt;&gt;errorFlagsListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.24.1359.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;errorFlagsListViewEx.Parent" xml:space="preserve">
<value>errorFlagsTabPage</value>
@ -835,7 +844,7 @@
<value>errorFlags2ListViewEx</value>
</data>
<data name="&gt;&gt;errorFlags2ListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.24.1359.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;errorFlags2ListViewEx.Parent" xml:space="preserve">
<value>errorFlags2TabPage</value>
@ -919,7 +928,7 @@
<value>sharedButtons</value>
</data>
<data name="&gt;&gt;sharedButtons.Type" xml:space="preserve">
<value>TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1365.0, Culture=neutral, PublicKeyToken=null</value>
<value>TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1372.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;sharedButtons.Parent" xml:space="preserve">
<value>mainSplitContainer.Panel2</value>

View File

@ -49,6 +49,10 @@ namespace TBF.UI.Bench.TestProfiles
public void Initialize(TestProfilesDlg parent, Control parentControl)
{
if (Parent == null) return;
session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
this.parent = parent;
this.parentControl = parentControl;
@ -83,12 +87,20 @@ namespace TBF.UI.Bench.TestProfiles
void ReloadAndRedrawAll()
{
/// Load the procedures
if (session == null) session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
if (session == null) return;
MyItems = session.QueryOver<Profile>()
.OrderBy(x => x.ItemNr).Asc
.List();
try
{
MyItems = session.QueryOver<Profile>()
.OrderBy(x => x.ItemNr).Asc
.List();
}
catch (Exception exc)
{
log.ErrorFormat("Loading Profiles from DB failed: {0}", exc.Message);
MyItems = new List<Profile>();
return;
}
base.RedrawAll();
}
@ -197,7 +209,7 @@ namespace TBF.UI.Bench.TestProfiles
{
newName = Strings.New_profile_name + nameId.ToString();
bool notUsed = true;
foreach (var t in MyItems) if (t.Name.Equals(newName)) notUsed = false;
foreach (var t in MyItems) if (t.Name.ToLower().Equals(newName.ToLower())) notUsed = false;
if (notUsed) break;
}
@ -205,7 +217,7 @@ namespace TBF.UI.Bench.TestProfiles
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProfile.CreationTime = DateTime.Now;
if (new TestProfileDlg(newProfile, GetUsedNames(), true).ShowDialog() == DialogResult.OK)
if (new TestProfileDlg(newProfile, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@ -252,7 +264,8 @@ namespace TBF.UI.Bench.TestProfiles
{
try
{
foreach (var entity in ToBeRemovedItems) session.Delete(entity);
foreach (var entity in ToBeRemovedItems)
session.Delete(entity);
ToBeRemovedItems.Clear();
int itemNr = 0;
@ -281,8 +294,8 @@ namespace TBF.UI.Bench.TestProfiles
Profile editedProfile = SelectedItems[0].Tag as Profile;
IList<string> usedNames = GetUsedNames();
usedNames.Remove(editedProfile.Name); /// Allow original procedure name
IList<string> usedNames = GetUsedNames(false);
usedNames.Remove(editedProfile.Name.ToLower()); /// Allow original procedure name
///
if (new TestProfileDlg(editedProfile, usedNames).ShowDialog() == DialogResult.OK)
{
@ -329,7 +342,7 @@ namespace TBF.UI.Bench.TestProfiles
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProfile.CreationTime = DateTime.Now;
if ((new TestProfileDlg(newProfile, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
if ((new TestProfileDlg(newProfile, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@ -378,7 +391,7 @@ namespace TBF.UI.Bench.TestProfiles
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProfile.CreationTime = DateTime.Now;
if ((new TestProfileDlg(newProfile, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
if ((new TestProfileDlg(newProfile, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();

View File

@ -46,7 +46,7 @@ namespace TBF.UI.Bench.TestProfiles
sharedButtons.CompareClicked += testProfilesCtrl.compareButton_Click;
}
private void ProceduresDlg_Load(object sender, EventArgs e)
private void TestProfilesDlg_Load(object sender, EventArgs e)
{
LoadUISettings();
Text = Strings.Test_profiles;

View File

@ -89,7 +89,7 @@ namespace TBF.UI.Bench.TestProfiles
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TestProfilesDlg";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProceduresDlg_FormClosed);
this.Load += new System.EventHandler(this.ProceduresDlg_Load);
this.Load += new System.EventHandler(this.TestProfilesDlg_Load);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();

View File

@ -86,6 +86,8 @@ namespace TBF.UI.Procedures
this.parametersTabPage = new System.Windows.Forms.TabPage();
this.parametersListViewEx = new Results.Forms.ListViewEx();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
this.testProfileLabel = new System.Windows.Forms.Label();
this.testProfileTextBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
this.mainSplitContainer.Panel1.SuspendLayout();
this.mainSplitContainer.Panel2.SuspendLayout();
@ -128,6 +130,8 @@ namespace TBF.UI.Procedures
//
// generalTabPage
//
this.generalTabPage.Controls.Add(this.testProfileTextBox);
this.generalTabPage.Controls.Add(this.testProfileLabel);
this.generalTabPage.Controls.Add(this.altProcPeriodTextBox);
this.generalTabPage.Controls.Add(this.altProcPeriodLabel);
this.generalTabPage.Controls.Add(this.altProcNameTextBox);
@ -489,6 +493,16 @@ namespace TBF.UI.Procedures
resources.ApplyResources(this.sharedButtons, "sharedButtons");
this.sharedButtons.Name = "sharedButtons";
//
// testProfileLabel
//
resources.ApplyResources(this.testProfileLabel, "testProfileLabel");
this.testProfileLabel.Name = "testProfileLabel";
//
// testProfileTextBox
//
resources.ApplyResources(this.testProfileTextBox, "testProfileTextBox");
this.testProfileTextBox.Name = "testProfileTextBox";
//
// ProcedureDlg
//
resources.ApplyResources(this, "$this");
@ -568,5 +582,7 @@ namespace TBF.UI.Procedures
private System.Windows.Forms.Label altProcNameLabel;
private System.Windows.Forms.TextBox altProcPeriodTextBox;
private System.Windows.Forms.Label altProcPeriodLabel;
private System.Windows.Forms.Label testProfileLabel;
private System.Windows.Forms.TextBox testProfileTextBox;
}
}

View File

@ -416,6 +416,7 @@ namespace TBF.UI.Procedures
label15.Text = Strings.Date;
label18.Text = Strings.Notes;
watermetersLabel.Text = Strings.Meter_types_tested;
testProfileLabel.Text = Strings.Test_profiles;
altProcNameLabel.Text = Strings.Conditions;
protectedCheckBox.Text = Strings.Protected_procedure;
mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed;
@ -454,8 +455,9 @@ namespace TBF.UI.Procedures
transitionStartComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionStart) ? "---" : LoadedProcedure.TransitionStart;
transitionEndComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionEnd) ? "---" : LoadedProcedure.TransitionEnd;
altProcNameTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
altProcPeriodTextBox.Text = LoadedProcedure.AltProcPeriod.ToString();
testProfileTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
//altProcNameTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName;
//altProcPeriodTextBox.Text = LoadedProcedure.AltProcPeriod.ToString();
if (string.IsNullOrEmpty(LoadedProcedure.ResultsPrinter))
{
@ -505,13 +507,9 @@ namespace TBF.UI.Procedures
LoadedProcedure.MustBeComplete = mustBeCompleteCheckBox.Checked;
LoadedProcedure.ManualCtrlDisabled = manualControlDisabledCheckBox.Checked;
LoadedProcedure.AltProcName = altProcNameTextBox.Text.Equals("---") ? string.Empty : altProcNameTextBox.Text;
int itmp;
if (int.TryParse(altProcPeriodTextBox.Text, out itmp) && itmp >= 0)
{
LoadedProcedure.AltProcPeriod = itmp;
}
//LoadedProcedure.AltProcName = altProcNameTextBox.Text.Equals("---") ? string.Empty : altProcNameTextBox.Text;
//int itmp;
//if (int.TryParse(altProcPeriodTextBox.Text, out itmp) && itmp >= 0) { LoadedProcedure.AltProcPeriod = itmp; }
if (transitionStartComboBox.Items.Contains(transitionStartComboBox.Text))
{
@ -805,10 +803,18 @@ namespace TBF.UI.Procedures
#if TEST_PROFILES
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
#endif
if (unlocked && (e.SubItem < (int)MtrlgyClmn.CoulumnsCount))
{
metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
}
if (!unlocked || (e.SubItem >= (int)MtrlgyClmn.CoulumnsCount)) return;
MtrlgyClmn[] protectedColumns = new MtrlgyClmn[]
{
MtrlgyClmn.Name,
MtrlgyClmn.Qfrom, MtrlgyClmn.Qto,
MtrlgyClmn.ErrLimLo, MtrlgyClmn.ErrLimHi,
MtrlgyClmn.TempLimLo, MtrlgyClmn.TempLimHi
};
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<MtrlgyClmn>((MtrlgyClmn)e.SubItem)) return;
metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
}
void metrology1ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
@ -1060,10 +1066,14 @@ namespace TBF.UI.Procedures
private void metrology2ListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount)
{
return;
}
if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount) return;
Mtrlgy2Clmn[] protectedColumns = new Mtrlgy2Clmn[]
{
Mtrlgy2Clmn.Name,
Mtrlgy2Clmn.Publish, Mtrlgy2Clmn.Evaluate
};
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<Mtrlgy2Clmn>((Mtrlgy2Clmn)e.SubItem)) return;
metrology2ListViewEx.StartEditing(metrology2Editors[e.SubItem], e.Item, e.SubItem);
}
@ -1256,6 +1266,7 @@ namespace TBF.UI.Procedures
void AddToProcessTab(Test test)
{
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
bool isNotAHydroTest = (tm != null) && !tm.DoTransitions();
///
/// Process item with subitems
@ -1263,23 +1274,8 @@ namespace TBF.UI.Procedures
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
if (tm != null && tm.DoTransitions())
{
lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no); /// Draining before test
lvi.SubItems.Add(test.DoDrainingAfter ? Strings.yes : Strings.no); /// Draining after test
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
#if HEAT_METERS
lvi.SubItems.Add(test.HeatMetersPath);
#endif
lvi.SubItems.Add(test.MetersPath);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
}
else
if (isNotAHydroTest)
{
lvi.SubItems.Add(string.Empty); /// Draining before test N/A
lvi.SubItems.Add(string.Empty); /// Draining after test N/A
@ -1294,6 +1290,21 @@ namespace TBF.UI.Procedures
lvi.SubItems.Add(string.Empty); /// RelTransBetween N/A
lvi.SubItems.Add(string.Empty); /// TransitionAfter N/A
}
else
{
lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no); /// Draining before test
lvi.SubItems.Add(test.DoDrainingAfter ? Strings.yes : Strings.no); /// Draining after test
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
#if HEAT_METERS
lvi.SubItems.Add(test.HeatMetersPath);
#endif
lvi.SubItems.Add(test.MetersPath);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
}
processListViewEx.Items.Add(lvi);
}
@ -1303,77 +1314,87 @@ namespace TBF.UI.Procedures
for (int i = 0; i < processListViewEx.Items.Count; i++)
{
ListViewItem lvi = processListViewEx.Items[i];
Test entity = (Test)lvi.Tag;
Test test = (Test)lvi.Tag;
entity.Name = lvi.Text;
entity.ItemNr = i;
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
bool isNotAHydroTest = (tm != null) && !tm.DoTransitions();
int part = entity.Part;
test.Name = lvi.Text;
test.ItemNr = i;
int part = test.Part;
if (lvi.SubItems[(int)ProcessClmn.Part].Text.Equals("-"))
{
entity.Part = 0;
test.Part = 0;
}
else if (int.TryParse(lvi.SubItems[(int)ProcessClmn.Part].Text, out part))
{
entity.Part = part;
test.Part = part;
}
entity.DoDraining = lvi.SubItems[(int)ProcessClmn.DrainingBefore].Text.Equals(Strings.yes);
entity.DoDrainingAfter = lvi.SubItems[(int)ProcessClmn.DrainingAfter].Text.Equals(Strings.yes);
int column;
string subItemText;
if (!isNotAHydroTest)
{
/// Is a hydraulical test or test.Method component == null
test.DoDraining = lvi.SubItems[(int)ProcessClmn.DrainingBefore].Text.Equals(Strings.yes);
test.DoDrainingAfter = lvi.SubItems[(int)ProcessClmn.DrainingAfter].Text.Equals(Strings.yes);
int column = (int)ProcessClmn.Feeding;
string subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.FeedingPath = subItemText;
}
column = (int)ProcessClmn.Feeding;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
test.FeedingPath = subItemText;
}
column = (int)ProcessClmn.Bench;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.BenchPath = subItemText;
}
column = (int)ProcessClmn.Bench;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
test.BenchPath = subItemText;
}
column = (int)ProcessClmn.Output;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.OutputPath = subItemText;
}
column = (int)ProcessClmn.Output;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
test.OutputPath = subItemText;
}
column = (int)ProcessClmn.TrnStart;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
test.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
column = (int)ProcessClmn.TrnBetween;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
test.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
column = (int)ProcessClmn.TrnStop;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
test.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
}
column = (int)ProcessClmn.Sensor;
subItemText = lvi.SubItems[column].Text;
if ((processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.MetersPath = subItemText;
}
{
test.MetersPath = subItemText;
}
#if HEAT_METERS
if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text))
{
entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text;
}
#endif
column = (int)ProcessClmn.TrnStart;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
column = (int)ProcessClmn.TrnBetween;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
column = (int)ProcessClmn.TrnStop;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
}
}
@ -1384,18 +1405,22 @@ namespace TBF.UI.Procedures
return;
}
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod;
ProcessClmn[] protectedColumns = new ProcessClmn[] { ProcessClmn.Name };
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<ProcessClmn>((ProcessClmn)e.SubItem)) return;
if (tm != null && (tm.DoTransitions() == false) && ((e.SubItem == (int)ProcessClmn.DrainingBefore) ||
(e.SubItem == (int)ProcessClmn.DrainingAfter) ||
(e.SubItem == (int)ProcessClmn.Feeding) ||
(e.SubItem == (int)ProcessClmn.Bench) ||
(e.SubItem == (int)ProcessClmn.Output) ||
(e.SubItem == (int)ProcessClmn.TrnStart) ||
(e.SubItem == (int)ProcessClmn.TrnBetween) ||
(e.SubItem == (int)ProcessClmn.TrnStop)))
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod;
bool isNotAHydroTest = (tm != null) && !tm.DoTransitions();
if (isNotAHydroTest && ((e.SubItem == (int)ProcessClmn.DrainingBefore) ||
(e.SubItem == (int)ProcessClmn.DrainingAfter) ||
(e.SubItem == (int)ProcessClmn.Feeding) ||
(e.SubItem == (int)ProcessClmn.Bench) ||
(e.SubItem == (int)ProcessClmn.Output) ||
(e.SubItem == (int)ProcessClmn.TrnStart) ||
(e.SubItem == (int)ProcessClmn.TrnBetween) ||
(e.SubItem == (int)ProcessClmn.TrnStop)))
{
return;
return; /// Prevent editing these cells
}
processListViewEx.StartEditing(processEditors[e.SubItem], e.Item, e.SubItem);
@ -1651,6 +1676,9 @@ namespace TBF.UI.Procedures
return;
}
ProcessClmn[] protectedColumns = new ProcessClmn[] { ProcessClmn.Name };
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<ProcessClmn>((ProcessClmn)e.SubItem)) return;
parametersListViewEx.StartEditing(parametersEditors[e.SubItem], e.Item, e.SubItem);
}
@ -1865,7 +1893,7 @@ namespace TBF.UI.Procedures
foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
if (usedNames != null && usedNames.Contains(LoadedProcedure.Name))
if (usedNames != null && usedNames.Contains(LoadedProcedure.Name.ToLower()))
{
MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProcedure.Name, Environment.NewLine),
Strings.Warning,
@ -2245,7 +2273,13 @@ namespace TBF.UI.Procedures
/// Check the selected index validity
if (listViewEx.SelectedItems.Count != 1) return;
int removeItemNr = listViewEx.SelectedIndices[0];
if (LoadedProcedure.Tests[removeItemNr].Profile >= TestProfile.Protected)
{
MessageBox.Show("This test is protected and cannot be deleted.");
return;
}
/// Remove the selected test
Test toBeDeleted = LoadedProcedure.Tests[removeItemNr];
LoadedProcedure.Tests.Remove(toBeDeleted);

View File

@ -129,14 +129,68 @@
<data name="mainSplitContainer.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="testProfileTextBox.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="testProfileTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 128</value>
</data>
<data name="testProfileTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>522, 20</value>
</data>
<data name="testProfileTextBox.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
</data>
<data name="&gt;&gt;testProfileTextBox.Name" xml:space="preserve">
<value>testProfileTextBox</value>
</data>
<data name="&gt;&gt;testProfileTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;testProfileTextBox.Parent" xml:space="preserve">
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;testProfileTextBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="testProfileLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="testProfileLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="testProfileLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>20, 131</value>
</data>
<data name="testProfileLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 13</value>
</data>
<data name="testProfileLabel.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
</data>
<data name="testProfileLabel.Text" xml:space="preserve">
<value>Test profiles</value>
</data>
<data name="&gt;&gt;testProfileLabel.Name" xml:space="preserve">
<value>testProfileLabel</value>
</data>
<data name="&gt;&gt;testProfileLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;testProfileLabel.Parent" xml:space="preserve">
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;testProfileLabel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="altProcPeriodTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>676, 128</value>
<value>676, 361</value>
</data>
<data name="altProcPeriodTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>34, 20</value>
</data>
<data name="altProcPeriodTextBox.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
<value>41</value>
</data>
<data name="altProcPeriodTextBox.Visible" type="System.Boolean, mscorlib">
<value>False</value>
@ -151,7 +205,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;altProcPeriodTextBox.ZOrder" xml:space="preserve">
<value>0</value>
<value>2</value>
</data>
<data name="altProcPeriodLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -160,13 +214,13 @@
<value>NoControl</value>
</data>
<data name="altProcPeriodLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>542, 131</value>
<value>542, 364</value>
</data>
<data name="altProcPeriodLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>116, 13</value>
</data>
<data name="altProcPeriodLabel.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
<value>40</value>
</data>
<data name="altProcPeriodLabel.Text" xml:space="preserve">
<value>Alternative proc. period</value>
@ -184,16 +238,16 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;altProcPeriodLabel.ZOrder" xml:space="preserve">
<value>1</value>
<value>3</value>
</data>
<data name="altProcNameTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 128</value>
<value>188, 361</value>
</data>
<data name="altProcNameTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>217, 20</value>
</data>
<data name="altProcNameTextBox.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
<value>39</value>
</data>
<data name="altProcNameTextBox.Visible" type="System.Boolean, mscorlib">
<value>False</value>
@ -208,7 +262,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;altProcNameTextBox.ZOrder" xml:space="preserve">
<value>2</value>
<value>4</value>
</data>
<data name="altProcNameLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -217,13 +271,13 @@
<value>NoControl</value>
</data>
<data name="altProcNameLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>20, 131</value>
<value>20, 364</value>
</data>
<data name="altProcNameLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>113, 13</value>
</data>
<data name="altProcNameLabel.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
<value>38</value>
</data>
<data name="altProcNameLabel.Text" xml:space="preserve">
<value>Alternative proc. name</value>
@ -241,7 +295,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;altProcNameLabel.ZOrder" xml:space="preserve">
<value>3</value>
<value>5</value>
</data>
<data name="manualControlDisabledCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -256,7 +310,7 @@
<value>138, 17</value>
</data>
<data name="manualControlDisabledCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
<value>35</value>
</data>
<data name="manualControlDisabledCheckBox.Text" xml:space="preserve">
<value>Manual control disabled</value>
@ -271,7 +325,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;manualControlDisabledCheckBox.ZOrder" xml:space="preserve">
<value>4</value>
<value>6</value>
</data>
<data name="mustBeCompleteCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -286,7 +340,7 @@
<value>152, 17</value>
</data>
<data name="mustBeCompleteCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>38</value>
<value>34</value>
</data>
<data name="mustBeCompleteCheckBox.Text" xml:space="preserve">
<value>All tests must be competed</value>
@ -301,7 +355,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;mustBeCompleteCheckBox.ZOrder" xml:space="preserve">
<value>5</value>
<value>7</value>
</data>
<data name="protectedCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -316,7 +370,7 @@
<value>123, 17</value>
</data>
<data name="protectedCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
<value>33</value>
</data>
<data name="protectedCheckBox.Text" xml:space="preserve">
<value>Protected procedure</value>
@ -331,7 +385,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;protectedCheckBox.ZOrder" xml:space="preserve">
<value>6</value>
<value>8</value>
</data>
<data name="metersKindRadioButton3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -346,7 +400,7 @@
<value>77, 17</value>
</data>
<data name="metersKindRadioButton3.TabIndex" type="System.Int32, mscorlib">
<value>36</value>
<value>32</value>
</data>
<data name="metersKindRadioButton3.Text" xml:space="preserve">
<value>Heat meter</value>
@ -361,7 +415,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;metersKindRadioButton3.ZOrder" xml:space="preserve">
<value>7</value>
<value>9</value>
</data>
<data name="fileWriter4ComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 336</value>
@ -370,7 +424,7 @@
<value>121, 21</value>
</data>
<data name="fileWriter4ComboBox.TabIndex" type="System.Int32, mscorlib">
<value>33</value>
<value>29</value>
</data>
<data name="&gt;&gt;fileWriter4ComboBox.Name" xml:space="preserve">
<value>fileWriter4ComboBox</value>
@ -382,7 +436,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;fileWriter4ComboBox.ZOrder" xml:space="preserve">
<value>8</value>
<value>10</value>
</data>
<data name="fileWriter3ComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 312</value>
@ -391,7 +445,7 @@
<value>121, 21</value>
</data>
<data name="fileWriter3ComboBox.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
<value>28</value>
</data>
<data name="&gt;&gt;fileWriter3ComboBox.Name" xml:space="preserve">
<value>fileWriter3ComboBox</value>
@ -403,7 +457,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;fileWriter3ComboBox.ZOrder" xml:space="preserve">
<value>9</value>
<value>11</value>
</data>
<data name="printer2ComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 243</value>
@ -412,7 +466,7 @@
<value>121, 21</value>
</data>
<data name="printer2ComboBox.TabIndex" type="System.Int32, mscorlib">
<value>28</value>
<value>24</value>
</data>
<data name="&gt;&gt;printer2ComboBox.Name" xml:space="preserve">
<value>printer2ComboBox</value>
@ -424,7 +478,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;printer2ComboBox.ZOrder" xml:space="preserve">
<value>10</value>
<value>12</value>
</data>
<data name="fileWriter2ComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 289</value>
@ -433,7 +487,7 @@
<value>121, 21</value>
</data>
<data name="fileWriter2ComboBox.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
<value>27</value>
</data>
<data name="&gt;&gt;fileWriter2ComboBox.Name" xml:space="preserve">
<value>fileWriter2ComboBox</value>
@ -445,7 +499,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;fileWriter2ComboBox.ZOrder" xml:space="preserve">
<value>11</value>
<value>13</value>
</data>
<data name="metersKindRadioButton2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -460,7 +514,7 @@
<value>72, 17</value>
</data>
<data name="metersKindRadioButton2.TabIndex" type="System.Int32, mscorlib">
<value>35</value>
<value>31</value>
</data>
<data name="metersKindRadioButton2.Text" xml:space="preserve">
<value>Combined</value>
@ -475,7 +529,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;metersKindRadioButton2.ZOrder" xml:space="preserve">
<value>12</value>
<value>14</value>
</data>
<data name="metersKindRadioButton1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -490,7 +544,7 @@
<value>54, 17</value>
</data>
<data name="metersKindRadioButton1.TabIndex" type="System.Int32, mscorlib">
<value>34</value>
<value>30</value>
</data>
<data name="metersKindRadioButton1.Text" xml:space="preserve">
<value>Single</value>
@ -505,7 +559,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;metersKindRadioButton1.ZOrder" xml:space="preserve">
<value>13</value>
<value>15</value>
</data>
<data name="transitionEndComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 197</value>
@ -514,7 +568,7 @@
<value>121, 21</value>
</data>
<data name="transitionEndComboBox.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
<value>21</value>
</data>
<data name="&gt;&gt;transitionEndComboBox.Name" xml:space="preserve">
<value>transitionEndComboBox</value>
@ -526,7 +580,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;transitionEndComboBox.ZOrder" xml:space="preserve">
<value>14</value>
<value>16</value>
</data>
<data name="transitionEndLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -541,7 +595,7 @@
<value>63, 13</value>
</data>
<data name="transitionEndLabel.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
<value>20</value>
</data>
<data name="transitionEndLabel.Text" xml:space="preserve">
<value>Purge - End</value>
@ -556,7 +610,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;transitionEndLabel.ZOrder" xml:space="preserve">
<value>15</value>
<value>17</value>
</data>
<data name="transitionStartComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 174</value>
@ -565,7 +619,7 @@
<value>121, 21</value>
</data>
<data name="transitionStartComboBox.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
<value>19</value>
</data>
<data name="&gt;&gt;transitionStartComboBox.Name" xml:space="preserve">
<value>transitionStartComboBox</value>
@ -577,7 +631,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;transitionStartComboBox.ZOrder" xml:space="preserve">
<value>16</value>
<value>18</value>
</data>
<data name="transitionStartLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -592,7 +646,7 @@
<value>71, 13</value>
</data>
<data name="transitionStartLabel.TabIndex" type="System.Int32, mscorlib">
<value>22</value>
<value>18</value>
</data>
<data name="transitionStartLabel.Text" xml:space="preserve">
<value>Purge - Begin</value>
@ -607,7 +661,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;transitionStartLabel.ZOrder" xml:space="preserve">
<value>17</value>
<value>19</value>
</data>
<data name="fileWriter1ComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 266</value>
@ -616,7 +670,7 @@
<value>121, 21</value>
</data>
<data name="fileWriter1ComboBox.TabIndex" type="System.Int32, mscorlib">
<value>30</value>
<value>26</value>
</data>
<data name="&gt;&gt;fileWriter1ComboBox.Name" xml:space="preserve">
<value>fileWriter1ComboBox</value>
@ -628,7 +682,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;fileWriter1ComboBox.ZOrder" xml:space="preserve">
<value>18</value>
<value>20</value>
</data>
<data name="printer1ComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 220</value>
@ -637,7 +691,7 @@
<value>121, 21</value>
</data>
<data name="printer1ComboBox.TabIndex" type="System.Int32, mscorlib">
<value>27</value>
<value>23</value>
</data>
<data name="&gt;&gt;printer1ComboBox.Name" xml:space="preserve">
<value>printer1ComboBox</value>
@ -649,7 +703,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;printer1ComboBox.ZOrder" xml:space="preserve">
<value>19</value>
<value>21</value>
</data>
<data name="dataEntryComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 151</value>
@ -658,7 +712,7 @@
<value>121, 21</value>
</data>
<data name="dataEntryComboBox.TabIndex" type="System.Int32, mscorlib">
<value>21</value>
<value>17</value>
</data>
<data name="&gt;&gt;dataEntryComboBox.Name" xml:space="preserve">
<value>dataEntryComboBox</value>
@ -670,7 +724,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;dataEntryComboBox.ZOrder" xml:space="preserve">
<value>20</value>
<value>22</value>
</data>
<data name="resultsWriterLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -685,7 +739,7 @@
<value>70, 13</value>
</data>
<data name="resultsWriterLabel.TabIndex" type="System.Int32, mscorlib">
<value>29</value>
<value>25</value>
</data>
<data name="resultsWriterLabel.Text" xml:space="preserve">
<value>Results writer</value>
@ -700,7 +754,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;resultsWriterLabel.ZOrder" xml:space="preserve">
<value>21</value>
<value>23</value>
</data>
<data name="resultsPrinterLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -715,7 +769,7 @@
<value>42, 13</value>
</data>
<data name="resultsPrinterLabel.TabIndex" type="System.Int32, mscorlib">
<value>26</value>
<value>22</value>
</data>
<data name="resultsPrinterLabel.Text" xml:space="preserve">
<value>Printers</value>
@ -730,7 +784,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;resultsPrinterLabel.ZOrder" xml:space="preserve">
<value>22</value>
<value>24</value>
</data>
<data name="dataEntryLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -745,7 +799,7 @@
<value>57, 13</value>
</data>
<data name="dataEntryLabel.TabIndex" type="System.Int32, mscorlib">
<value>20</value>
<value>16</value>
</data>
<data name="dataEntryLabel.Text" xml:space="preserve">
<value>Data Entry</value>
@ -760,7 +814,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;dataEntryLabel.ZOrder" xml:space="preserve">
<value>23</value>
<value>25</value>
</data>
<data name="notesTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>393, 243</value>
@ -772,7 +826,7 @@
<value>317, 113</value>
</data>
<data name="notesTextBox.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
<value>37</value>
</data>
<data name="&gt;&gt;notesTextBox.Name" xml:space="preserve">
<value>notesTextBox</value>
@ -784,7 +838,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;notesTextBox.ZOrder" xml:space="preserve">
<value>24</value>
<value>26</value>
</data>
<data name="label18.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -799,7 +853,7 @@
<value>35, 13</value>
</data>
<data name="label18.TabIndex" type="System.Int32, mscorlib">
<value>40</value>
<value>36</value>
</data>
<data name="label18.Text" xml:space="preserve">
<value>Notes</value>
@ -814,7 +868,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label18.ZOrder" xml:space="preserve">
<value>25</value>
<value>27</value>
</data>
<data name="watermetersTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 105</value>
@ -835,7 +889,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;watermetersTextBox.ZOrder" xml:space="preserve">
<value>26</value>
<value>28</value>
</data>
<data name="watermetersLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -865,7 +919,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;watermetersLabel.ZOrder" xml:space="preserve">
<value>27</value>
<value>29</value>
</data>
<data name="lastChangedOnTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>402, 82</value>
@ -886,7 +940,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;lastChangedOnTextBox.ZOrder" xml:space="preserve">
<value>28</value>
<value>30</value>
</data>
<data name="label15.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -916,7 +970,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label15.ZOrder" xml:space="preserve">
<value>29</value>
<value>31</value>
</data>
<data name="lastChangedByTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 82</value>
@ -937,7 +991,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;lastChangedByTextBox.ZOrder" xml:space="preserve">
<value>30</value>
<value>32</value>
</data>
<data name="label16.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -967,7 +1021,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label16.ZOrder" xml:space="preserve">
<value>31</value>
<value>33</value>
</data>
<data name="createdOnTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>402, 59</value>
@ -988,7 +1042,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;createdOnTextBox.ZOrder" xml:space="preserve">
<value>32</value>
<value>34</value>
</data>
<data name="label14.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1018,7 +1072,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label14.ZOrder" xml:space="preserve">
<value>33</value>
<value>35</value>
</data>
<data name="createdByTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 59</value>
@ -1039,7 +1093,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;createdByTextBox.ZOrder" xml:space="preserve">
<value>34</value>
<value>36</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1069,7 +1123,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>35</value>
<value>37</value>
</data>
<data name="descriptionTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 36</value>
@ -1090,7 +1144,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;descriptionTextBox.ZOrder" xml:space="preserve">
<value>36</value>
<value>38</value>
</data>
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1120,7 +1174,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label12.ZOrder" xml:space="preserve">
<value>37</value>
<value>39</value>
</data>
<data name="procNameTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>188, 13</value>
@ -1141,7 +1195,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;procNameTextBox.ZOrder" xml:space="preserve">
<value>38</value>
<value>40</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1171,7 +1225,7 @@
<value>generalTabPage</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>39</value>
<value>41</value>
</data>
<data name="generalTabPage.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 34</value>
@ -1180,7 +1234,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="generalTabPage.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 391</value>
</data>
<data name="generalTabPage.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -1216,7 +1270,7 @@
<value>historyListViewEx</value>
</data>
<data name="&gt;&gt;historyListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;historyListViewEx.Parent" xml:space="preserve">
<value>historyTabPage</value>
@ -1267,7 +1321,7 @@
<value>metrology1ListViewEx</value>
</data>
<data name="&gt;&gt;metrology1ListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;metrology1ListViewEx.Parent" xml:space="preserve">
<value>metrology1TabPage</value>
@ -1318,7 +1372,7 @@
<value>metrology2ListViewEx</value>
</data>
<data name="&gt;&gt;metrology2ListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;metrology2ListViewEx.Parent" xml:space="preserve">
<value>metrology2TabPage</value>
@ -1369,7 +1423,7 @@
<value>processListViewEx</value>
</data>
<data name="&gt;&gt;processListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;processListViewEx.Parent" xml:space="preserve">
<value>processTabPage</value>
@ -1420,7 +1474,7 @@
<value>parametersListViewEx</value>
</data>
<data name="&gt;&gt;parametersListViewEx.Type" xml:space="preserve">
<value>Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null</value>
<value>Results.Forms.ListViewEx, Results, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;parametersListViewEx.Parent" xml:space="preserve">
<value>parametersTabPage</value>
@ -1462,7 +1516,7 @@
<value>0, 0</value>
</data>
<data name="tabControl.Size" type="System.Drawing.Size, System.Drawing">
<value>931, 404</value>
<value>931, 429</value>
</data>
<data name="tabControl.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -1504,7 +1558,7 @@
<value>sharedButtons</value>
</data>
<data name="&gt;&gt;sharedButtons.Type" xml:space="preserve">
<value>TBF.UiControls.SharedButtons, TBF, Version=2.18.901.0, Culture=neutral, PublicKeyToken=null</value>
<value>TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1368.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;sharedButtons.Parent" xml:space="preserve">
<value>mainSplitContainer.Panel2</value>
@ -1525,7 +1579,7 @@
<value>1</value>
</data>
<data name="mainSplitContainer.Size" type="System.Drawing.Size, System.Drawing">
<value>1034, 404</value>
<value>1034, 429</value>
</data>
<data name="mainSplitContainer.SplitterDistance" type="System.Int32, mscorlib">
<value>931</value>
@ -1552,7 +1606,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>1034, 404</value>
<value>1034, 429</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>

View File

@ -40,6 +40,7 @@ namespace TBF.UI.Procedures
Control[] editors;
ISession session;
IErrorFlags errorFlagsCmpnt;
public ProceduresCtrl()
: base()
@ -49,7 +50,10 @@ namespace TBF.UI.Procedures
public void Initialize(ProceduresDlg parent, Control parentControl)
{
this.parent = parent;
/// Create a DB session
session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
this.parent = parent;
this.parentControl = parentControl;
SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
@ -57,10 +61,10 @@ namespace TBF.UI.Procedures
/// ListViewEx columns
TBF.LocalSettings ls = Program.LocalSettings;
Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : (30 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : ( 30 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.DescriptionColHdr, (ls.ProceduresColumnCount > 2) ? ls.ProceduresColumnWidths[2] : (300 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / Constants.Dpi100pct));
Columns.Add(Strings.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / Constants.Dpi100pct));
editors = new Control[columnsCount];
///
@ -83,13 +87,29 @@ namespace TBF.UI.Procedures
void ReloadAndRedrawAll()
{
/// Load the procedures
if (session == null) session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
try
{
/// Find ErrorFlags component
foreach (var cmpnt in TBF.BenchControl.TbfComponents.LoadComponentsFromDB(session))
{
if (cmpnt is IErrorFlags)
{
errorFlagsCmpnt = cmpnt as IErrorFlags;
break;
}
}
MyItems = session.QueryOver<Procedure>()
.Where(x => (x.ProcedureState == ProcedureState.Active))
.OrderBy(x => x.ItemNr).Asc
.List();
/// Load the procedures
MyItems = session.QueryOver<Procedure>()
.Where(x => (x.ProcedureState == ProcedureState.Active))
.OrderBy(x => x.ItemNr).Asc
.List();
}
catch (Exception exc)
{
log.ErrorFormat("Loading Procedures from DB failed: {0}", exc.Message);
MyItems = new List<Procedure>();
}
base.RedrawAll();
}
@ -198,7 +218,7 @@ namespace TBF.UI.Procedures
{
newName = Strings.New_procedure_name + nameId.ToString();
bool notUsed = true;
foreach (var t in MyItems) if (t.Name.Equals(newName)) notUsed = false;
foreach (var t in MyItems) if (t.Name.ToLower().Equals(newName.ToLower())) notUsed = false;
if (notUsed) break;
}
@ -210,7 +230,7 @@ namespace TBF.UI.Procedures
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now;
if (new ProcedureDlg(newProcedure, GetUsedNames(), true).ShowDialog() == DialogResult.OK)
if (new ProcedureDlg(newProcedure, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@ -290,8 +310,8 @@ namespace TBF.UI.Procedures
modifiedProcedure.Revision = originalProcedure.Revision + 1;
modifiedProcedure.ObtainedByCopy = false;
IList<string> usedNames = GetUsedNames();
usedNames.Remove(originalProcedure.Name); /// Allow original procedure name
IList<string> usedNames = GetUsedNames(false);
usedNames.Remove(originalProcedure.Name.ToLower()); /// Allow original procedure name
///
if (new ProcedureDlg(modifiedProcedure, usedNames).ShowDialog() == DialogResult.OK)
{
@ -346,7 +366,7 @@ namespace TBF.UI.Procedures
newProcedure.CreationTime = DateTime.Now;
newProcedure.Protected = false;
if ((new ProcedureDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
if ((new ProcedureDlg(newProcedure, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@ -399,7 +419,7 @@ namespace TBF.UI.Procedures
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now;
if ((new ProcedureDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK)
if ((new ProcedureDlg(newProcedure, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
@ -442,6 +462,217 @@ namespace TBF.UI.Procedures
}
}
public void CreateFromProfile()
{
IList<Profile> profiles;
try
{
profiles = session.QueryOver<Profile>().List();
}
catch (Exception)
{
log.Error("Reading Profiles failed");
MessageBox.Show("Reading Profiles failed");
return;
}
TestWizard.TestProfileSelection dlg = new TestWizard.TestProfileSelection(profiles);
if (dlg.ShowDialog() != DialogResult.OK) return;
/// Find an unused procedure name
string newName;
for (int nameId = 1; true; nameId++)
{
newName = Strings.New_procedure_name + nameId.ToString();
bool notUsed = true;
foreach (var t in MyItems) if (t.Name.ToLower().Equals(newName.ToLower())) notUsed = false;
if (notUsed) break;
}
ProfileType pt = dlg.SelectedProfile.ProfileType;
Procedure newProcedure = new Procedure(newName, MyItems.Count);
Medium medium = (pt == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
IList<IParamsProvider> errorFlagsParamsOfCreatedTests = new List<IParamsProvider>();
IList<IParamsProvider> waterMeterParamsOfNewProcedure = new List<IParamsProvider>();
IList<Component> cmpntEntities = session.QueryOver<Component>()
.OrderBy(x => x.ItemNr).Asc
.List<Component>();
IList<BenchControl.Generic.IComponent> components = BenchControl.TbfComponents.LoadComponentsFromDB(session);
foreach (var cmptn in components)
{
if (cmptn.ClassName == "WaterMeter")
{
IParamsProvider waterMeterParams = cmptn.Cfg.GetUIProcParamsProvider(newProcedure);
TBF.BenchControl.WaterMeters.WaterMeter.ProcParams wmParams = waterMeterParams as TBF.BenchControl.WaterMeters.WaterMeter.ProcParams;
if (wmParams != null)
{
wmParams.NewQnames = (pt == ProfileType.Q3R);
wmParams.Qmax = (float)((pt == ProfileType.Manual) ? 0 : Config.Utils.GetQ4Qmax(dlg.Qn, dlg.MetroClass, medium));
wmParams.Qn = (float)dlg.Qn;
wmParams.Qt = (float)((pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? (0.1 * dlg.Qn) : Config.Utils.GetQ2Qt(dlg.Qn, dlg.MetroClass, medium));
wmParams.Qmin = (float)((pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? dlg.Qn / dlg.QpQiRatio : Config.Utils.GetQ1Qmin(dlg.Qn, dlg.MetroClass, medium));
wmParams.MetrologicalClass = dlg.MetroClass;
wmParams.WaterTemp = medium;
}
waterMeterParamsOfNewProcedure.Add(waterMeterParams);
}
}
int itemNr = 0;
foreach (var ptest in dlg.SelectedProfile.Tests)
{
double Qtg;
if (ptest.Name.Contains("Q4") || ptest.Name.Contains("Qmax"))
{
Qtg = Config.Utils.GetQ4Qmax(dlg.Qn, dlg.MetroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.Contains("Q3") || ptest.Name.Contains("Qn") || ptest.Name.Equals("qp"))
{
Qtg = dlg.Qn;
}
else if (ptest.Name.Contains("Q2") || ptest.Name.Contains("Qt"))
{
Qtg = Config.Utils.GetQ2Qt(dlg.Qn, dlg.MetroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.Contains("Q1") || ptest.Name.Contains("Qmin"))
{
Qtg = Config.Utils.GetQ1Qmin(dlg.Qn, dlg.MetroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.Contains("0,1qp") || ptest.Name.Contains("0.1qp"))
{
Qtg = 0.1 * dlg.Qn;
}
else if (ptest.Name.Contains("qi"))
{
Qtg = dlg.Qn / dlg.QpQiRatio;
}
else
{
Qtg = dlg.Qn; /// Manual flow selection: CoefQfrom and CoefQto are used to calculate Qfrom and Qto from Qn
}
Test test = new Test(ptest.Name, itemNr++, newProcedure);
test.Part = ptest.Part;
test.Profile = (pt == ProfileType.QpQi) ? TestProfile.ProtectedHeatMeter : TestProfile.Protected;
test.Qtg = (float)Qtg;
test.Qfrom = (float)(Qtg * ptest.CoefQfrom);
test.Qto = (float)(Qtg * ptest.CoefQto);
test.TempLimLo = (float)ptest.TempLimLo;
test.TempLimHi = (float)ptest.TempLimHi;
test.DoEvaluate = true;
test.Publish = (sbyte)Publish.Always;
if (pt != ProfileType.QpQi)
{
test.ErrLimLo = (float)ptest.ErrLimLo;
test.ErrLimHi = (float)ptest.ErrLimHi;
}
else
{
int metroClass;
if (int.TryParse(dlg.MetroClass, out metroClass)) test.ErrLimLo = (float)metroClass;
test.ErrLimHi = -(float)dlg.Qn;
}
newProcedure.Tests.Add(test);
if (errorFlagsCmpnt != null)
{
IParamsProvider errorFlagsParams = errorFlagsCmpnt.Cfg.GetUITestParamsProvider(test);
TBF.BenchControl.Various.ErrorFlags.TestParams eFlagParams = errorFlagsParams as TBF.BenchControl.Various.ErrorFlags.TestParams;
if (eFlagParams != null)
{
eFlagParams.E1 = ptest.E1;
eFlagParams.E2 = ptest.E2;
eFlagParams.E3 = ptest.E3;
eFlagParams.E4 = ptest.E4;
eFlagParams.E5 = ptest.E5;
eFlagParams.E6 = ptest.E6;
eFlagParams.E7 = ptest.E7;
eFlagParams.E8 = ptest.E8;
eFlagParams.E9 = ptest.E9;
eFlagParams.E10 = ptest.E10;
eFlagParams.E11 = ptest.E11;
eFlagParams.E12 = ptest.E12;
eFlagParams.E13 = ptest.E13;
eFlagParams.E14 = ptest.E14;
eFlagParams.E15 = ptest.E15;
eFlagParams.E16 = ptest.E16;
eFlagParams.E21 = ptest.E21;
eFlagParams.Delta_Q_pct = ptest.Delta_Q_pct;
eFlagParams.Delta_T = ptest.Delta_T;
eFlagParams.Delta_Tup_Tdn = ptest.Delta_Tup_Tdn;
eFlagParams.TestTime_min = ptest.TestTime_min;
eFlagParams.TestTime_max = ptest.TestTime_max;
eFlagParams.AmbTemp_min = ptest.AmbTemp_min;
eFlagParams.AmbTemp_max = ptest.AmbTemp_max;
eFlagParams.Pressure_min = ptest.PressLimLo;
eFlagParams.Pressure_max = ptest.PressLimHi;
eFlagParams.Coef_E9 = ptest.Coef_E9;
eFlagParams.Coef_E10 = ptest.Coef_E10;
eFlagParams.Coef_E11 = ptest.Coef_E11;
eFlagParams.Coef_E12 = ptest.Coef_E12;
eFlagParams.Offset_E9 = ptest.Offset_E9;
eFlagParams.Offset_E12 = ptest.Offset_E12;
}
errorFlagsParamsOfCreatedTests.Add(errorFlagsParams);
}
}
newProcedure.AltProcName = dlg.SelectedProfile.Name;
newProcedure.ProcedureState = ProcedureState.Active;
newProcedure.Revision = 1;
newProcedure.PredecessorId = 0;
newProcedure.ObtainedByCopy = false;
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.CreationTime = DateTime.Now;
if (new ProcedureDlg(newProcedure, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
{
/// TODO: Make name uniqueness test
parent.Unlock();
using (var transaction = session.BeginTransaction())
{
try
{
newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName;
newProcedure.LastChgTime = DateTime.Now;
base.AddOne(newProcedure);
session.SaveOrUpdate(newProcedure);
foreach (var efp in errorFlagsParamsOfCreatedTests)
{
efp.UpdateEmbeddedDbEntity();
}
transaction.Commit();
MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name),
Strings.Confirmation,
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception exc)
{
transaction.Rollback();
log.ErrorFormat("Exception when saving Procedure '{0}' : {1}", newProcedure.Name, exc.Message);
}
}
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;

View File

@ -7,6 +7,7 @@ using System.Windows.Forms;
using log4net;
using TBF.Resources;
using TBF.UI.Shared;
using Config.Entities;
namespace TBF.UI.Procedures
{
@ -26,11 +27,22 @@ namespace TBF.UI.Procedures
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
#if TEST_PROFILES
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
SharedButtons.Buttons.Edit | SharedButtons.Buttons.Copy |
SharedButtons.Buttons.Export | SharedButtons.Buttons.Import |
SharedButtons.Buttons.Compare |SharedButtons.Buttons.Custom1;
sharedButtons.Custom1Caption = string.Format("Create from{0}test profiles", Environment.NewLine);
sharedButtons.Custom1Clicked += custom1Button_Click;
#else
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
SharedButtons.Buttons.Edit | SharedButtons.Buttons.Copy |
SharedButtons.Buttons.Export | SharedButtons.Buttons.Import |
SharedButtons.Buttons.Compare;
#endif
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
@ -209,6 +221,11 @@ namespace TBF.UI.Procedures
}
}
private void custom1Button_Click(object sender, EventArgs e)
{
proceduresCtrl.CreateFromProfile();
}
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)

View File

@ -189,11 +189,11 @@ namespace TBF.UI.Procedures
listViewEx.Items.Clear();
for (int i = 0; i < testParamsProviders.Count && i < parent.LoadedProcedure.Tests.Count; i++)
{
DrawOne(testParamsProviders[i], parent.LoadedProcedure.Tests[i].Name);
DrawOne(testParamsProviders[i], parent.LoadedProcedure.Tests[i]);
}
}
void DrawOne(IParamsProvider item, string testName)
void DrawOne(IParamsProvider item, Test test)
{
if (item == null)
{
@ -204,7 +204,7 @@ namespace TBF.UI.Procedures
ListViewItem lvi;
if (showTestsColumn)
{
lvi = new ListViewItem(testName);
lvi = new ListViewItem(test.Name);
lvi.SubItems.Add(item.ToString(0));
}
else
@ -213,7 +213,9 @@ namespace TBF.UI.Procedures
}
for (int i = 1; i < paramsCount; i++) lvi.SubItems.Add(item.ToString(i));
lvi.Tag = item;
/// Setting Tag to 'null' in case of ErrorFlags.TestParams and protected tests prevents editing ListViewEx items
lvi.Tag = (item is TBF.BenchControl.Various.ErrorFlags.TestParams && (test.Profile >= TestProfile.Protected)) ? null : item;
listViewEx.Items.Add(lvi);
}
@ -231,7 +233,7 @@ namespace TBF.UI.Procedures
entity.SetParamsProvider(testParams);
testParamsProviders.Add(testParams);
}
DrawOne(testParams, test.Name);
DrawOne(testParams, test);
}
else
{

View File

@ -0,0 +1,356 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
namespace TBF.UI.Procedures.TestWizard
{
public partial class TestProfileSelection : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(TestProfileSelection));
IList<Profile> profiles;
public Profile SelectedProfile;
public double Qn;
public string MetroClass;
public double QpQiRatio;
public TestProfileSelection(IList<Profile> profiles)
{
this.profiles = profiles;
InitializeComponent();
listView.Columns.Add(Strings.Name, 70);
listView.Columns.Add(Strings.Part, 40);
listView.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_tg), 80);
listView.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), 80);
listView.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), 70);
listView.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80);
listView.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80);
if (profiles != null)
{
foreach (var p in profiles) profileComboBox.Items.Add(p.Name);
}
foreach (var s in new string[] { "10", "25", "50", "100", "250" }) qpQiRatioComboBox.Items.Add(s);
nextButton.Enabled = false;
}
private void TestProfileSelection_Load(object sender, EventArgs e)
{
Localize();
}
void Localize()
{
Text = Strings.Test_profiles_selection;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
}
void RedrawQn(Profile profile)
{
switch (profile.ProfileType)
{
case ProfileType.Q3R:
qnLabel.Text = "Q3";
break;
case ProfileType.QpQi:
qnLabel.Text = "qp";
break;
case ProfileType.QnClassColdWater:
case ProfileType.QnClassHotWater:
case ProfileType.Manual:
default:
qnLabel.Text = "Qn";
break;
}
}
void RedrawMClassCombo(Profile profile)
{
string oriText = metroClassComboBox.Text;
metroClassComboBox.Items.Clear();
bool clearTextFlag = true;
if (profile != null)
{
string[] mClasses;
switch (profile.ProfileType)
{
default:
case ProfileType.Q3R:
mClasses = new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315",
"R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" };
break;
case ProfileType.QnClassColdWater:
mClasses = new string[] { "A", "B", "C" };
break;
case ProfileType.QnClassHotWater:
mClasses = new string[] { "A", "B", "C", "D" };
break;
case ProfileType.QpQi:
mClasses = new string[] { "1", "2", "3" };
break;
}
foreach (var mc in mClasses)
{
metroClassComboBox.Items.Add(mc);
if (oriText == mc) clearTextFlag = false;
}
}
if (clearTextFlag) metroClassComboBox.Text = string.Empty;
}
void RedrawPTests(Profile profile)
{
listView.Items.Clear();
if (profile == null) return;
try
{
foreach (var ptest in profile.Tests)
{
Medium medium = (profile.ProfileType == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
double Qtg;
if (ptest.Name.Contains("Q4") || ptest.Name.Contains("Qmax"))
{
Qtg = Config.Utils.GetQ4Qmax(Qn, MetroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.Contains("Q3") || ptest.Name.Contains("Qn") || ptest.Name.Equals("qp"))
{
Qtg = Qn;
}
else if (ptest.Name.Contains("Q2") || ptest.Name.Contains("Qt"))
{
Qtg = Config.Utils.GetQ2Qt(Qn, MetroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.Contains("Q1") || ptest.Name.Contains("Qmin"))
{
Qtg = Config.Utils.GetQ1Qmin(Qn, MetroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.Contains("0,1qp") || ptest.Name.Contains("0.1qp"))
{
Qtg = 0.1 * Qn;
}
else if (ptest.Name.Contains("qi"))
{
Qtg = Qn / QpQiRatio;
}
else
{
Qtg = Qn; /// Manual flow selection: CoefQfrom and CoefQto are used to calculate Qfrom and Qto from Qn
}
double Qfrom = Qtg * ptest.CoefQfrom;
double Qto = Qtg * ptest.CoefQto;
ListViewItem lvi;
if (profile.ProfileType != ProfileType.QpQi)
{
lvi = new ListViewItem(new string[] { ptest.Name,
(ptest.Part > 0) ? ptest.Part.ToString() : "-",
Qtg.ToString(),
Qfrom.ToString(),
Qto.ToString(),
ptest.ErrLimLo.ToString(),
ptest.ErrLimHi.ToString() });
}
else
{
lvi = new ListViewItem(new string[] { ptest.Name,
(ptest.Part > 0) ? ptest.Part.ToString() : "-",
Qtg.ToString(),
Qfrom.ToString(),
Qto.ToString(),
Strings.calculated,
Strings.calculated });
}
lvi.Tag = ptest;
listView.Items.Add(lvi);
}
}
catch (Exception)
{
MessageBox.Show("Something went wrong");
}
}
private void profileComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
Profile newProfile = null;
foreach (var p in profiles)
{
if (profileComboBox.Text == p.Name)
{
newProfile = p;
break;
}
}
if (SelectedProfile != newProfile)
{
SelectedProfile = newProfile;
qpQiRatioGroupBox.Visible = (SelectedProfile.ProfileType == ProfileType.QpQi);
metroClassGroupBox.Visible = (SelectedProfile.ProfileType != ProfileType.Manual);
profileTypeLabel.Text = (newProfile != null) ? newProfile.ProfileType.ToString() : string.Empty;
profileDescriptionLabel.Text = (newProfile != null) ? newProfile.Description : string.Empty;
RedrawQn(newProfile);
RedrawMClassCombo(newProfile);
if (IsFormValid())
{
RedrawPTests(newProfile);
nextButton.Enabled = true;
}
else
{
RedrawPTests(null);
nextButton.Enabled = false;
}
}
}
private void qnComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsFormValid())
{
RedrawPTests(SelectedProfile);
nextButton.Enabled = true;
}
else
{
RedrawPTests(null);
nextButton.Enabled = false;
}
}
private void metroClassComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsFormValid())
{
RedrawPTests(SelectedProfile);
nextButton.Enabled = true;
}
else
{
RedrawPTests(null);
nextButton.Enabled = false;
}
}
private void qpQiRatioComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsFormValid())
{
RedrawPTests(SelectedProfile);
nextButton.Enabled = true;
}
else
{
RedrawPTests(null);
nextButton.Enabled = false;
}
}
bool IsProfileValid()
{
return profileComboBox.Items.Contains(profileComboBox.Text); /// CB text must be one of the items
}
bool IsQnValid()
{
if (!string.IsNullOrEmpty(qnTextBox.Text) && Utils.TryParseUDouble(qnTextBox.Text, out Qn) && (Qn > 0))
{
return true;
}
else
{
Qn = 0;
return false;
}
}
bool IsMetroClassValid()
{
if (SelectedProfile.ProfileType == ProfileType.Manual)
{
MetroClass = string.Empty;
return true;
}
if (!string.IsNullOrEmpty(metroClassComboBox.Text) &&
(metroClassComboBox.Items.Count == 0 || metroClassComboBox.Items.Contains(metroClassComboBox.Text)))
{
MetroClass = metroClassComboBox.Text;
return true;
}
MetroClass = string.Empty;
return false;
}
bool IsQpQiRatioValid()
{
if (SelectedProfile.ProfileType != ProfileType.QpQi)
{
QpQiRatio = 1.0;
return true;
}
if (!string.IsNullOrEmpty(qpQiRatioComboBox.Text) && qpQiRatioComboBox.Items.Contains(qpQiRatioComboBox.Text))
{
QpQiRatio = double.Parse(qpQiRatioComboBox.Text);
return true;
}
QpQiRatio = 1.0;
return false;
}
bool IsFormValid()
{
return IsProfileValid() && IsQnValid() && IsMetroClassValid() && IsQpQiRatioValid();
}
private void nextButton_Click(object sender, EventArgs e)
{
if (IsFormValid())
{
DialogResult = DialogResult.OK;
Close();
}
else
{
MessageBox.Show("Something's wrong");
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -0,0 +1,292 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Procedures.TestWizard
{
partial class TestProfileSelection
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.horizSplitContainer2 = new System.Windows.Forms.SplitContainer();
this.qpQiRatioGroupBox = new System.Windows.Forms.GroupBox();
this.qpQiRatioComboBox = new System.Windows.Forms.ComboBox();
this.profileGroupBox = new System.Windows.Forms.GroupBox();
this.profileTypeLabel = new System.Windows.Forms.Label();
this.profileDescriptionLabel = new System.Windows.Forms.Label();
this.profileComboBox = new System.Windows.Forms.ComboBox();
this.qnGroupBox = new System.Windows.Forms.GroupBox();
this.qnLabel = new System.Windows.Forms.Label();
this.metroClassGroupBox = new System.Windows.Forms.GroupBox();
this.metroClassComboBox = new System.Windows.Forms.ComboBox();
this.listView = new System.Windows.Forms.ListView();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.qnTextBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
this.horizSplitContainer.Panel1.SuspendLayout();
this.horizSplitContainer.Panel2.SuspendLayout();
this.horizSplitContainer.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).BeginInit();
this.horizSplitContainer2.Panel1.SuspendLayout();
this.horizSplitContainer2.Panel2.SuspendLayout();
this.horizSplitContainer2.SuspendLayout();
this.qpQiRatioGroupBox.SuspendLayout();
this.profileGroupBox.SuspendLayout();
this.qnGroupBox.SuspendLayout();
this.metroClassGroupBox.SuspendLayout();
this.SuspendLayout();
//
// horizSplitContainer
//
this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
this.horizSplitContainer.Name = "horizSplitContainer";
this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.horizSplitContainer2);
//
// horizSplitContainer.Panel2
//
this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
this.horizSplitContainer.Size = new System.Drawing.Size(850, 363);
this.horizSplitContainer.SplitterDistance = 283;
this.horizSplitContainer.TabIndex = 0;
//
// horizSplitContainer2
//
this.horizSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.horizSplitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.horizSplitContainer2.IsSplitterFixed = true;
this.horizSplitContainer2.Location = new System.Drawing.Point(0, 0);
this.horizSplitContainer2.Name = "horizSplitContainer2";
this.horizSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// horizSplitContainer2.Panel1
//
this.horizSplitContainer2.Panel1.Controls.Add(this.qpQiRatioGroupBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.profileGroupBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.qnGroupBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassGroupBox);
//
// horizSplitContainer2.Panel2
//
this.horizSplitContainer2.Panel2.Controls.Add(this.listView);
this.horizSplitContainer2.Size = new System.Drawing.Size(850, 283);
this.horizSplitContainer2.SplitterDistance = 115;
this.horizSplitContainer2.TabIndex = 0;
//
// qpQiRatioGroupBox
//
this.qpQiRatioGroupBox.Controls.Add(this.qpQiRatioComboBox);
this.qpQiRatioGroupBox.Location = new System.Drawing.Point(724, 12);
this.qpQiRatioGroupBox.Name = "qpQiRatioGroupBox";
this.qpQiRatioGroupBox.Size = new System.Drawing.Size(103, 75);
this.qpQiRatioGroupBox.TabIndex = 3;
this.qpQiRatioGroupBox.TabStop = false;
this.qpQiRatioGroupBox.Text = "4. Qp / Qi";
this.qpQiRatioGroupBox.Visible = false;
//
// qpQiRatioComboBox
//
this.qpQiRatioComboBox.FormattingEnabled = true;
this.qpQiRatioComboBox.Location = new System.Drawing.Point(23, 22);
this.qpQiRatioComboBox.Name = "qpQiRatioComboBox";
this.qpQiRatioComboBox.Size = new System.Drawing.Size(55, 21);
this.qpQiRatioComboBox.TabIndex = 0;
this.qpQiRatioComboBox.SelectedIndexChanged += new System.EventHandler(this.qpQiRatioComboBox_SelectedIndexChanged);
//
// profileGroupBox
//
this.profileGroupBox.Controls.Add(this.profileTypeLabel);
this.profileGroupBox.Controls.Add(this.profileDescriptionLabel);
this.profileGroupBox.Controls.Add(this.profileComboBox);
this.profileGroupBox.Location = new System.Drawing.Point(12, 12);
this.profileGroupBox.Name = "profileGroupBox";
this.profileGroupBox.Size = new System.Drawing.Size(386, 75);
this.profileGroupBox.TabIndex = 0;
this.profileGroupBox.TabStop = false;
this.profileGroupBox.Text = "1. Test profile";
//
// profileTypeLabel
//
this.profileTypeLabel.AutoSize = true;
this.profileTypeLabel.Location = new System.Drawing.Point(31, 51);
this.profileTypeLabel.Name = "profileTypeLabel";
this.profileTypeLabel.Size = new System.Drawing.Size(85, 13);
this.profileTypeLabel.TabIndex = 25;
this.profileTypeLabel.Text = "profileTypeLabel";
//
// profileDescriptionLabel
//
this.profileDescriptionLabel.AutoSize = true;
this.profileDescriptionLabel.Location = new System.Drawing.Point(132, 51);
this.profileDescriptionLabel.Name = "profileDescriptionLabel";
this.profileDescriptionLabel.Size = new System.Drawing.Size(114, 13);
this.profileDescriptionLabel.TabIndex = 24;
this.profileDescriptionLabel.Text = "profileDescriptionLabel";
//
// profileComboBox
//
this.profileComboBox.FormattingEnabled = true;
this.profileComboBox.Location = new System.Drawing.Point(32, 22);
this.profileComboBox.Name = "profileComboBox";
this.profileComboBox.Size = new System.Drawing.Size(318, 21);
this.profileComboBox.TabIndex = 0;
this.profileComboBox.SelectedIndexChanged += new System.EventHandler(this.profileComboBox_SelectedIndexChanged);
//
// qnGroupBox
//
this.qnGroupBox.Controls.Add(this.qnTextBox);
this.qnGroupBox.Controls.Add(this.qnLabel);
this.qnGroupBox.Location = new System.Drawing.Point(406, 12);
this.qnGroupBox.Name = "qnGroupBox";
this.qnGroupBox.Size = new System.Drawing.Size(156, 75);
this.qnGroupBox.TabIndex = 1;
this.qnGroupBox.TabStop = false;
this.qnGroupBox.Text = "2. Nominal flow";
//
// qnLabel
//
this.qnLabel.AutoSize = true;
this.qnLabel.Location = new System.Drawing.Point(17, 26);
this.qnLabel.Name = "qnLabel";
this.qnLabel.Size = new System.Drawing.Size(21, 13);
this.qnLabel.TabIndex = 10;
this.qnLabel.Text = "Q3";
//
// metroClassGroupBox
//
this.metroClassGroupBox.Controls.Add(this.metroClassComboBox);
this.metroClassGroupBox.Location = new System.Drawing.Point(571, 12);
this.metroClassGroupBox.Name = "metroClassGroupBox";
this.metroClassGroupBox.Size = new System.Drawing.Size(144, 75);
this.metroClassGroupBox.TabIndex = 2;
this.metroClassGroupBox.TabStop = false;
this.metroClassGroupBox.Text = "3. Metrological class";
//
// metroClassComboBox
//
this.metroClassComboBox.FormattingEnabled = true;
this.metroClassComboBox.Location = new System.Drawing.Point(23, 22);
this.metroClassComboBox.Name = "metroClassComboBox";
this.metroClassComboBox.Size = new System.Drawing.Size(100, 21);
this.metroClassComboBox.TabIndex = 0;
this.metroClassComboBox.SelectedIndexChanged += new System.EventHandler(this.metroClassComboBox_SelectedIndexChanged);
//
// listView
//
this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
this.listView.GridLines = true;
this.listView.Location = new System.Drawing.Point(0, 0);
this.listView.Name = "listView";
this.listView.Size = new System.Drawing.Size(850, 164);
this.listView.TabIndex = 0;
this.listView.UseCompatibleStateImageBehavior = false;
this.listView.View = System.Windows.Forms.View.Details;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.Location = new System.Drawing.Point(752, 17);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// nextButton
//
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.nextButton.Location = new System.Drawing.Point(671, 17);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 0;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
//
// qnTextBox
//
this.qnTextBox.Location = new System.Drawing.Point(50, 22);
this.qnTextBox.Name = "qnTextBox";
this.qnTextBox.Size = new System.Drawing.Size(82, 20);
this.qnTextBox.TabIndex = 11;
//
// TestProfileSelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(850, 363);
this.Controls.Add(this.horizSplitContainer);
this.Name = "TestProfileSelection";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Test profile selection";
this.Load += new System.EventHandler(this.TestProfileSelection_Load);
this.horizSplitContainer.Panel1.ResumeLayout(false);
this.horizSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
this.horizSplitContainer.ResumeLayout(false);
this.horizSplitContainer2.Panel1.ResumeLayout(false);
this.horizSplitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).EndInit();
this.horizSplitContainer2.ResumeLayout(false);
this.qpQiRatioGroupBox.ResumeLayout(false);
this.profileGroupBox.ResumeLayout(false);
this.profileGroupBox.PerformLayout();
this.qnGroupBox.ResumeLayout(false);
this.qnGroupBox.PerformLayout();
this.metroClassGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer horizSplitContainer;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.SplitContainer horizSplitContainer2;
private System.Windows.Forms.Label qnLabel;
private System.Windows.Forms.ComboBox profileComboBox;
private System.Windows.Forms.GroupBox qnGroupBox;
private System.Windows.Forms.GroupBox metroClassGroupBox;
private System.Windows.Forms.GroupBox profileGroupBox;
private System.Windows.Forms.ComboBox metroClassComboBox;
private System.Windows.Forms.ListView listView;
private System.Windows.Forms.Label profileDescriptionLabel;
private System.Windows.Forms.Label profileTypeLabel;
private System.Windows.Forms.GroupBox qpQiRatioGroupBox;
private System.Windows.Forms.ComboBox qpQiRatioComboBox;
private System.Windows.Forms.TextBox qnTextBox;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -609,6 +609,7 @@ namespace TBF.UI.Settings
" PRIMARY KEY (`Id`)," +
" KEY `Component_id` (`Component_id`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;",
"UPDATE `test` SET `RelTransAfter`='UserDefined';",
};
string[] resultsDbCommands = new string[]

View File

@ -202,13 +202,26 @@ namespace TBF.UI.Shared
}
public IList<string> GetUsedNames()
public IList<string> GetUsedNames(bool caseSensitive = true)
{
IList<string> usedNames = new List<string>();
if (MyItems != null)
{
foreach (var item in MyItems) if (item is IHasName) usedNames.Add((item as IHasName).Name);
if (caseSensitive)
{
foreach (var item in MyItems)
{
if (item is IHasName) usedNames.Add((item as IHasName).Name);
}
}
else
{
foreach (var item in MyItems)
{
if (item is IHasName) usedNames.Add((item as IHasName).Name.ToLower());
}
}
}
return usedNames;