init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<UserControl x:Class="DTS.Common.Controls.RoundedBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Grid>
|
||||
<Grid Margin="-6,-5,-12,-13">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="27"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="27"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image Height="20" Width="20" Source="../Images/shadow_tl.png" Stretch="Fill"/>
|
||||
<Image Height="20" Grid.Row="0" Grid.Column="1" Source="../Images/shadow_t.png" Stretch="Fill"/>
|
||||
<Image Height="20" Width="27" Grid.Row="0" Grid.Column="2" Source="../Images/shadow_tr.png" Stretch="Fill"/>
|
||||
<Image Width="27" Grid.Column="2" Grid.Row="1" Source="../Images/shadow_r.png" Stretch="Fill"/>
|
||||
<Image Width="20" Grid.Row="1" Grid.Column="0" Source="../Images/shadow_l.png" Stretch="Fill"/>
|
||||
<Image Height="27" Grid.Column="1" Grid.Row="2" Source="../Images/shadow_b.png" Stretch="Fill" />
|
||||
<Image Height="27" Width="20" Grid.Row="2" Grid.Column="0" Source="../Images/shadow_bl.png" Stretch="Fill"/>
|
||||
<Image Height="27" Width="27" Grid.Column="2" Grid.Row="2" Source="../Images/shadow_br.png" Stretch="Fill"/>
|
||||
</Grid>
|
||||
<Border Background="#99FFFFFF" Opacity="0.8" CornerRadius="12,12,12,12" VerticalAlignment="Stretch" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,518 @@
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DTS.Common.Classes.Sensors
|
||||
{
|
||||
public class CalibrationRecords : ICalibrationRecords
|
||||
{
|
||||
public ICalibrationRecord[] Records { get; set; } = new CalibrationRecord[] { new CalibrationRecord() };
|
||||
|
||||
public CalibrationRecords(ICalibrationRecords copy)
|
||||
{
|
||||
var records = new CalibrationRecord[copy.Records.Length];
|
||||
for (var i = 0; i < copy.Records.Length; i++)
|
||||
{
|
||||
records[i] = new CalibrationRecord(copy.Records[i]);
|
||||
}
|
||||
|
||||
Records = records;
|
||||
}
|
||||
|
||||
public CalibrationRecords()
|
||||
{
|
||||
Records = new CalibrationRecord[] { new CalibrationRecord() };
|
||||
}
|
||||
|
||||
public CalibrationRecords(string records)
|
||||
{
|
||||
FromSerializedString(records);
|
||||
}
|
||||
|
||||
public bool IsEqual(object obj, ISensorCalibration sc)
|
||||
{
|
||||
if (obj is CalibrationRecords r)
|
||||
{
|
||||
if (r.Records.Length != Records.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < r.Records.Length; i++)
|
||||
{
|
||||
if (!r.Records[i].IsEqual(Records[i], sc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public void FromSerializedString(string s)
|
||||
{
|
||||
var tokens = s.Split(new string[] { MySeparator }, StringSplitOptions.None);
|
||||
for (var i = 0; i < tokens.Length; i++)
|
||||
{
|
||||
tokens[i] = tokens[i].Replace(MySeparatorBackup, MySeparator);
|
||||
}
|
||||
|
||||
var records = new List<CalibrationRecord>();
|
||||
foreach (string token in tokens)
|
||||
{
|
||||
records.Add(new CalibrationRecord(token));
|
||||
}
|
||||
|
||||
Records = records.ToArray();
|
||||
}
|
||||
|
||||
private const string MySeparator = "__x__";
|
||||
private const string MySeparatorBackup = "___xx___";
|
||||
|
||||
public string ToSerializedString(ISensorCalDbRecord sc)
|
||||
{
|
||||
var records = new List<string>();
|
||||
|
||||
foreach (var r in Records)
|
||||
{
|
||||
records.Add(r.ToSerializedString(sc));
|
||||
}
|
||||
|
||||
for (var i = 0; i < records.Count; i++)
|
||||
{
|
||||
System.Diagnostics.Trace.Assert(!records[i].Contains(MySeparatorBackup));
|
||||
records[i] = records[i].Replace(MySeparator, MySeparatorBackup);
|
||||
}
|
||||
|
||||
return string.Join(MySeparator, records.ToArray());
|
||||
}
|
||||
|
||||
public string ToDisplayString(ISensorCalibration sc, ISensorCalibration previous, string linearFormat, string nonlinearFormat)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
for (var i = 0; i < Records.Length; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
var r = Records[i];
|
||||
ICalibrationRecord r2 = null;
|
||||
|
||||
if (null != previous)
|
||||
{
|
||||
if (i < previous.Records.Records.Length)
|
||||
{
|
||||
r2 = previous.Records.Records[i];
|
||||
}
|
||||
}
|
||||
|
||||
var s = r.ToDisplayString(sc, r2, previous, linearFormat, nonlinearFormat);
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
sb.Append(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class CalibrationRecord : ICalibrationRecord
|
||||
{
|
||||
public double Sensitivity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ZeroPoint is used to hold the calibration certificate field for 2D/3D IR-TRACC cal certs
|
||||
/// it is used to zero the IR-TRACC and POT data prior to being fed into the 3D equations
|
||||
/// </summary>
|
||||
private double _zeroPoint = 0D;
|
||||
|
||||
public double ZeroPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
if (false == Equals(Poly.CalibrationFactor, 0.0))
|
||||
{
|
||||
// This field is always calculated. Do not return stored value unless we are unable to calculate
|
||||
return Poly.ZeroPositionIntercept / Poly.CalibrationFactor;
|
||||
}
|
||||
|
||||
return _zeroPoint;
|
||||
}
|
||||
set => _zeroPoint = value;
|
||||
}
|
||||
|
||||
public LinearizationFormula Poly { get; set; }
|
||||
|
||||
public bool AtCapacity { get; set; } = false;
|
||||
|
||||
public string EngineeringUnits { get; set; } = "g";
|
||||
|
||||
public SensorConstants.SensUnits SensitivityUnits { get; set; } = SensorConstants.SensUnits.NONE;
|
||||
|
||||
public ExcitationVoltageOptions.ExcitationVoltageOption Excitation { get; set; } = ExcitationVoltageOptions.ExcitationVoltageOption.Volt5;
|
||||
|
||||
public double CapacityOutputIsBasedOn { get; set; } = 1.000;
|
||||
|
||||
public InitialOffsetTypes InitialOffsetMethod { get; set; } = InitialOffsetTypes.EU;
|
||||
|
||||
public string ISOCode { get; set; } = String.Empty;
|
||||
|
||||
private enum Fields
|
||||
{
|
||||
Sensitivity,
|
||||
Poly,
|
||||
AtCapacity,
|
||||
EngineeringUnits,
|
||||
Excitation,
|
||||
CapacityOutputIsBasedOn,
|
||||
SensitivityUnits,
|
||||
ZeroPoint,
|
||||
ISOCode
|
||||
};
|
||||
|
||||
public string ToSerializedString(ISensorCalDbRecord parentCal)
|
||||
{
|
||||
var tokens = new List<string>();
|
||||
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
|
||||
foreach (var field in fields)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case Fields.AtCapacity:
|
||||
tokens.Add(AtCapacity.ToString());
|
||||
break;
|
||||
case Fields.EngineeringUnits:
|
||||
tokens.Add(EngineeringUnits);
|
||||
break;
|
||||
case Fields.Excitation:
|
||||
tokens.Add(Excitation.ToString());
|
||||
break;
|
||||
case Fields.Poly:
|
||||
Poly.MarkValid(parentCal.NonLinear);
|
||||
if (parentCal.LinearAdded)
|
||||
{
|
||||
//We have a mixed-sensitivity sensor. Mark the first CR valid, kill the rest
|
||||
for (var i = 0; i < parentCal.Records.Records.Length; i++)
|
||||
{
|
||||
parentCal.Records.Records[i].Poly.MarkValid(i == 0);
|
||||
}
|
||||
}
|
||||
|
||||
tokens.Add(Poly.ToSerializeString());
|
||||
break;
|
||||
case Fields.Sensitivity:
|
||||
tokens.Add(Sensitivity.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||
break;
|
||||
case Fields.CapacityOutputIsBasedOn:
|
||||
tokens.Add(CapacityOutputIsBasedOn.ToString());
|
||||
break;
|
||||
case Fields.SensitivityUnits:
|
||||
tokens.Add(SensitivityUnits.ToString());
|
||||
break;
|
||||
case Fields.ZeroPoint:
|
||||
tokens.Add(ZeroPoint.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||
break;
|
||||
case Fields.ISOCode:
|
||||
if (!string.IsNullOrWhiteSpace(ISOCode)) tokens.Add(ISOCode);
|
||||
break;
|
||||
default: throw new NotSupportedException("unknown CalibrationRecord field: " + field.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < tokens.Count; i++)
|
||||
{
|
||||
if (null == tokens[i])
|
||||
{
|
||||
tokens[i] = "";
|
||||
}
|
||||
|
||||
tokens[i] = tokens[i].Replace(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator,
|
||||
"x_Separator_x");
|
||||
}
|
||||
|
||||
return string.Join(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator,
|
||||
tokens.ToArray());
|
||||
}
|
||||
|
||||
public string ToDisplayString(ISensorCalibration sc, ICalibrationRecord previous, ISensorCalibration sc2, string linearFormat, string nonlinearFormat)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
|
||||
foreach (var field in fields)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case Fields.AtCapacity:
|
||||
if (null == previous || AtCapacity != previous.AtCapacity)
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_AtCapacity, AtCapacity);
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.EngineeringUnits:
|
||||
if (null == previous || false == EngineeringUnits.Equals(previous.EngineeringUnits))
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_EngineeringUnits, EngineeringUnits);
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.Excitation:
|
||||
if (null == previous || sc.IsProportional != sc2.IsProportional || Excitation != previous.Excitation)
|
||||
{
|
||||
if (sc.IsProportional)
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1:0.0}", Strings.Strings.SensorFields_Excitation,
|
||||
GetExcitationVoltageMagnitudeFromEnum(Excitation));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.Poly:
|
||||
if (null == previous || sc.NonLinear || sc.NonLinear != sc2.NonLinear)
|
||||
{
|
||||
if (sc.NonLinear)
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_NonLinearFormat,
|
||||
Poly.ToDisplayString(nonlinearFormat));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.Sensitivity:
|
||||
if (null == previous || Sensitivity != previous.Sensitivity)
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_Sensitivity,
|
||||
Sensitivity.ToString(linearFormat));
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.CapacityOutputIsBasedOn:
|
||||
if (false == AtCapacity)
|
||||
{
|
||||
if (null == previous || CapacityOutputIsBasedOn != previous.CapacityOutputIsBasedOn)
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_CapacityOutputIsBasedOn,
|
||||
CapacityOutputIsBasedOn);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.SensitivityUnits:
|
||||
if (null == previous || false == SensitivityUnits.Equals(previous.SensitivityUnits))
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_SensitivityUnits, SensitivityUnits);
|
||||
}
|
||||
|
||||
break;
|
||||
case Fields.ZeroPoint:
|
||||
if (null == previous || ZeroPoint != previous.ZeroPoint)
|
||||
{
|
||||
if (sb.Length > 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_ZeroPoint, ZeroPoint);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
public bool IsEqual(object obj, ISensorCalibration sc)
|
||||
{
|
||||
if (obj is CalibrationRecord r)
|
||||
{
|
||||
return r.ToSerializedString(sc) == ToSerializedString(sc);
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public void FromString(string s)
|
||||
{
|
||||
var tokens = s.Split(new string[] { CultureInfo.InvariantCulture.TextInfo.ListSeparator },
|
||||
StringSplitOptions.None);
|
||||
|
||||
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
|
||||
|
||||
for (var i = 0; i < tokens.Length && i < fields.Length; i++)
|
||||
{
|
||||
var token = tokens[i].Replace("x_Separator_x",
|
||||
CultureInfo.InvariantCulture.TextInfo.ListSeparator);
|
||||
switch (fields[i])
|
||||
{
|
||||
case Fields.AtCapacity:
|
||||
AtCapacity = Convert.ToBoolean(token);
|
||||
break;
|
||||
case Fields.EngineeringUnits:
|
||||
EngineeringUnits = token;
|
||||
break;
|
||||
case Fields.Excitation:
|
||||
Excitation =
|
||||
(ExcitationVoltageOptions.ExcitationVoltageOption)Enum.Parse(
|
||||
typeof(ExcitationVoltageOptions.ExcitationVoltageOption), token);
|
||||
break;
|
||||
case Fields.Poly:
|
||||
Poly = new LinearizationFormula();
|
||||
Poly.FromSerializeString(token);
|
||||
break;
|
||||
case Fields.Sensitivity:
|
||||
Sensitivity = Convert.ToDouble(token, System.Globalization.CultureInfo.InvariantCulture);
|
||||
break;
|
||||
case Fields.CapacityOutputIsBasedOn:
|
||||
CapacityOutputIsBasedOn = Convert.ToDouble(token);
|
||||
break;
|
||||
case Fields.SensitivityUnits:
|
||||
if (Enum.TryParse(token, out SensorConstants.SensUnits unit))
|
||||
{
|
||||
SensitivityUnits = unit;
|
||||
}
|
||||
else { APILogger.Log($"failed to parse sensitivity units: {token} from {s}"); }
|
||||
break;
|
||||
case Fields.ZeroPoint:
|
||||
ZeroPoint = Convert.ToDouble(token, System.Globalization.CultureInfo.InvariantCulture);
|
||||
break;
|
||||
case Fields.ISOCode:
|
||||
ISOCode = token;
|
||||
break;
|
||||
default: throw new NotSupportedException("unknown CalibrationRecord field: " + fields.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CalibrationRecord(string s)
|
||||
{
|
||||
FromString(s);
|
||||
}
|
||||
|
||||
public CalibrationRecord(ICalibrationRecord copy)
|
||||
{
|
||||
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
|
||||
foreach (var field in fields)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case Fields.AtCapacity:
|
||||
AtCapacity = copy.AtCapacity;
|
||||
break;
|
||||
case Fields.EngineeringUnits:
|
||||
EngineeringUnits = copy.EngineeringUnits;
|
||||
break;
|
||||
case Fields.Excitation:
|
||||
Excitation = copy.Excitation;
|
||||
break;
|
||||
case Fields.Poly:
|
||||
Poly = new LinearizationFormula(copy.Poly);
|
||||
break;
|
||||
case Fields.Sensitivity:
|
||||
Sensitivity = copy.Sensitivity;
|
||||
break;
|
||||
case Fields.CapacityOutputIsBasedOn:
|
||||
CapacityOutputIsBasedOn = copy.CapacityOutputIsBasedOn;
|
||||
break;
|
||||
case Fields.SensitivityUnits:
|
||||
SensitivityUnits = copy.SensitivityUnits;
|
||||
break;
|
||||
case Fields.ZeroPoint:
|
||||
ZeroPoint = copy.ZeroPoint;
|
||||
break;
|
||||
case Fields.ISOCode:
|
||||
ISOCode = copy.ISOCode;
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("unknown calibrationrecord field: " + field.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CalibrationRecord()
|
||||
{
|
||||
Poly = new LinearizationFormula();
|
||||
}
|
||||
|
||||
//helpers moved from DAS.Concepts
|
||||
public static double GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOptions.ExcitationVoltageOption target)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder().DecodeAttributeValue(target);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("encountered problem attempting to get excitation voltage magnitude from enum", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static ExcitationVoltageOptions.ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(double magnitude)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder().EncodeAttributeValue(magnitude);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log("encountered problem attempting to get excitation voltage enum from magnitude", ex);
|
||||
return ExcitationVoltageOptions.ExcitationVoltageOption.Undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace DTS.Common.Enums.TSRAIRGo
|
||||
{
|
||||
public enum NavigationButtonId
|
||||
{
|
||||
TestId,
|
||||
ArmDisarm,
|
||||
Trigger,
|
||||
Download,
|
||||
ViewData,
|
||||
ExportData,
|
||||
Help,
|
||||
Dashboard
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using DataPro.Common.Base;
|
||||
|
||||
namespace DataPro.Common.Interface
|
||||
{
|
||||
public interface ITileListView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Events.RegionOfInterest;
|
||||
using System.Linq;
|
||||
using DTS.Common.Interface.RegionOfInterest;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
|
||||
namespace DTS.Common.Classes.TestSetups
|
||||
{
|
||||
[Serializable]
|
||||
public class RegionOfInterest : IRegionOfInterest
|
||||
{
|
||||
/// <summary>
|
||||
/// holds whether a test setup is currently deserializing ROIs or not
|
||||
/// this was necessary to prevent deserialization from firing property changed notifications on construction
|
||||
/// 27034 ROI channel assignments are not saved when modifying and clicking save in test setup
|
||||
/// </summary>
|
||||
public static bool Deserializing { get; set; } = false;
|
||||
public RegionOfInterest()
|
||||
{
|
||||
Suffix = string.Empty;
|
||||
_start = double.NegativeInfinity;
|
||||
_end = double.PositiveInfinity;
|
||||
IsEnabled = true;
|
||||
IsDefault = true;
|
||||
_channelNames = null;
|
||||
_channelIds = null;
|
||||
}
|
||||
|
||||
public RegionOfInterest(bool isDefault = false)
|
||||
: this()
|
||||
{
|
||||
IsDefault = isDefault;
|
||||
}
|
||||
public RegionOfInterest(string suffix = "", bool isDefault = false, double start = -1D, double end = 1D)
|
||||
: this(isDefault)
|
||||
{
|
||||
Suffix = suffix;
|
||||
_start = start;
|
||||
_end = end;
|
||||
_channelNames = new string[0];
|
||||
_channelIds = new long[0];
|
||||
}
|
||||
|
||||
private string _suffix = string.Empty;
|
||||
public string Suffix
|
||||
{
|
||||
get => _suffix;
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(value) && !(value.StartsWith("_") && string.IsNullOrWhiteSpace(value.Substring(1))))
|
||||
{
|
||||
_suffix = value.StartsWith("_") ? value : "_" + value;
|
||||
}
|
||||
OnPropertyChanged("Suffix");
|
||||
}
|
||||
}
|
||||
|
||||
private double _start = double.MinValue;
|
||||
public double Start
|
||||
{
|
||||
get => _start;
|
||||
set
|
||||
{
|
||||
if (value >= End)
|
||||
{
|
||||
value = End - 0.01;
|
||||
}
|
||||
|
||||
if (value != _start)
|
||||
{
|
||||
//FB 43462 Infinity is not a valid value don't notify
|
||||
var notify = !double.IsInfinity(_start);
|
||||
_start = value;
|
||||
OnPropertyChanged("Start");
|
||||
if (notify)
|
||||
{
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double _end = double.MaxValue;
|
||||
public double End
|
||||
{
|
||||
get => _end;
|
||||
set
|
||||
{
|
||||
if (value <= Start)
|
||||
{
|
||||
value = Start + 0.01;
|
||||
}
|
||||
|
||||
if (value != _end)
|
||||
{
|
||||
//FB 43462 Infinity is not a valid value don't notify
|
||||
var notify = !double.IsInfinity(_end);
|
||||
_end = value;
|
||||
OnPropertyChanged("End");
|
||||
if (notify)
|
||||
{
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// notifies any consumers that ROI has changed (if it should notify)
|
||||
/// 27034 ROI channel assignments are not saved when modifying and clicking save in test setup
|
||||
/// </summary>
|
||||
private void NotifyChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Deserializing) { return; }
|
||||
if (null == ContainerLocator.Container) { return; }
|
||||
var eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
eventAggregator.GetEvent<RegionOfInterestChangedEvent>().Publish(this);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
private bool _isEnabled = true;
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set { _isEnabled = value; OnPropertyChanged("IsEnabled"); }
|
||||
}
|
||||
|
||||
//17954 Modify ROI does not show in UI
|
||||
//deserialize wasn't setting this, seems like it should
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public void ResetSuffix()
|
||||
{
|
||||
_suffix = string.Empty;
|
||||
}
|
||||
|
||||
private string[] _channelNames = new string[0];
|
||||
public string[] ChannelNames
|
||||
{
|
||||
get => _channelNames;
|
||||
set
|
||||
{
|
||||
//FB 43462 if the value is null first initialize it to empty array
|
||||
if (_channelNames == null)
|
||||
{
|
||||
_channelNames = value ?? new string[] { };
|
||||
OnPropertyChanged("ChannelNames");
|
||||
}
|
||||
//FB 43462 check all elements to determeine equal
|
||||
if (!_channelNames.SequenceEqual(value))
|
||||
{
|
||||
_channelNames = value ?? new string[] { };
|
||||
OnPropertyChanged("ChannelNames");
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long[] _channelIds;
|
||||
public long[] ChannelIds
|
||||
{
|
||||
get => _channelIds;
|
||||
set
|
||||
{
|
||||
//FB 43462 if the value is null first initialize it to empty array
|
||||
if (_channelIds == null)
|
||||
{
|
||||
_channelIds = value ?? new long[] { };
|
||||
OnPropertyChanged("ChannelIds");
|
||||
}
|
||||
//FB 43462 check all elements to determeine equal
|
||||
if (!_channelIds.SequenceEqual(value))
|
||||
{
|
||||
_channelIds = value ?? new long[] { };
|
||||
OnPropertyChanged("ChannelIds");
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return a TSA_Embedded channel on a TSR AIR differently than a TSA_Embedded channel
|
||||
/// on other DAS (it's a Voltage input channel if on non-TSR AIR DAS).
|
||||
/// </summary>
|
||||
/// <param name="serialNumber"></param>
|
||||
/// <param name="hardwareChannelName"></param>
|
||||
/// <param name="startOfHardware"></param>
|
||||
/// <param name="originalChannelName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetAnalogChanName(string serialNumber, string hardwareChannelName, string startOfHardware, string originalChannelName = "")
|
||||
{
|
||||
var chanName = string.Empty;
|
||||
|
||||
if ((serialNumber == SensorConstants.TEST_SPECIFIC_ANALOG_SERIAL) &&
|
||||
!hardwareChannelName.StartsWith($"[{startOfHardware}") ||
|
||||
(serialNumber == SensorConstants.VOLTAGE_INPUT))
|
||||
{
|
||||
//34350 This is a Voltage input channel, so parse it differently
|
||||
chanName = GetChanName(SensorConstants.VOLTAGE_INPUT, hardwareChannelName, originalChannelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
chanName = GetChanName(serialNumber, hardwareChannelName, originalChannelName);
|
||||
}
|
||||
|
||||
return chanName;
|
||||
}
|
||||
/// <summary>
|
||||
/// Takes a Serial Number, Hardware Channel Name, and Original Channel Name and prepends the hardware channel
|
||||
/// based on whether or not it's an embedded (TSR AIR channel), or has a parent DAS.
|
||||
/// </summary>
|
||||
/// <param name="aic"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetChanName(string serialNumber, string hardwareChannelName, string originalChannelName = "")
|
||||
{
|
||||
var chanName = string.Empty;
|
||||
|
||||
if (serialNumber == SensorConstants.TEST_SPECIFIC_ANALOG_SERIAL)
|
||||
{
|
||||
chanName = hardwareChannelName + "\\" + originalChannelName;
|
||||
}
|
||||
else
|
||||
{
|
||||
var indexOfColon = hardwareChannelName.IndexOf(":");
|
||||
if (indexOfColon == -1)
|
||||
{
|
||||
chanName = hardwareChannelName + "\\" + serialNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
var dasSerialNumber = hardwareChannelName.Substring(indexOfColon).Replace(':', '[');
|
||||
chanName = dasSerialNumber + "\\" + serialNumber;
|
||||
}
|
||||
}
|
||||
|
||||
return chanName;
|
||||
}
|
||||
public static string RemoveParentDASName(string entireChannelName)
|
||||
{
|
||||
var chanName = entireChannelName;
|
||||
|
||||
var indexOfColon = entireChannelName.IndexOf(":");
|
||||
if (indexOfColon > -1)
|
||||
{
|
||||
chanName = entireChannelName.Substring(indexOfColon).Replace(':', '[');
|
||||
}
|
||||
|
||||
return chanName;
|
||||
}
|
||||
/// <summary>
|
||||
/// sets the channel names without notifying of a change
|
||||
/// allows a constructor to bypass notifications
|
||||
/// 27034 ROI channel assignments are not saved when modifying and clicking save in test setup
|
||||
/// </summary>
|
||||
/// <param name="names"></param>
|
||||
public void SetChannelNamesNoNotify(string[] names)
|
||||
{
|
||||
_channelNames = names;
|
||||
}
|
||||
/// <summary>
|
||||
/// sets the channel ids without notifying of a change
|
||||
/// allows a constructor to bypass notifications
|
||||
/// </summary>
|
||||
/// <param name="names"></param>
|
||||
public void SetChannelIdsNoNotify(long[] ids)
|
||||
{
|
||||
_channelIds = ids;
|
||||
}
|
||||
/// <summary>
|
||||
/// returns string after "Assigned by ID"
|
||||
/// </summary>
|
||||
/// <param name="chHardware"></param>
|
||||
/// <returns></returns>
|
||||
public static string RemoveAssignedByIDFromHardwareString(string chHardware)
|
||||
{
|
||||
var newChHardware = string.Empty;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(chHardware))
|
||||
{
|
||||
newChHardware = chHardware.TrimStart();
|
||||
if (chHardware.StartsWith("Assigned by ID"))
|
||||
{
|
||||
newChHardware = chHardware.Replace("Assigned by ID", "");
|
||||
newChHardware = newChHardware.TrimStart();
|
||||
}
|
||||
if (newChHardware.Contains("["))
|
||||
{
|
||||
newChHardware = newChHardware.TrimStart();
|
||||
newChHardware = newChHardware.TrimStart('\\').Trim();
|
||||
}
|
||||
}
|
||||
|
||||
return newChHardware;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Prism.Events;
|
||||
using System.Windows;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event to inform app that it should mark itself busy or available
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
public class SetPageHeaderVisibilityEvent : PubSubEvent<SetPageHeaderVisibilityEventArgs> { }
|
||||
|
||||
public class SetPageHeaderVisibilityEventArgs
|
||||
{
|
||||
public bool SetVisiblity { get; set; } = false;
|
||||
public Visibility Visibility { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DTS.Common.Enums
|
||||
{
|
||||
public enum UIItemStatus
|
||||
{
|
||||
None,
|
||||
Success,
|
||||
Failed,
|
||||
Error,
|
||||
Warning
|
||||
}
|
||||
|
||||
public abstract class SelectedItemsStatus
|
||||
{
|
||||
private static Dictionary<object, bool> _ListStatus = new Dictionary<object, bool>();
|
||||
private static readonly object MyLock = new object();
|
||||
|
||||
public static void SetUpdating(object o, bool updating)
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
_ListStatus[o] = updating;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool GetUpdating(object o)
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
if (_ListStatus.ContainsKey(o)) { return _ListStatus[o]; }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,48 @@
|
||||
namespace DTS.Common.Enums.DASFactory
|
||||
{
|
||||
public static class ConstantsAndEnums
|
||||
{
|
||||
/// <summary>
|
||||
/// This tells us what type of device it is
|
||||
/// </summary>
|
||||
public enum DASType
|
||||
{
|
||||
NONE,
|
||||
HID_SLICE,
|
||||
WINUSB_SLICE,
|
||||
G5,
|
||||
SIM,
|
||||
TOM,
|
||||
DIM,
|
||||
TSR,
|
||||
HEADS,
|
||||
MINIDAU,
|
||||
ETHERNET_SLICE,
|
||||
ETHERNET_RIBEYE,
|
||||
SLICE_DB,
|
||||
TSR2,
|
||||
ETHERNET_TDAS,
|
||||
CDCUSB_SLICE,
|
||||
ETHERNET_SLICE2,
|
||||
WINUSB_SLICE1_5,
|
||||
ETHERNET_SLICE1_5,
|
||||
ETHERNET_SLICE6,
|
||||
ETHERNET_SLICE6AIR,
|
||||
WINUSB_SLICE6,
|
||||
WINUSB_SLICE6AIR,
|
||||
ETHERNET_SLICE6DB,
|
||||
SERIAL_TDAS
|
||||
}
|
||||
public enum VoltageStatusColor
|
||||
{
|
||||
Green,
|
||||
Red,
|
||||
Yellow,
|
||||
Off
|
||||
}
|
||||
|
||||
public const int EVENT_NUMBER_PRETEST_DIAG = -1;
|
||||
public const int EVENT_NUMBER_POSTTEST_DIAG = -2;
|
||||
public const int EVENT_NUMBER_MEASURE_BRIDGE = -3;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user