TBF.Data initialization on TBF start-up (also in case IsRealBench = false), ver. 3.1.1736
This commit is contained in:
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("3.1.1734.0")]
|
[assembly: AssemblyVersion("3.1.1736.0")]
|
||||||
[assembly: AssemblyFileVersion("3.1.1734.0")]
|
[assembly: AssemblyFileVersion("3.1.1736.0")]
|
||||||
|
|||||||
+26
-5
@@ -87,7 +87,7 @@ namespace TBF.UI
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// DB entities of components loaded in the MainWnd constructor
|
/// DB entities of components loaded in the MainWnd constructor
|
||||||
IList<Config.Entities.Component> cmptnEntities;
|
IList<Config.Entities.Component> cmpntEntities;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -136,12 +136,33 @@ namespace TBF.UI
|
|||||||
{
|
{
|
||||||
/// Load the list of components from the database
|
/// Load the list of components from the database
|
||||||
var session = TBF.DB.CreateSession(DBKind.Config);
|
var session = TBF.DB.CreateSession(DBKind.Config);
|
||||||
cmptnEntities = session.QueryOver<Config.Entities.Component>().OrderBy(x => x.ItemNr).Asc.List();
|
cmpntEntities = session.QueryOver<Config.Entities.Component>().OrderBy(x => x.ItemNr).Asc.List();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
MessageBox.Show(Strings.Failed_to_load_components, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
MessageBox.Show(Strings.Failed_to_load_components, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
cmptnEntities = new List<Config.Entities.Component>();
|
cmpntEntities = new List<Config.Entities.Component>();
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set TBF.Data members when there is a BenchInfo or an iPerlBenchInfo component
|
||||||
|
///
|
||||||
|
foreach (var cmpnt in cmpntEntities)
|
||||||
|
{
|
||||||
|
if (cmpnt.ClassName == "DataContainer.BenchInfo")
|
||||||
|
{
|
||||||
|
var cfg = new TBF.Rig.DataContainer.BenchInfo.Factory().CmpntCfgFromCmpntEntity(cmpnt)
|
||||||
|
as TBF.Rig.DataContainer.BenchInfo.ComponentCfg;
|
||||||
|
TBF.Data.SetData(cfg.WaterMetersCount, cfg.CompoundMetersCount, cfg.LinesCount);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (cmpnt.ClassName == "DataContainer.iPerlBenchInfo")
|
||||||
|
{
|
||||||
|
var cfg = new TBF.Rig.DataContainer.iPerlBenchInfo.Factory().CmpntCfgFromCmpntEntity(cmpnt)
|
||||||
|
as TBF.Rig.DataContainer.iPerlBenchInfo.ComponentCfg;
|
||||||
|
TBF.Data.SetData(cfg.WaterMetersCount, cfg.CompoundMetersCount, cfg.LinesCount);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rig.StateMachine.MachineState = TBF.DB.CurrentBench.IsRealBench ? Rig.MachineState.StartingUp : Rig.MachineState.Disabled;
|
Rig.StateMachine.MachineState = TBF.DB.CurrentBench.IsRealBench ? Rig.MachineState.StartingUp : Rig.MachineState.Disabled;
|
||||||
@@ -151,7 +172,7 @@ namespace TBF.UI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
/// Initialize the control board, etc.
|
/// Initialize the control board, etc.
|
||||||
Rig.StateMachine.InitializeBoardEtc(cmptnEntities);
|
Rig.StateMachine.InitializeBoardEtc(cmpntEntities);
|
||||||
|
|
||||||
/// Check remote and local configuration DB compatibility
|
/// Check remote and local configuration DB compatibility
|
||||||
string msg;
|
string msg;
|
||||||
@@ -362,7 +383,7 @@ namespace TBF.UI
|
|||||||
string[] edgesLcfg = null;
|
string[] edgesLcfg = null;
|
||||||
string[] edgesXLcfg = null;
|
string[] edgesXLcfg = null;
|
||||||
///
|
///
|
||||||
var schDrawingCmpnts = TBF.DB.CurrentBench.IsRealBench ? Rig.StateMachine.Components : TBF.Rig.TbfComponents.LoadComponentsFromDB(cmptnEntities);
|
var schDrawingCmpnts = TBF.DB.CurrentBench.IsRealBench ? Rig.StateMachine.Components : TBF.Rig.TbfComponents.LoadComponentsFromDB(cmpntEntities);
|
||||||
foreach (var component in schDrawingCmpnts)
|
foreach (var component in schDrawingCmpnts)
|
||||||
{
|
{
|
||||||
TBF.Rig.Generic.IComponentCfg cmpCfg = component.Cfg;
|
TBF.Rig.Generic.IComponentCfg cmpCfg = component.Cfg;
|
||||||
|
|||||||
Reference in New Issue
Block a user