15 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:32:30.892965+00:00 | zai-org/GLM-5-FP8 | 1 | a5c9eb9127824fdd |
DTS.Common.Classes Module Documentation
1. Purpose
This module provides core infrastructure components for the DTS application, including dependency injection extensions, UI infrastructure (regions, progress reporting), design patterns (singleton, bulk observable collection), data import structures, service queue management, tag management, and database utility helpers. It serves as a foundational layer used across the application for common operations that don't belong to any specific domain module.
2. Public Interface
UnityExtensions (static class)
Namespace: DTS.Common.Interface
| Method | Signature | Description |
|---|---|---|
TryResolve<T> |
public static T TryResolve<T>(this IUnityContainer container) where T : class |
Extension method that attempts to resolve a type from the Unity container. Returns null if resolution fails (catches all exceptions), rather than throwing. |
StatusAndProgressBarEventArgs
Namespace: DTS.Common.Classes
| Property | Type | Description |
|---|---|---|
StatusColor |
Color |
The color to display for the status. |
StatusText |
string |
The text to display in the status area. |
ProgressValue |
double |
The current progress bar value. |
ProgressBarVisibility |
Visibility |
Controls whether the progress bar is visible. |
Requester |
IBaseViewModel |
Reference to the view model requesting the status update. |
ErrorText |
string |
Error text to display, if any. |
Singleton
Namespace: DTS.Common.Classes
| Member | Signature | Description |
|---|---|---|
Instance (static property) |
public static T Instance { get; } |
Returns the singleton instance of type T. Throws InvalidOperationException if the singleton constructor failed during initialization. |
| Constructor | protected Singleton() |
Protected constructor that throws InvalidOperationException if called when an instance already exists. |
Generic constraint: where T : new()
BulkObservableCollection
Namespace: DTS.Common.Classes
Base class: ObservableCollection<T>
| Method | Signature | Description |
|---|---|---|
AddRange |
public void AddRange(IEnumerable<T> items) |
Adds multiple items to the collection and fires a single Reset notification. Also raises PropertyChanged for Count. Logs exceptions to APILogger.Log. |
RemoveRange |
public void RemoveRange(IEnumerable<T> itemsToRemove) |
Removes multiple items from the collection and fires a single Reset notification. Also raises PropertyChanged for Count. Logs exceptions to APILogger.Log. |
RegionNames (static class)
Namespace: DTS.Common.Classes
Provides constant string identifiers for UI regions. Key constants include:
FrontRegion,MainRegionViewerEuRegion,ViewerMvRegion,ViewerEdcRegion,ViewerTestsRegionViewerGraphRegion,ViewerGraphsRegion,ViewerGraphMainRegion,ViewerGraphListRegion,ViewerGraphChannelRegionViewerTestModificationRegion,ViewerLegendRegion,ViewerSearchRegion,ViewerSettingsRegionViewerDiagRegion,ViewerDisplayRegion,ViewerChartOptionsRegion,ViewerStatsRegion,ViewerCursorRegion,ViewerFiterRegion(note: typo in original)MenuRegion,NavigationRegion,BottomRegion,RightRegion,TopRegionVerticalTabRegion,HorizontalTabRegion,RibbonRegionPropertyDisplayRegion,PropertyModifyRegion,PropertyAddRegionPSDDataSelectRegion,PSDGraphRegionReportChartOptionsRegion,ReportResultsRegion
ImportPageType (enum)
Namespace: DTS.Common.Classes
| Value | Description |
|---|---|
ImportSensor |
Indicates sensor import. |
ImportTestSetup |
Indicates test setup import. |
SensorImportData
Namespace: DTS.Common.Classes
| Property | Type | Default |
|---|---|---|
GroupNameSensorListLookup |
Dictionary<string, List<string>> |
new Dictionary<string, List<string>>() |
SensorGroupNameLookup |
Dictionary<string, string> |
new Dictionary<string, string>() |
SensorGroupTypeLookup |
Dictionary<string, string> |
new Dictionary<string, string>() |
GroupNameTestObjectLookup |
Dictionary<string, string> |
new Dictionary<string, string>() |
Errors |
List<string> |
new List<string>() |
SensorISOCode |
Dictionary<string, string> |
new Dictionary<string, string>() |
SensorISOChannelName |
Dictionary<string, string> |
new Dictionary<string, string>() |
SensorUserCode |
Dictionary<string, string> |
new Dictionary<string, string>() |
SensorUserChannelName |
Dictionary<string, string> |
new Dictionary<string, string>() |
SensorDASSerialNumber |
Dictionary<string, string> |
new Dictionary<string, string>() |
SensorChannelIndex |
Dictionary<string, int> |
new Dictionary<string, int>() |
TestSetupImportData
Namespace: DTS.Common.Classes
| Property | Type | Default |
|---|---|---|
Name |
string |
— |
Description |
string |
— |
SamplesPerSecond |
double |
— |
PosttriggerSeconds |
double |
— |
PretriggerSeconds |
double |
— |
RecordingMode |
RecordingModes |
— |
CalibrationBehavior |
CalibrationBehaviors |
— |
Version |
int |
— |
TestChannelOrders |
List<string> |
— |
Tags |
List<string> |
— |
ClockMasterInput |
InputClockSource |
InputClockSource.None |
ClockMasterOutput |
OutputClockSource |
OutputClockSource.None |
ManageClocksOutsideOfDataPROMaster |
bool |
false |
ManageClocksOutsideOfDataPROSlave |
bool |
false |
ClockSlaveInput |
OutputClockSource |
OutputClockSource.None |
ClockSlaveOutput |
OutputClockSource |
OutputClockSource.None |
SampleRateForDAS |
Dictionary<string, int> |
new Dictionary<string, int>() (readonly) |
DomainIdForDAS |
Dictionary<string, uint> |
new Dictionary<string, uint>() (readonly) |
IsClockMaster |
Dictionary<string, bool> |
new Dictionary<string, bool>() (readonly) |
ServiceCall
Namespace: DTS.Common.Classes
| Member | Signature | Description |
|---|---|---|
Started |
public bool Started { get; set; } |
Indicates whether the service call has started execution. Default: false. |
WorkAction |
public Action WorkAction { get; set; } |
The work delegate to execute. |
Name |
public string Name { get; set; } |
Identifier for the service call. |
| Constructor | public ServiceCall(string name) |
Creates a new service call with the given name. |
MarkDone |
public void MarkDone() |
Marks the service call as finished, allowing the queue to proceed to the next item. |
ServiceQueue (static class)
Namespace: DTS.Common.Classes
| Method | Signature | Description |
|---|---|---|
Enqueue |
public static void Enqueue(ServiceCall call) |
Adds a service call to the queue. If it's the only item, starts execution immediately via Task.Run. |
MarkFinished |
public static void MarkFinished(ServiceCall call) |
Removes a completed call from the queue. If it was the active item, starts the next item. |
TagAwareBase (abstract class)
Namespace: DTS.Common.Classes
Base class: Base.BasePropertyChanged
| Member | Signature | Description |
|---|---|---|
TagType (abstract) |
public abstract TagTypes TagType { get; } |
The type of taggable object. |
TagsBlobBytes |
public byte[] TagsBlobBytes { get; set; } |
Gets/sets tags as a byte array (serialized int array). |
TagIDs |
public int[] TagIDs { get; set; } |
Array of tag IDs. Never null (defaults to empty array). |
SetTagsFromCommaSeparatedString |
public void SetTagsFromCommaSeparatedString(string tagText, Tags.GetSqlCommandDelegate getSqlCommand) |
Parses comma-separated tags and sets them. |
SetTags (virtual) |
public virtual void SetTags(string[] tagsText, Tags.GetSqlCommandDelegate getSqlCommand) |
Sets tags from string array. |
GetTagsAsCommaSeparatedString |
public string GetTagsAsCommaSeparatedString(Tags.GetSqlCommandDelegate getSqlCommand) |
Returns tags as comma-separated string. |
GetTagsArray (virtual) |
public virtual string[] GetTagsArray(Tags.GetSqlCommandDelegate getSqlCommand) |
Returns tags as string array. |
GetTagIDs (virtual) |
public virtual int[] GetTagIDs() |
Returns the TagIDs array. |
RemoveTags (virtual) |
public virtual void RemoveTags(string[] tagsText) |
Intended to remove tags (implementation is empty/stub). |
TagCompatible |
public bool TagCompatible(string tags, Tags.GetSqlCommandDelegate getSqlCommand) |
Checks if any tag in the comma-separated string matches this object's tags. |
TagCompatible (virtual) |
public virtual bool TagCompatible(int[] tags) |
Returns true if tags array is empty or has intersecting tags. |
HasIntersectingTag (virtual) |
public virtual bool HasIntersectingTag(int[] tags) |
Returns true if any tag ID intersects with this object's tags. |
InsertTagsFromCommaSeparatedString |
public void InsertTagsFromCommaSeparatedString(int id, TagTypes tagType, string tags, Tags.GetSqlCommandDelegate getSqlCommand) |
Sets and commits tags in one operation. |
Commit |
public void Commit(int id, TagTypes tagType, Tags.GetSqlCommandDelegate getSqlCommand) |
Commits tag assignments to database via stored procedures. |
GetTagIdList |
public List<int> GetTagIdList(int objectId, TagTypes tagType, Tags.GetSqlCommandDelegate getSqlCommand) |
Retrieves tag IDs for an object from the database. |
Nested enum TagTypes: User, Group, Template, TestSetup, Sensors, SensorModels
Tags
Namespace: DTS.Common.Classes
| Member | Signature | Description |
|---|---|---|
GetTagsInstance (static) |
public static Tags GetTagsInstance(GetSqlCommandDelegate getSqlCommand) |
Returns the singleton instance, creating it if necessary. |
GetSqlCommandDelegate (delegate) |
public delegate SqlCommand GetSqlCommandDelegate(bool bNewConnection) |
Delegate for creating SQL commands. |
AddTag (static) |
public static bool AddTag(string tagText, GetSqlCommandDelegate getSqlCommand) |
Adds a tag if not already cached. Returns false if already exists or text is empty. |
MigrateTag (static) |
public static bool MigrateTag(string tagText, GetSqlCommandDelegate getSqlCommand) |
Commits a tag during database migration. |
AddRange (static) |
public static bool[] AddRange(string[] tagText, GetSqlCommandDelegate getSqlCommand) |
Adds multiple tags. Trims start of each tag text. |
GetIDFromTagText (static) |
public static int GetIDFromTagText(string tagText, GetSqlCommandDelegate getSqlCommand) |
Gets tag ID from database by text. |
GetIDsFromTagText (static) |
public static int[] GetIDsFromTagText(string[] tagText, GetSqlCommandDelegate getSqlCommand) |
Converts array of tag texts to IDs. Filters out invalid IDs. |
GetTagTextFromID (static) |
public static string GetTagTextFromID(int tagID, GetSqlCommandDelegate getSqlCommand) |
Gets tag text from cached lookup by ID. Returns null for invalid IDs. |
GetTagTextFromIDs (static) |
public static string[] GetTagTextFromIDs(int[] tagId, GetSqlCommandDelegate getSqlCommand) |
Converts array of tag IDs to texts. Filters invalid/empty results. |
ContainsTag |
public bool ContainsTag(string text) |
Checks if tag text exists in cached lookup. |
UpdateList |
public void UpdateList(GetSqlCommandDelegate getSqlCommand) |
Refreshes the cached tag dictionary from database. |
Nested class Tag:
| Member | Description |
|---|---|
INVALID_ID (const) |
-1 |
ID |
Tag's database ID. |
Text |
Tag's display text. |
IsObsolete |
Whether tag is obsolete. |
Constructor (string tagText, int tagId) |
Creates a new tag. |
Constructor (Tag copy) |
Copy constructor. |
Constructor (IDataRecord reader) |
Creates tag from data reader. |
Constructor (DataRow dr) |
Creates tag from data row. |
Clone() |
Returns a copy of the tag. |
Utility (sealed static class)
Namespace: DTS.Common.Classes
| Method | Signature | Description |
|---|---|---|
GetBytesFromStringArray |
public static byte[] GetBytesFromStringArray(string[] array, string separator) |
Joins array with separator and returns UTF8 bytes. |
GetAllErrorMessages |
public static string GetAllErrorMessages(Exception ex) |
Returns all exception messages including inner exceptions. Returns empty string if ex is null. |
PingNetwork |
public static bool PingNetwork(string hostNameOrAddress) |
Pings a host with 4-second timeout. Returns false on any exception. |
GetUShort |
public static ushort GetUShort(IDataReader reader, string column, ushort defaultValue = 0) |
Safe reader method for ushort. |
GetUInt |
public static uint GetUInt(IDataReader reader, string column, uint defaultValue = 0) |
Safe reader method for uint. |
GetString |
public static string GetString(IDataReader reader, string column, string defaultValue = "") |
Safe reader method for string. |
GetStringArray |
public static string[] GetStringArray(IDataReader reader, string column, string[] defaultValue, string separator) |
Reads byte array from column, decodes to UTF8, splits by separator. |
GetInt |
public static int GetInt(IDataReader reader, string column, int defaultValue = 0) |
Safe reader method for int. |
GetDouble |
public static double GetDouble(IDataReader reader, string column, double defaultValue = 0D) |
Safe reader method for double. |
GetShort |
public static short GetShort(IDataReader reader, string column, short defaultValue = 0) |
Safe reader method for short. |
GetNullableDateTime |
public static DateTime? GetNullableDateTime(IDataReader reader, string column) |
Returns null for DBNull. |
GetUlong |
public static ulong GetUlong(IDataReader reader, string column, ulong defaultValue = 0) |
Safe reader method for ulong. |
GetNullableInt |
public static int? GetNullableInt(IDataReader reader, string column) |
Returns null for DBNull. |
GetByteArray |
public static byte[] GetByteArray(IDataReader reader, string column) |
Returns empty byte array for DBNull. |
GetBool |
public static bool GetBool(IDataReader reader, string column, bool defaultValue = false) |
Safe reader method for bool. |
| ` |