Early loading of the 1st component implementing IBenchInfo to ProcessData.BenchInfo.
This commit is contained in:
+48
-13
@@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -11,6 +11,7 @@ using Config.Entities;
|
|||||||
using Users;
|
using Users;
|
||||||
using Users.Entities;
|
using Users.Entities;
|
||||||
using TBF.Resources;
|
using TBF.Resources;
|
||||||
|
using TBF.Rig.Sequences;
|
||||||
using TBF.UI.Shared;
|
using TBF.UI.Shared;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@ namespace TBF
|
|||||||
public const string LocalSettingsBackupName = "config.backup.xml";
|
public const string LocalSettingsBackupName = "config.backup.xml";
|
||||||
|
|
||||||
public static System.Globalization.CultureInfo AltCulture;
|
public static System.Globalization.CultureInfo AltCulture;
|
||||||
|
|
||||||
|
static IList<Procedure> listOfProcedures;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selected procedure data
|
/// Selected procedure data
|
||||||
@@ -52,12 +55,12 @@ namespace TBF
|
|||||||
/// of procedure data and uses them for the test. Changes of 'SelectedProcedure'
|
/// of procedure data and uses them for the test. Changes of 'SelectedProcedure'
|
||||||
/// done during the test do not have any influence on the currently running test.
|
/// done during the test do not have any influence on the currently running test.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Config.Entities.Procedure SelectedProcedure = null;
|
public static Procedure SelectedProcedure = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Main window object.
|
/// Main window object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UI.MainWnd MainWnd;
|
public static TBF.UI.MainWnd MainWnd;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -360,12 +363,44 @@ namespace TBF
|
|||||||
///
|
///
|
||||||
/// Connect to Config database.
|
/// Connect to Config database.
|
||||||
/// This triggers an exception in case user is a power user and there is no Config database.
|
/// This triggers an exception in case user is a power user and there is no Config database.
|
||||||
///
|
///
|
||||||
IList<Procedure> listOfProcedures = TBF.DB.CreateSession(Common.DBKind.Config)
|
ISession session = TBF.DB.CreateSession(DBKind.Config);
|
||||||
.QueryOver<Procedure>()
|
|
||||||
.Where(x => (x.ProcedureState == Common.ProcedureState.Active))
|
if (!string.IsNullOrEmpty(LocalSettings.LastProcedureName))
|
||||||
.And(x => (x.Name == LocalSettings.LastProcedureName))
|
{
|
||||||
.List();
|
listOfProcedures = session.QueryOver<Procedure>()
|
||||||
|
.Where(x => (x.ProcedureState == ProcedureState.Active))
|
||||||
|
.And(x => (x.Name == LocalSettings.LastProcedureName))
|
||||||
|
.List();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Search for 'BenchInfo' component
|
||||||
|
var components = session.QueryOver<Config.Entities.Component>()
|
||||||
|
.Where(x => x.ClassName == "BenchInfoEx")
|
||||||
|
.List();
|
||||||
|
if (components.Count > 0)
|
||||||
|
{
|
||||||
|
var factory = new TBF.Rig.DataContainers.BenchInfo.Extended.ComponentFactory();
|
||||||
|
var cfg = factory.CmpntCfgFromCmpntEntity(components[0])
|
||||||
|
as TBF.Rig.DataContainers.BenchInfo.Extended.ComponentCfg;
|
||||||
|
ProcessData.BenchInfo = new TBF.Rig.DataContainers.BenchInfo.Extended.Component(cfg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/// Search for 'iPerlBenchInfo' component
|
||||||
|
components = session.QueryOver<Config.Entities.Component>()
|
||||||
|
.Where(x => x.ClassName == "BenchInfo.iPerl")
|
||||||
|
.List();
|
||||||
|
if (components.Count > 0)
|
||||||
|
{
|
||||||
|
var factory = new TBF.Rig.DataContainers.BenchInfo.iPerl.ComponentFactory();
|
||||||
|
var cfg = factory.CmpntCfgFromCmpntEntity(components[0])
|
||||||
|
as TBF.Rig.DataContainers.BenchInfo.iPerl.ComponentCfg;
|
||||||
|
ProcessData.BenchInfo = new TBF.Rig.DataContainers.BenchInfo.iPerl.Component(cfg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Close();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Connect to Results database and determine the last saved batch number.
|
/// Connect to Results database and determine the last saved batch number.
|
||||||
@@ -448,10 +483,10 @@ namespace TBF
|
|||||||
if (LocalSettings.LastProcedureName != null)
|
if (LocalSettings.LastProcedureName != null)
|
||||||
{
|
{
|
||||||
IList<Procedure> listOfProcedures = TBF.DB.CreateSession(Common.DBKind.Config)
|
IList<Procedure> listOfProcedures = TBF.DB.CreateSession(Common.DBKind.Config)
|
||||||
.QueryOver<Procedure>()
|
.QueryOver<Procedure>()
|
||||||
.Where(x => (x.ProcedureState == Common.ProcedureState.Active))
|
.Where(x => (x.ProcedureState == Common.ProcedureState.Active))
|
||||||
.And(x => (x.Name == LocalSettings.LastProcedureName))
|
.And(x => (x.Name == LocalSettings.LastProcedureName))
|
||||||
.List();
|
.List();
|
||||||
|
|
||||||
if (listOfProcedures.Count == 1)
|
if (listOfProcedures.Count == 1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user