63 lines
2.2 KiB
C#
63 lines
2.2 KiB
C#
using System;
|
|
using System.Windows;
|
|
|
|
namespace DatabaseImport
|
|
{
|
|
public class TestObjectTemplateCollection //: BasePropertyChanged
|
|
{
|
|
private static volatile TestObjectTemplateCollection _testObjectCollection;
|
|
public static TestObjectTemplateCollection TemplateCollection
|
|
{
|
|
get
|
|
{
|
|
if (null == _testObjectCollection)
|
|
{
|
|
_testObjectCollection = new TestObjectTemplateCollection();
|
|
}
|
|
return _testObjectCollection;
|
|
}
|
|
}
|
|
|
|
public void ReloadAll(bool loadSubComponents)
|
|
{
|
|
//UnloadAll();
|
|
//if (loadSubComponents)
|
|
//{
|
|
// (App.Current as App).IsoDb.RefreshAllData();
|
|
// DataModel.CustomChannelList.List.ReloadAll();
|
|
//}
|
|
//Reload();
|
|
}
|
|
private static volatile TestObjectTemplate _sysBuiltTestObjectTemplate;
|
|
public TestObjectTemplate SysBuiltTestObjectTemplate => _sysBuiltTestObjectTemplate;
|
|
|
|
public TestObjectTemplate GetTemplate(string templateId)
|
|
{
|
|
var db = ((App)Application.Current).IsoDb;
|
|
var isoTemplate = ISO.TestObjectTemplate.GetTemplate(ref db, templateId);
|
|
return null != isoTemplate ? new TestObjectTemplate(isoTemplate, ref db) : null;
|
|
}
|
|
/// <summary>
|
|
/// deletes all test objects
|
|
/// originally created so TDM imports could clear all tables
|
|
/// </summary>
|
|
public static void DeleteAll()
|
|
{
|
|
//if (TemplateCollection._bUnloaded) { Reload(); }
|
|
_testObjectCollection.DeleteAllTemplates();
|
|
_testObjectCollection = new TestObjectTemplateCollection();
|
|
TemplateCollection.DeleteAllTemplates();
|
|
//TemplateCollection._templates.Clear();
|
|
}
|
|
private void DeleteAllTemplates()
|
|
{
|
|
try
|
|
{
|
|
//if (_bUnloaded) { Reload(); }
|
|
ISO.TestObjectTemplate.DeleteAllTemplates();
|
|
}
|
|
catch (Exception) { /*APILogger.Log("failed to delete all templates"); */}
|
|
}
|
|
}
|
|
}
|