(1) TestMethods.Dummy component, (2) Three custom shared buttons, (3) ProcedureDlg and Procedures.TestWizard modified.

This commit is contained in:
Milan Hanajik
2019-10-09 14:00:08 +02:00
parent 8e046046cd
commit 317e0f16cb
18 changed files with 1639 additions and 29 deletions
+1
View File
@@ -56,6 +56,7 @@ namespace TBF.BenchControl
Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory()); Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory());
Factories.Add(new TestMethods.Counter.Factory()); Factories.Add(new TestMethods.Counter.Factory());
Factories.Add(new TestMethods.DiverterTest.Factory()); Factories.Add(new TestMethods.DiverterTest.Factory());
Factories.Add(new TestMethods.Dummy.Factory());
Factories.Add(new TestMethods.Endurance.Factory()); Factories.Add(new TestMethods.Endurance.Factory());
Factories.Add(new TestMethods.FixedStart.Single.Factory()); Factories.Add(new TestMethods.FixedStart.Single.Factory());
Factories.Add(new TestMethods.FixedStart.Compound.Factory()); Factories.Add(new TestMethods.FixedStart.Compound.Factory());
@@ -0,0 +1,64 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.Dummy
{
public class DummySeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(DummySeq));
/// <summary>
/// Adjustment method sequence
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// Event.Done . . . . . . . OK
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode)
{
IList<Event> e = new List<Event>(); /// Events from currently running operations
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
///
/// Show a dialog with OK button and an appropriate message
///
Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnActivity(this, test.Method);
State.Create(string.Format("{0}({1}) : Dummy", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.BenchWaitingOp)
.AddOperation(new Operations.MessageBoxOp(string.Format("Dummy test {0}", test.Name)))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
if (e.Contains(Event.Error)) goto stopTest;
if (TestAndLogUiCmdStop(test, e)) goto stopTest;
}
while (!e.Contains(Event.OK));
return new List<Event> { Event.Done };
stopTest:
return new List<Event> { Event.UiCmdStop };
}
}
}
@@ -0,0 +1,30 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.Dummy
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponent DummyComponent() { return new TestMethod(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TestMethod(cfg); }
public IComponentCfg DefaultConfig()
{
return new TestMethodCfg(this.GetType().Namespace.Substring(29), this);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,35 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
namespace TBF.BenchControl.TestMethods.Dummy
{
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
public override string ToString() { return string.Format("TestMethods.ChangeFlowDirection({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
public TestMethod()
{
}
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Debug(this.ToString());
}
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new DummySeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
}
}
}
+18
View File
@@ -1338,6 +1338,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Do you want to update &apos;Use wizard&apos; tests ?.
/// </summary>
internal static string Do_you_want_to_update_tests_QM {
get {
return ResourceManager.GetString("Do_you_want_to_update_tests_QM", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Down. /// Looks up a localized string similar to Down.
/// </summary> /// </summary>
@@ -5553,6 +5562,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Update.
/// </summary>
internal static string Update {
get {
return ResourceManager.GetString("Update", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Use {0}. /// Looks up a localized string similar to Use {0}.
/// </summary> /// </summary>
+6
View File
@@ -1488,4 +1488,10 @@
<data name="Program_must_be_closed" xml:space="preserve"> <data name="Program_must_be_closed" xml:space="preserve">
<value>Program musí být uzavřen.</value> <value>Program musí být uzavřen.</value>
</data> </data>
<data name="Do_you_want_to_update_tests_QM" xml:space="preserve">
<value>Chcete modifikovat 'Use wizard' testy ?</value>
</data>
<data name="Update" xml:space="preserve">
<value>Modifikovat</value>
</data>
</root> </root>
+6
View File
@@ -2062,4 +2062,10 @@
<data name="No_info_available" xml:space="preserve"> <data name="No_info_available" xml:space="preserve">
<value>No info available</value> <value>No info available</value>
</data> </data>
<data name="Do_you_want_to_update_tests_QM" xml:space="preserve">
<value>Do you want to update 'Use wizard' tests ?</value>
</data>
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
</root> </root>
+21
View File
@@ -1120,6 +1120,9 @@
<Compile Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.designer.cs"> <Compile Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon> <DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="BenchControl\TestMethods\Dummy\DummySeq.cs" />
<Compile Include="BenchControl\TestMethods\Dummy\Factory.cs" />
<Compile Include="BenchControl\TestMethods\Dummy\TestMethod.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\Component.cs" /> <Compile Include="BenchControl\TestMethods\Endurance\Component.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\CycleStep.cs" /> <Compile Include="BenchControl\TestMethods\Endurance\CycleStep.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" /> <Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" />
@@ -2164,6 +2167,12 @@
<Compile Include="UI\Procedures\TestParamsCtrl.designer.cs"> <Compile Include="UI\Procedures\TestParamsCtrl.designer.cs">
<DependentUpon>TestParamsCtrl.cs</DependentUpon> <DependentUpon>TestParamsCtrl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\Procedures\TestWizard\ConfirmUpdatingTests.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\ConfirmUpdatingTests.Designer.cs">
<DependentUpon>ConfirmUpdatingTests.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\FlowSelection.cs"> <Compile Include="UI\Procedures\TestWizard\FlowSelection.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -2182,6 +2191,12 @@
<Compile Include="UI\Procedures\TestWizard\MethodSelection.designer.cs"> <Compile Include="UI\Procedures\TestWizard\MethodSelection.designer.cs">
<DependentUpon>MethodSelection.cs</DependentUpon> <DependentUpon>MethodSelection.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\Procedures\TestWizard\OracleWZTypSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\OracleWZTypSelection.designer.cs">
<DependentUpon>OracleWZTypSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\PressureSelection.cs"> <Compile Include="UI\Procedures\TestWizard\PressureSelection.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -3103,6 +3118,9 @@
<EmbeddedResource Include="UI\Procedures\TestParamsCtrl.resx"> <EmbeddedResource Include="UI\Procedures\TestParamsCtrl.resx">
<DependentUpon>TestParamsCtrl.cs</DependentUpon> <DependentUpon>TestParamsCtrl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\ConfirmUpdatingTests.resx">
<DependentUpon>ConfirmUpdatingTests.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\FlowSelection.resx"> <EmbeddedResource Include="UI\Procedures\TestWizard\FlowSelection.resx">
<DependentUpon>FlowSelection.cs</DependentUpon> <DependentUpon>FlowSelection.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@@ -3112,6 +3130,9 @@
<EmbeddedResource Include="UI\Procedures\TestWizard\MethodSelection.resx"> <EmbeddedResource Include="UI\Procedures\TestWizard\MethodSelection.resx">
<DependentUpon>MethodSelection.cs</DependentUpon> <DependentUpon>MethodSelection.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\OracleWZTypSelection.resx">
<DependentUpon>OracleWZTypSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\PressureSelection.resx"> <EmbeddedResource Include="UI\Procedures\TestWizard\PressureSelection.resx">
<DependentUpon>PressureSelection.cs</DependentUpon> <DependentUpon>PressureSelection.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
+228 -23
View File
@@ -13,6 +13,8 @@ using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices; using TBF.BenchControl.GenericDevices;
using TBF.Resources; using TBF.Resources;
using TBF.UI.Shared; using TBF.UI.Shared;
using TBF.BenchControl.Output;
using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.UI.Procedures namespace TBF.UI.Procedures
{ {
@@ -63,15 +65,23 @@ namespace TBF.UI.Procedures
InitializeComponent(); InitializeComponent();
/// SharedDlgButtons configuration /// SharedDlgButtons configuration
#if KEMPNO_50 #if KEMPNO_50 || KRAKOW_50
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority }; sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority };
#else #else
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
#endif #endif
#if TURA_SPECIAL || TURA_IPERL || TURA_IPERL_NEW
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove | sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down; SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |SharedButtons.Buttons.Custom1;
sharedButtons.Unlocked += Unlocked; sharedButtons.Custom1Caption = string.Format("Načítaj testy{0}iPerl z Oracle", Environment.NewLine);
sharedButtons.Custom1Clicked += iPerlWizardButton_Click;
#else
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
#endif
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click; sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click; sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.AddClicked += addButton_Click; sharedButtons.AddClicked += addButton_Click;
@@ -108,17 +118,19 @@ namespace TBF.UI.Procedures
this.usedNames = usedNames; this.usedNames = usedNames;
this.openUnlocked = openUnlocked; this.openUnlocked = openUnlocked;
#if KEMPNO_50 #if KEMPNO_50 || KRAKOW_50
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority } sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority }
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority }; : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority };
#else #else
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists } sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists }
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
#endif #endif
/// Prepare a list of components and a list of all valves in the test bench
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
{ {
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session); ///
/// Prepare a list of components and a list of all valves in the test bench
///
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session);
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents); Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);
RegulValves = new List<IRegulValve>(); RegulValves = new List<IRegulValve>();
TestMethods = new List<ITestMethod>(); TestMethods = new List<ITestMethod>();
@@ -129,6 +141,7 @@ namespace TBF.UI.Procedures
fileWriter2ComboBox.Items.Add("---"); fileWriter2ComboBox.Items.Add("---");
fileWriter3ComboBox.Items.Add("---"); fileWriter3ComboBox.Items.Add("---");
fileWriter4ComboBox.Items.Add("---"); fileWriter4ComboBox.Items.Add("---");
foreach (var cmpnt in TbfComponents) foreach (var cmpnt in TbfComponents)
{ {
if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve); if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve);
@@ -147,12 +160,11 @@ namespace TBF.UI.Procedures
fileWriter4ComboBox.Items.Add(cmpnt.Cfg.Name); fileWriter4ComboBox.Items.Add(cmpnt.Cfg.Name);
} }
} }
}
/// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call ///
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) /// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call
{ ///
feedingPaths = session.QueryOver<FeedingPath>().List(); feedingPaths = session.QueryOver<FeedingPath>().List();
benchPaths = session.QueryOver<BenchPath>().List(); benchPaths = session.QueryOver<BenchPath>().List();
outputPaths = session.QueryOver<OutputPath>().List(); outputPaths = session.QueryOver<OutputPath>().List();
metersPaths = session.QueryOver<MetersPath>().List(); metersPaths = session.QueryOver<MetersPath>().List();
@@ -316,11 +328,11 @@ namespace TBF.UI.Procedures
LoadUISettings(); LoadUISettings();
/// Enable/disable/show/hide controls in General tab /// Enable/disable/show/hide controls in General tab
#if IPERL #if KEMPNO_50 || KRAKOW_50
altProcNameLabel.Visible = true; altProcNameLabel.Visible = true;
altProcNameTextBox.Visible = true; altProcNameTextBox.Visible = true;
altProcPeriodLabel.Visible = true; //altProcPeriodLabel.Visible = true;
altProcPeriodTextBox.Visible = true; //altProcPeriodTextBox.Visible = true;
#endif #endif
procNameTextBox.Enabled = false; procNameTextBox.Enabled = false;
descriptionTextBox.Enabled = false; descriptionTextBox.Enabled = false;
@@ -404,6 +416,7 @@ namespace TBF.UI.Procedures
label15.Text = Strings.Date; label15.Text = Strings.Date;
label18.Text = Strings.Notes; label18.Text = Strings.Notes;
watermetersLabel.Text = Strings.Meter_types_tested; watermetersLabel.Text = Strings.Meter_types_tested;
altProcNameLabel.Text = Strings.Conditions;
protectedCheckBox.Text = Strings.Protected_procedure; protectedCheckBox.Text = Strings.Protected_procedure;
mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed; mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed;
manualControlDisabledCheckBox.Text = Strings.Manual_control_disabled; manualControlDisabledCheckBox.Text = Strings.Manual_control_disabled;
@@ -1951,15 +1964,13 @@ namespace TBF.UI.Procedures
private void addButton_Click(object sender, EventArgs e) private void addButton_Click(object sender, EventArgs e)
{ {
ListViewEx listViewEx; ListViewEx listViewEx;
switch (selectedTab) switch (selectedTab)
{ {
case ProcedureTabs.Metrology1: listViewEx = metrology1ListViewEx; break; case ProcedureTabs.Metrology1: listViewEx = metrology1ListViewEx; break;
case ProcedureTabs.Metrology2: listViewEx = metrology2ListViewEx; break; case ProcedureTabs.Metrology2: listViewEx = metrology2ListViewEx; break;
case ProcedureTabs.Process: listViewEx = processListViewEx; break; case ProcedureTabs.Process: listViewEx = processListViewEx; break;
case ProcedureTabs.Parameters: listViewEx = parametersListViewEx; break; case ProcedureTabs.Parameters: listViewEx = parametersListViewEx; break;
default: return;
default: return;
} }
/// Find an unused test name /// Find an unused test name
@@ -2115,10 +2126,13 @@ namespace TBF.UI.Procedures
AddToParametersTab(test); AddToParametersTab(test);
foreach (var ctrl in testParamsCtrls) ctrl.AddOne(test); foreach (var ctrl in testParamsCtrls) ctrl.AddOne(test);
listViewEx.Focus(); if (listViewEx != null)
listViewEx.SelectedItems.Clear(); {
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true; listViewEx.Focus();
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible(); listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
} }
private void removeButton_Click(object sender, EventArgs e) private void removeButton_Click(object sender, EventArgs e)
@@ -2380,5 +2394,196 @@ namespace TBF.UI.Procedures
} }
} }
} }
/// <summary>
/// Queries an Oracle database and loads ... array/list
/// </summary>
private void iPerlWizardButton_Click(object sender, EventArgs e)
{
ListViewEx listViewEx = null;
switch (selectedTab)
{
case ProcedureTabs.General:
UpdateFromGeneralTab();
break;
case ProcedureTabs.History:
UpdateFromHistoryTab();
break;
case ProcedureTabs.Metrology1:
listViewEx = metrology1ListViewEx;
UpdateFromMetrology1Tab();
break;
case ProcedureTabs.Metrology2:
listViewEx = metrology2ListViewEx;
UpdateFromMetrology2Tab();
break;
case ProcedureTabs.Process:
listViewEx = processListViewEx;
UpdateFromProcessTab();
break;
case ProcedureTabs.Parameters:
listViewEx = parametersListViewEx;
UpdateFromParametersTab();
break;
default:
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));
break;
}
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
{
IList<Test> testsToBeUpdated = new List<Test>();
foreach (var test in LoadedProcedure.Tests)
{
foreach (var tetsMethod in TestMethods)
{
if (tetsMethod.Name == test.Method && tetsMethod.ClassName == "TestMethods.Dummy")
{
testsToBeUpdated.Add(test);
break;
}
}
}
if (testsToBeUpdated.Count == 0)
{
MessageBox.Show("There are no tests to be updated");
return;
}
/// Run a wizard
TestWizard.OracleWZTypSelection oracleDlg = new TestWizard.OracleWZTypSelection(LoadedProcedure, TestMethods);
TestWizard.ConfirmUpdatingTests confirmationDlg = new TestWizard.ConfirmUpdatingTests(LoadedProcedure, TestMethods);
Form[] forms = new Form[] { oracleDlg, confirmationDlg };
int step = 0; /// 1st step
while ((step >= 0) && (step < forms.Length))
{
switch (forms[step].ShowDialog())
{
case DialogResult.OK:
/// Next
step++;
break;
case DialogResult.Retry:
/// Back
step--;
break;
case DialogResult.Cancel:
default:
return;
}
}
if (step == forms.Length)
{
///
/// Update tests
///
foreach (var ti in oracleDlg.SelectedTestInfos)
{
foreach (var test in testsToBeUpdated)
{
if (ti.TestName == test.Name)
{
///
/// Update this test with information obtained from Oracle
///
double qfrom, qto;
switch (ti.Range)
{
case Range.R90_100:
qfrom = 0.9 * ti.Flow;
qto = ti.Flow;
break;
case Range.R95_105:
qfrom = 0.95 * ti.Flow;
qto = 1.05 * ti.Flow;
break;
case Range.R100_110:
qfrom = ti.Flow;
qto = 1.1 * ti.Flow;
break;
default:
qfrom = qto = ti.Flow;
break;
}
double volume = ti.TestTime * (qfrom + qto) / 7.2;
test.Qfrom = (float)qfrom;
test.Qto = (float)qto;
test.TstTime = (float)ti.TestTime;
test.Volume = (float)volume;
test.ErrLimLo = (float)(ti.ErrLimLoFromDB - ti.Uncertainty);
test.ErrLimHi = (float)(ti.ErrLimHiFromDB + ti.Uncertainty);
test.Uncertainty = (float)ti.Uncertainty;
test.Method = ti.TestMethod;
}
}
}
///
/// Update iPerls and water meters
///
foreach (var ppCtrl in procedureParamsCtrls)
{
foreach (var pp in ppCtrl.CmpntsParams)
{
var ihpp = pp as TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead.ProcParams;
if (ihpp != null)
{
ihpp.WMType_ID = oracleDlg.WMTypeId;
ihpp.MeterType = oracleDlg.MeterType;
}
var wmpp = pp as TBF.BenchControl.WaterMeters.WaterMeter.ProcParams;
if (wmpp != null)
{
wmpp.MetrologicalClass = oracleDlg.MetrolKlasse;
wmpp.ApprovalInfo = oracleDlg.Zulasszeichen;
wmpp.Qn = (float)oracleDlg.Q3;
switch (oracleDlg.MeterType)
{
case MeterType.DN15: wmpp.DN = 15.0F; break;
case MeterType.DN20: wmpp.DN = 20.0F; break;
case MeterType.DN25: wmpp.DN = 25.0F; break;
case MeterType.DN26: wmpp.DN = 25.0F; break;
case MeterType.DN32: wmpp.DN = 32.0F; break;
case MeterType.DN40: wmpp.DN = 40.0F; break;
default:
case MeterType.AutoDetect: wmpp.DN = 0; break;
}
}
}
}
RefreshMetrology12AndProcessTabs();
RefreshOtherTabs();
if (listViewEx != null)
{
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
}
}
}
} }
} }
+5 -4
View File
@@ -25,7 +25,8 @@ namespace TBF.UI.Procedures
bool showSensorsColumn; bool showSensorsColumn;
int nrFixedColumns; int nrFixedColumns;
IList<IComponent> selectedCmpnts; IList<IComponent> selectedCmpnts;
IList<IParamsProvider> cmpntsParams;
public IList<IParamsProvider> CmpntsParams;
int paramsCount; int paramsCount;
Control[] editors; Control[] editors;
@@ -35,7 +36,7 @@ namespace TBF.UI.Procedures
public ProcedureParamsCtrl() public ProcedureParamsCtrl()
{ {
InitializeComponent(); InitializeComponent();
cmpntsParams = new List<IParamsProvider>(); CmpntsParams = new List<IParamsProvider>();
} }
public ProcedureParamsCtrl(ProcedureDlg parent, IList<IComponent> selectedCmpnts, bool showSensorsColumn) public ProcedureParamsCtrl(ProcedureDlg parent, IList<IComponent> selectedCmpnts, bool showSensorsColumn)
@@ -81,7 +82,7 @@ namespace TBF.UI.Procedures
} }
} }
cmpntsParams.Add(procedureParams); CmpntsParams.Add(procedureParams);
} }
if (sampleToCreateHeader != null) if (sampleToCreateHeader != null)
@@ -176,7 +177,7 @@ namespace TBF.UI.Procedures
public void RedrawAll() public void RedrawAll()
{ {
listViewEx.Items.Clear(); listViewEx.Items.Clear();
foreach (var item in cmpntsParams) DrawOne(item); foreach (var item in CmpntsParams) DrawOne(item);
} }
void DrawOne(IParamsProvider item) void DrawOne(IParamsProvider item)
@@ -0,0 +1,103 @@
namespace TBF.UI.Procedures.TestWizard
{
partial class ConfirmUpdatingTests
{
/// <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.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
this.messageLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(185, 77);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 30;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// nextButton
//
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.nextButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.nextButton.Location = new System.Drawing.Point(104, 77);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 29;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
//
// backButton
//
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.backButton.Location = new System.Drawing.Point(23, 77);
this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 28;
this.backButton.Text = "< &Back";
this.backButton.UseVisualStyleBackColor = true;
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Location = new System.Drawing.Point(20, 33);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(208, 13);
this.messageLabel.TabIndex = 31;
this.messageLabel.Text = "Do you want to update \'Use wizard\' tests ?";
//
// ConfirmUpdatingTests
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 136);
this.Controls.Add(this.messageLabel);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.nextButton);
this.Controls.Add(this.backButton);
this.Name = "ConfirmUpdatingTests";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Confirmation";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.Button backButton;
private System.Windows.Forms.Label messageLabel;
}
}
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
namespace TBF.UI.Procedures.TestWizard
{
public partial class ConfirmUpdatingTests : Form
{
Procedure loadedProcedure;
IList<ITestMethod> testMethods;
public ConfirmUpdatingTests(Procedure loadedProcedure, IList<ITestMethod> testMethods)
{
this.loadedProcedure = loadedProcedure;
this.testMethods = testMethods;
InitializeComponent();
Text = Strings.Confirmation;
messageLabel.Text = Strings.Do_you_want_to_update_tests_QM;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.Update;
cancelButton.Text = Strings.CancelBtnText;
}
}
}
@@ -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>
@@ -0,0 +1,433 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Procedures.TestWizard
{
partial class OracleWZTypSelection
{
/// <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.meterTypeComboBox = new System.Windows.Forms.ComboBox();
this.dnLabel = new System.Windows.Forms.Label();
this.q3TextBox = new System.Windows.Forms.TextBox();
this.q3Label = new System.Windows.Forms.Label();
this.approvalTextBox = new System.Windows.Forms.TextBox();
this.approvalLabel = new System.Windows.Forms.Label();
this.metroClassTextBox = new System.Windows.Forms.TextBox();
this.metroClassLabel = new System.Windows.Forms.Label();
this.testInfoNameLabel = new System.Windows.Forms.Label();
this.timeStampTextBox = new System.Windows.Forms.TextBox();
this.timeStampLabel = new System.Windows.Forms.Label();
this.remarkTextBox = new System.Windows.Forms.TextBox();
this.remarkLabel = new System.Windows.Forms.Label();
this.wzTypTextBox = new System.Windows.Forms.TextBox();
this.wzTypLabel = new System.Windows.Forms.Label();
this.revWZTypLabel = new System.Windows.Forms.Label();
this.revWZTypTextBox = new System.Windows.Forms.TextBox();
this.searchButton = new System.Windows.Forms.Button();
this.materialCodeTextBox = new System.Windows.Forms.TextBox();
this.idWZTypTextBox = new System.Windows.Forms.TextBox();
this.materialCodeRadioButton = new System.Windows.Forms.RadioButton();
this.idWZTypRadioButton = new System.Windows.Forms.RadioButton();
this.listViewEx = new TracingDB.Forms.ListViewEx();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
((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.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.Panel2.Controls.Add(this.backButton);
this.horizSplitContainer.Size = new System.Drawing.Size(820, 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.meterTypeComboBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.dnLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.q3TextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.q3Label);
this.horizSplitContainer2.Panel1.Controls.Add(this.approvalTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.approvalLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.testInfoNameLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.timeStampTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.timeStampLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.remarkTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.remarkLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.wzTypTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.wzTypLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.revWZTypLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.revWZTypTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.searchButton);
this.horizSplitContainer2.Panel1.Controls.Add(this.materialCodeTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.idWZTypTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.materialCodeRadioButton);
this.horizSplitContainer2.Panel1.Controls.Add(this.idWZTypRadioButton);
//
// horizSplitContainer2.Panel2
//
this.horizSplitContainer2.Panel2.Controls.Add(this.listViewEx);
this.horizSplitContainer2.Size = new System.Drawing.Size(820, 283);
this.horizSplitContainer2.SplitterDistance = 115;
this.horizSplitContainer2.TabIndex = 0;
//
// meterTypeComboBox
//
this.meterTypeComboBox.FormattingEnabled = true;
this.meterTypeComboBox.Location = new System.Drawing.Point(73, 85);
this.meterTypeComboBox.Name = "meterTypeComboBox";
this.meterTypeComboBox.Size = new System.Drawing.Size(65, 21);
this.meterTypeComboBox.TabIndex = 17;
//
// dnLabel
//
this.dnLabel.AutoSize = true;
this.dnLabel.Location = new System.Drawing.Point(31, 88);
this.dnLabel.Name = "dnLabel";
this.dnLabel.Size = new System.Drawing.Size(23, 13);
this.dnLabel.TabIndex = 16;
this.dnLabel.Text = "DN";
//
// q3TextBox
//
this.q3TextBox.Location = new System.Drawing.Point(103, 61);
this.q3TextBox.Name = "q3TextBox";
this.q3TextBox.Size = new System.Drawing.Size(35, 20);
this.q3TextBox.TabIndex = 11;
this.q3TextBox.TextChanged += new System.EventHandler(this.q3TextBox_TextChanged);
//
// q3Label
//
this.q3Label.AutoSize = true;
this.q3Label.Location = new System.Drawing.Point(31, 64);
this.q3Label.Name = "q3Label";
this.q3Label.Size = new System.Drawing.Size(46, 13);
this.q3Label.TabIndex = 10;
this.q3Label.Text = "Q3 / Qn";
//
// approvalTextBox
//
this.approvalTextBox.Location = new System.Drawing.Point(220, 61);
this.approvalTextBox.Name = "approvalTextBox";
this.approvalTextBox.Size = new System.Drawing.Size(275, 20);
this.approvalTextBox.TabIndex = 13;
this.approvalTextBox.TextChanged += new System.EventHandler(this.approvalTextBox_TextChanged);
//
// approvalLabel
//
this.approvalLabel.AutoSize = true;
this.approvalLabel.Location = new System.Drawing.Point(150, 64);
this.approvalLabel.Name = "approvalLabel";
this.approvalLabel.Size = new System.Drawing.Size(49, 13);
this.approvalLabel.TabIndex = 12;
this.approvalLabel.Text = "Approval";
//
// metroClassTextBox
//
this.metroClassTextBox.Location = new System.Drawing.Point(596, 37);
this.metroClassTextBox.Name = "metroClassTextBox";
this.metroClassTextBox.Size = new System.Drawing.Size(104, 20);
this.metroClassTextBox.TabIndex = 9;
this.metroClassTextBox.TextChanged += new System.EventHandler(this.metroClassTextBox_TextChanged);
//
// metroClassLabel
//
this.metroClassLabel.AutoSize = true;
this.metroClassLabel.Location = new System.Drawing.Point(517, 40);
this.metroClassLabel.Name = "metroClassLabel";
this.metroClassLabel.Size = new System.Drawing.Size(78, 13);
this.metroClassLabel.TabIndex = 8;
this.metroClassLabel.Text = "Metrolog. class";
//
// testInfoNameLabel
//
this.testInfoNameLabel.AutoSize = true;
this.testInfoNameLabel.Location = new System.Drawing.Point(595, 88);
this.testInfoNameLabel.Name = "testInfoNameLabel";
this.testInfoNameLabel.Size = new System.Drawing.Size(0, 13);
this.testInfoNameLabel.TabIndex = 20;
//
// timeStampTextBox
//
this.timeStampTextBox.Enabled = false;
this.timeStampTextBox.Location = new System.Drawing.Point(596, 61);
this.timeStampTextBox.Name = "timeStampTextBox";
this.timeStampTextBox.Size = new System.Drawing.Size(104, 20);
this.timeStampTextBox.TabIndex = 15;
//
// timeStampLabel
//
this.timeStampLabel.AutoSize = true;
this.timeStampLabel.Location = new System.Drawing.Point(517, 64);
this.timeStampLabel.Name = "timeStampLabel";
this.timeStampLabel.Size = new System.Drawing.Size(73, 13);
this.timeStampLabel.TabIndex = 14;
this.timeStampLabel.Text = "Date and time";
//
// remarkTextBox
//
this.remarkTextBox.Enabled = false;
this.remarkTextBox.Location = new System.Drawing.Point(220, 85);
this.remarkTextBox.Name = "remarkTextBox";
this.remarkTextBox.Size = new System.Drawing.Size(346, 20);
this.remarkTextBox.TabIndex = 19;
//
// remarkLabel
//
this.remarkLabel.AutoSize = true;
this.remarkLabel.Location = new System.Drawing.Point(150, 88);
this.remarkLabel.Name = "remarkLabel";
this.remarkLabel.Size = new System.Drawing.Size(44, 13);
this.remarkLabel.TabIndex = 18;
this.remarkLabel.Text = "Remark";
//
// wzTypTextBox
//
this.wzTypTextBox.Enabled = false;
this.wzTypTextBox.Location = new System.Drawing.Point(220, 37);
this.wzTypTextBox.Name = "wzTypTextBox";
this.wzTypTextBox.Size = new System.Drawing.Size(275, 20);
this.wzTypTextBox.TabIndex = 7;
//
// wzTypLabel
//
this.wzTypLabel.AutoSize = true;
this.wzTypLabel.Location = new System.Drawing.Point(150, 40);
this.wzTypLabel.Name = "wzTypLabel";
this.wzTypLabel.Size = new System.Drawing.Size(65, 13);
this.wzTypLabel.TabIndex = 6;
this.wzTypLabel.Text = "Water meter";
//
// revWZTypLabel
//
this.revWZTypLabel.AutoSize = true;
this.revWZTypLabel.Location = new System.Drawing.Point(31, 40);
this.revWZTypLabel.Name = "revWZTypLabel";
this.revWZTypLabel.Size = new System.Drawing.Size(66, 13);
this.revWZTypLabel.TabIndex = 4;
this.revWZTypLabel.Text = "Rev WZTyp";
//
// revWZTypTextBox
//
this.revWZTypTextBox.Enabled = false;
this.revWZTypTextBox.Location = new System.Drawing.Point(103, 37);
this.revWZTypTextBox.Name = "revWZTypTextBox";
this.revWZTypTextBox.Size = new System.Drawing.Size(35, 20);
this.revWZTypTextBox.TabIndex = 5;
//
// searchButton
//
this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.searchButton.Location = new System.Drawing.Point(722, 17);
this.searchButton.Name = "searchButton";
this.searchButton.Size = new System.Drawing.Size(75, 42);
this.searchButton.TabIndex = 21;
this.searchButton.Text = "Search";
this.searchButton.UseVisualStyleBackColor = true;
this.searchButton.Click += new System.EventHandler(this.searchButton_Click);
//
// materialCodeTextBox
//
this.materialCodeTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.materialCodeTextBox.Location = new System.Drawing.Point(220, 13);
this.materialCodeTextBox.Name = "materialCodeTextBox";
this.materialCodeTextBox.Size = new System.Drawing.Size(480, 20);
this.materialCodeTextBox.TabIndex = 3;
this.materialCodeTextBox.TextChanged += new System.EventHandler(this.productCodeTextBox_TextChanged);
//
// idWZTypTextBox
//
this.idWZTypTextBox.Location = new System.Drawing.Point(103, 13);
this.idWZTypTextBox.Name = "idWZTypTextBox";
this.idWZTypTextBox.Size = new System.Drawing.Size(35, 20);
this.idWZTypTextBox.TabIndex = 1;
this.idWZTypTextBox.TextChanged += new System.EventHandler(this.wzTypTextBox_TextChanged);
//
// materialCodeRadioButton
//
this.materialCodeRadioButton.AutoSize = true;
this.materialCodeRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.materialCodeRadioButton.Location = new System.Drawing.Point(153, 14);
this.materialCodeRadioButton.Name = "materialCodeRadioButton";
this.materialCodeRadioButton.Size = new System.Drawing.Size(62, 17);
this.materialCodeRadioButton.TabIndex = 2;
this.materialCodeRadioButton.TabStop = true;
this.materialCodeRadioButton.Text = "Material";
this.materialCodeRadioButton.UseVisualStyleBackColor = true;
//
// idWZTypRadioButton
//
this.idWZTypRadioButton.AutoSize = true;
this.idWZTypRadioButton.Location = new System.Drawing.Point(15, 14);
this.idWZTypRadioButton.Name = "idWZTypRadioButton";
this.idWZTypRadioButton.Size = new System.Drawing.Size(75, 17);
this.idWZTypRadioButton.TabIndex = 0;
this.idWZTypRadioButton.TabStop = true;
this.idWZTypRadioButton.Text = "ID WZTyp";
this.idWZTypRadioButton.UseVisualStyleBackColor = true;
this.idWZTypRadioButton.CheckedChanged += new System.EventHandler(this.idWZTypRadioButton_CheckedChanged);
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(820, 164);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SubItemClicked += new TracingDB.Forms.SubItemEventHandler(this.listViewEx_SubItemClicked);
this.listViewEx.SubItemEndEditing += new TracingDB.Forms.SubItemEndEditingEventHandler(this.listViewEx_SubItemEndEditing);
//
// 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(722, 17);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 27;
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(641, 17);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 26;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
//
// backButton
//
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.backButton.Location = new System.Drawing.Point(560, 17);
this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 25;
this.backButton.Text = "< &Back";
this.backButton.UseVisualStyleBackColor = true;
this.backButton.Click += new System.EventHandler(this.backButton_Click);
//
// OracleWZTypSelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(820, 363);
this.Controls.Add(this.horizSplitContainer);
this.Name = "OracleWZTypSelection";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Výber typu vodomera (WZTyp alebo 25-miestny kód)";
this.Load += new System.EventHandler(this.OracleWZTypSelection_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.Panel1.PerformLayout();
this.horizSplitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).EndInit();
this.horizSplitContainer2.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.Button backButton;
private System.Windows.Forms.SplitContainer horizSplitContainer2;
private System.Windows.Forms.TextBox materialCodeTextBox;
private System.Windows.Forms.TextBox idWZTypTextBox;
private System.Windows.Forms.RadioButton materialCodeRadioButton;
private System.Windows.Forms.RadioButton idWZTypRadioButton;
private System.Windows.Forms.Button searchButton;
private TracingDB.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label remarkLabel;
private System.Windows.Forms.TextBox wzTypTextBox;
private System.Windows.Forms.Label wzTypLabel;
private System.Windows.Forms.Label revWZTypLabel;
private System.Windows.Forms.TextBox revWZTypTextBox;
private System.Windows.Forms.TextBox remarkTextBox;
private System.Windows.Forms.TextBox timeStampTextBox;
private System.Windows.Forms.Label timeStampLabel;
private System.Windows.Forms.Label testInfoNameLabel;
private System.Windows.Forms.TextBox metroClassTextBox;
private System.Windows.Forms.Label metroClassLabel;
private System.Windows.Forms.TextBox q3TextBox;
private System.Windows.Forms.Label q3Label;
private System.Windows.Forms.TextBox approvalTextBox;
private System.Windows.Forms.Label approvalLabel;
private System.Windows.Forms.ComboBox meterTypeComboBox;
private System.Windows.Forms.Label dnLabel;
}
}
@@ -0,0 +1,362 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using log4net;
using Oracle.DataAccess.Client;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Output;
using TBF.BenchControl.Output.DB.SensusOracle;
using TBF.Resources;
using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.UI.Procedures.TestWizard
{
public partial class OracleWZTypSelection : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(OracleWZTypSelection));
public IList<SensusTestInfo> SelectedTestInfos;
public int WMTypeId;
public string MetrolKlasse;
public string Zulasszeichen;
public double Q3;
public MeterType MeterType;
Procedure loadedProcedure;
IList<ITestMethod> testMethods;
TextBox uncertaintyTB;
ComboBox testMethodCB;
public OracleWZTypSelection(Procedure loadedProcedure, IList<ITestMethod> testMethods)
{
this.loadedProcedure = loadedProcedure;
this.testMethods = testMethods;
InitializeComponent();
Text = Strings.Method_selection;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
for (MeterType mt = 0; mt < MeterType.Count; mt++)
{
meterTypeComboBox.Items.Add(mt.ToString());
}
meterTypeComboBox.Text = MeterType.AutoDetect.ToString();
listViewEx.Columns.Add("ID", 30);
listViewEx.Columns.Add("Test name", 70);
listViewEx.Columns.Add("QBezeichnung", 85);
listViewEx.Columns.Add(Strings.Q_from_m3h, 80);
listViewEx.Columns.Add(Strings.Q_to_m3h, 70);
listViewEx.Columns.Add(Strings.Test_time_s_chdr, 70);
listViewEx.Columns.Add(string.Format("{0} [l]", Strings.Volume, 60));
listViewEx.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80);
listViewEx.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80);
listViewEx.Columns.Add(Strings.Uncertainty_pct_chdr, 85);
listViewEx.Columns.Add(Strings.Test_method, 200);
uncertaintyTB = new TextBox();
Controls.Add(uncertaintyTB);
testMethodCB = new ComboBox();
if (testMethods != null)
{
foreach (var tm in testMethods) testMethodCB.Items.Add(tm.Name);
}
Controls.Add(testMethodCB);
backButton.Visible = false;
nextButton.Enabled = false;
SelectedTestInfos = null;
}
private void OracleWZTypSelection_Load(object sender, EventArgs e)
{
}
bool IsFormValidForSearch()
{
if (idWZTypRadioButton.Checked)
{
int idummy;
return (int.TryParse(idWZTypTextBox.Text, out idummy) && (idummy > 0));
}
else
{
return (materialCodeTextBox.Text.Length == 25);
}
}
bool IsFormValid()
{
double dummy;
return IsFormValidForSearch() &&
(listViewEx.Items.Count > 0) &&
Utils.TryParseUDouble(q3TextBox.Text, out dummy) &&
!string.IsNullOrEmpty(metroClassTextBox.Text) &&
!string.IsNullOrEmpty(approvalTextBox.Text) &&
meterTypeComboBox.Items.Contains(meterTypeComboBox.Text);
}
private void idWZTypRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (idWZTypRadioButton.Checked)
{
idWZTypTextBox.Enabled = true;
materialCodeTextBox.Enabled = false;
}
else
{
idWZTypTextBox.Enabled = false;
materialCodeTextBox.Enabled = true;
}
searchButton.Enabled = IsFormValidForSearch();
nextButton.Enabled = false;
}
private void wzTypTextBox_TextChanged(object sender, EventArgs e)
{
searchButton.Enabled = IsFormValidForSearch();
nextButton.Enabled = false;
}
private void productCodeTextBox_TextChanged(object sender, EventArgs e)
{
searchButton.Enabled = IsFormValidForSearch();
nextButton.Enabled = false;
}
private void backButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Retry;
Close();
}
private void nextButton_Click(object sender, EventArgs e)
{
MetrolKlasse = metroClassTextBox.Text;
Zulasszeichen = approvalTextBox.Text;
Q3 = Utils.ParseUDouble(q3TextBox.Text);
for (MeterType mt = 0; mt < MeterType.Count; mt++)
{
if (meterTypeComboBox.Text == mt.ToString())
{
MeterType = mt;
break;
}
}
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void searchButton_Click(object sender, EventArgs e)
{
if (!IsFormValidForSearch())
{
MessageBox.Show("Invalid data");
nextButton.Enabled = false;
return;
}
bool found = ReadTestInfosFromOracle();
if (!found)
{
MessageBox.Show("No water meter specification found in Oracle");
}
nextButton.Enabled = IsFormValid();
}
bool ReadTestInfosFromOracle()
{
IList<string> wmTestNames = new List<string>();
StringBuilder procedureSignatureSB = new StringBuilder();
foreach (var t in loadedProcedure.Tests)
{
if (t.Publish != (byte)Config.Entities.Publish.Never)
{
wmTestNames.Add(global::Results.Utils.GetTestName(t.Name, 1, 1));
}
}
try
{
WMTypeId = int.Parse(idWZTypTextBox.Text);
int wmTypeRevision;
string wzTypStr;
string materialNr;
DateTime timeStamp;
string remark;
string testInfoName;
OracleConnection conn = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
conn.Open();
SelectedTestInfos = Database.GetOracleTestInfo(conn, WMTypeId, out wmTypeRevision, out wzTypStr, out MetrolKlasse, out Zulasszeichen, out materialNr, out Q3, out timeStamp, out remark);
conn.Close();
SensusTestInfo[] completeTestInfos = SensusTestInfo.GetBestMatch(SelectedTestInfos, wmTestNames, out testInfoName);
foreach (var sti in SelectedTestInfos)
{
foreach (var cti in completeTestInfos) if (cti.PruefungsNrDB == sti.PruefungsNrDB) sti.TestName = cti.TestName;
}
materialCodeTextBox.Text = materialNr;
revWZTypTextBox.Text = wmTypeRevision.ToString();
wzTypTextBox.Text = wzTypStr;
metroClassTextBox.Text = MetrolKlasse;
approvalTextBox.Text = Zulasszeichen;
q3TextBox.Text = Q3.ToString();
remarkTextBox.Text = remark;
timeStampTextBox.Text = timeStamp.ToString("dd.MM.yyyy HH:mm");
testInfoNameLabel.Text = testInfoName;
listViewEx.Items.Clear();
foreach (var ti in SelectedTestInfos)
{
double Qfrom, Qto;
switch (ti.Range)
{
case Range.R90_100:
Qfrom = 0.9 * ti.Flow;
Qto = ti.Flow;
break;
case Range.R95_105:
Qfrom = 0.95 * ti.Flow;
Qto = 1.05 * ti.Flow;
break;
case Range.R100_110:
Qfrom = ti.Flow;
Qto = 1.1 * ti.Flow;
break;
default:
Qfrom = Qto = ti.Flow;
break;
}
double volumeLtr = ti.TestTime * (Qfrom + Qto) / 7.2;
ListViewItem lvi = new ListViewItem(new string[] { ti.PruefungsNrDB.ToString(),
(string.IsNullOrEmpty(ti.TestName) ? string.Empty : ti.TestName),
ti.QBezeichnungDB,
Qfrom.ToString(),
Qto.ToString(),
ti.TestTime.ToString(),
volumeLtr.ToString(Config.Utils.SignificantDigitsToFmt(volumeLtr, 4)),
(ti.ErrLimLoFromDB - ti.Uncertainty).ToString(),
(ti.ErrLimHiFromDB + ti.Uncertainty).ToString(),
ti.Uncertainty.ToString(),
ti.TestMethod,
});
lvi.Tag = ti;
listViewEx.Items.Add(lvi);
}
return true;
}
catch (Exception)
{
revWZTypTextBox.Text = string.Empty;
wzTypTextBox.Text = "No info found";
metroClassTextBox.Text = string.Empty;
approvalTextBox.Text = string.Empty;
q3TextBox.Text = string.Empty;
remarkTextBox.Text = string.Empty;
timeStampTextBox.Text = string.Empty;
testInfoNameLabel.Text = string.Empty;
return false;
}
}
private void listViewEx_SubItemClicked(object sender, TracingDB.Forms.SubItemEventArgs e)
{
if (e.SubItem == listViewEx.Columns.Count - 2)
{
/// Uncertainty column clicked (column before the last one)
listViewEx.StartEditing(uncertaintyTB, e.Item, e.SubItem);
}
else if (e.SubItem == listViewEx.Columns.Count - 1)
{
/// Test method column clicked (the last column)
listViewEx.StartEditing(testMethodCB, e.Item, e.SubItem);
}
}
private void listViewEx_SubItemEndEditing(object sender, TracingDB.Forms.SubItemEndEditingEventArgs e)
{
if (e.SubItem == listViewEx.Columns.Count - 2)
{
double uncertainty;
if (Utils.TryParseUDouble(e.DisplayText, out uncertainty))
{
/// Uncertainty OK
SensusTestInfo ti = e.Item.Tag as SensusTestInfo;
if (ti != null) ti.Uncertainty = uncertainty;
e.Item.SubItems[listViewEx.Columns.Count - 4].Text = (ti.ErrLimLoFromDB - ti.Uncertainty).ToString();
e.Item.SubItems[listViewEx.Columns.Count - 3].Text = (ti.ErrLimHiFromDB + ti.Uncertainty).ToString();
}
else
{
/// Uncertainty NOK -> revert changes
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
else if (e.SubItem == listViewEx.Columns.Count - 1)
{
if (testMethodCB.Items.Contains(e.DisplayText))
{
/// TestMethod OK
SensusTestInfo ti = e.Item.Tag as SensusTestInfo;
if (ti != null) ti.TestMethod = e.DisplayText;
}
else
{
/// TestMethod NOK -> revert changes
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
}
private void q3TextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
private void metroClassTextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
private void approvalTextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
}
}
@@ -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>
+43 -1
View File
@@ -47,6 +47,9 @@ namespace TBF.UI.Shared
this.exportButton = new System.Windows.Forms.Button(); this.exportButton = new System.Windows.Forms.Button();
this.importButton = new System.Windows.Forms.Button(); this.importButton = new System.Windows.Forms.Button();
this.compareButton = new System.Windows.Forms.Button(); this.compareButton = new System.Windows.Forms.Button();
this.customButton1 = new System.Windows.Forms.Button();
this.customButton2 = new System.Windows.Forms.Button();
this.customButton3 = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// removeButton // removeButton
@@ -225,10 +228,46 @@ namespace TBF.UI.Shared
this.compareButton.UseVisualStyleBackColor = true; this.compareButton.UseVisualStyleBackColor = true;
this.compareButton.Click += new System.EventHandler(this.compareButton_Click); this.compareButton.Click += new System.EventHandler(this.compareButton_Click);
// //
// customButton1
//
this.customButton1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.customButton1.Location = new System.Drawing.Point(10, 755);
this.customButton1.Name = "customButton1";
this.customButton1.Size = new System.Drawing.Size(80, 40);
this.customButton1.TabIndex = 16;
this.customButton1.Text = "Custom 1";
this.customButton1.UseVisualStyleBackColor = true;
this.customButton1.Click += new System.EventHandler(this.customButton1_Click);
//
// customButton2
//
this.customButton2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.customButton2.Location = new System.Drawing.Point(10, 798);
this.customButton2.Name = "customButton2";
this.customButton2.Size = new System.Drawing.Size(80, 40);
this.customButton2.TabIndex = 17;
this.customButton2.Text = "Custom 2";
this.customButton2.UseVisualStyleBackColor = true;
this.customButton2.Click += new System.EventHandler(this.customButton2_Click);
//
// customButton3
//
this.customButton3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.customButton3.Location = new System.Drawing.Point(10, 841);
this.customButton3.Name = "customButton3";
this.customButton3.Size = new System.Drawing.Size(80, 40);
this.customButton3.TabIndex = 18;
this.customButton3.Text = "Custom 3";
this.customButton3.UseVisualStyleBackColor = true;
this.customButton3.Click += new System.EventHandler(this.customButton3_Click);
//
// SharedButtons // SharedButtons
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.customButton3);
this.Controls.Add(this.customButton2);
this.Controls.Add(this.customButton1);
this.Controls.Add(this.compareButton); this.Controls.Add(this.compareButton);
this.Controls.Add(this.importButton); this.Controls.Add(this.importButton);
this.Controls.Add(this.exportButton); this.Controls.Add(this.exportButton);
@@ -246,7 +285,7 @@ namespace TBF.UI.Shared
this.Controls.Add(this.cancelButton); this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton); this.Controls.Add(this.okButton);
this.Name = "SharedButtons"; this.Name = "SharedButtons";
this.Size = new System.Drawing.Size(100, 805); this.Size = new System.Drawing.Size(100, 908);
this.Load += new System.EventHandler(this.SharedDlgButtons_Load); this.Load += new System.EventHandler(this.SharedDlgButtons_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -270,5 +309,8 @@ namespace TBF.UI.Shared
private System.Windows.Forms.Button exportButton; private System.Windows.Forms.Button exportButton;
private System.Windows.Forms.Button importButton; private System.Windows.Forms.Button importButton;
private System.Windows.Forms.Button compareButton; private System.Windows.Forms.Button compareButton;
private System.Windows.Forms.Button customButton1;
private System.Windows.Forms.Button customButton2;
private System.Windows.Forms.Button customButton3;
} }
} }
+15 -1
View File
@@ -30,6 +30,9 @@ namespace TBF.UI.Shared
RenameTab = (1 << 10), /// optional RenameTab = (1 << 10), /// optional
RemoveTab = (1 << 11), /// optional RemoveTab = (1 << 11), /// optional
More = (1 << 12), /// optional More = (1 << 12), /// optional
Custom1 = (1 << 13), /// optional
Custom2 = (1 << 14), /// optional
Custom3 = (1 << 15), /// optional
} }
readonly System.Windows.Forms.Button[] buttonCtrls; readonly System.Windows.Forms.Button[] buttonCtrls;
@@ -40,6 +43,10 @@ namespace TBF.UI.Shared
/// </summary> /// </summary>
public Buttons OptionalButtons; public Buttons OptionalButtons;
public string Custom1Caption { set { customButton1.Text = value; } }
public string Custom2Caption { set { customButton2.Text = value; } }
public string Custom3Caption { set { customButton3.Text = value; } }
public enum LockState public enum LockState
{ {
Locked, /// 'Unlock', 'Close' (=OK) are shown, all the othere are hidden Locked, /// 'Unlock', 'Close' (=OK) are shown, all the othere are hidden
@@ -84,6 +91,7 @@ namespace TBF.UI.Shared
addButton, removeButton, upButton, downButton, editButton, copyButton, addButton, removeButton, upButton, downButton, editButton, copyButton,
exportButton, importButton, compareButton, exportButton, importButton, compareButton,
newTabButton, renameTabButton, removeTabButton, moreButton, newTabButton, renameTabButton, removeTabButton, moreButton,
customButton1, customButton2, customButton3,
}; };
OptionalButtons = Buttons.None; OptionalButtons = Buttons.None;
buttonsRepositionsed = false; buttonsRepositionsed = false;
@@ -208,10 +216,13 @@ namespace TBF.UI.Shared
public event EventHandler NewTabClicked; public event EventHandler NewTabClicked;
public event EventHandler RenameTabClicked; public event EventHandler RenameTabClicked;
public event EventHandler RemoveTabClicked; public event EventHandler RemoveTabClicked;
public event EventHandler MoreClicked;
public event EventHandler ExportClicked; public event EventHandler ExportClicked;
public event EventHandler ImportClicked; public event EventHandler ImportClicked;
public event EventHandler CompareClicked; public event EventHandler CompareClicked;
public event EventHandler MoreClicked;
public event EventHandler Custom1Clicked;
public event EventHandler Custom2Clicked;
public event EventHandler Custom3Clicked;
/// <summary> /// <summary>
/// 'Unlock' button handler /// 'Unlock' button handler
@@ -288,5 +299,8 @@ namespace TBF.UI.Shared
private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); } private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); }
private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); } private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); }
private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); } private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); }
private void customButton1_Click(object s, EventArgs e) { if (Custom1Clicked != null) Custom1Clicked(s, e); }
private void customButton2_Click(object s, EventArgs e) { if (Custom2Clicked != null) Custom2Clicked(s, e); }
private void customButton3_Click(object s, EventArgs e) { if (Custom3Clicked != null) Custom3Clicked(s, e); }
} }
} }