init
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Practices.Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event to inform feedback page to get updated
|
||||
/// FB 22323
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
public class FeedbackEvent : CompositePresentationEvent<FeedbackArg> { }
|
||||
|
||||
|
||||
public class FeedbackArg
|
||||
{
|
||||
/// <summary>
|
||||
/// Severity being notified
|
||||
/// </summary>
|
||||
public Severity Severity { get; private set; }
|
||||
/// <summary>
|
||||
/// Message that is logged
|
||||
/// </summary>
|
||||
public string Message { get; private set; }
|
||||
|
||||
public FeedbackArg(Severity severity, string message)
|
||||
{
|
||||
Severity = severity;
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
public enum Severity
|
||||
{
|
||||
Information,
|
||||
Warning,
|
||||
Error,
|
||||
ResponseStarting,
|
||||
CommandStarting
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IISOSettingsModel : IBaseModel
|
||||
{
|
||||
void SaveData(IISOSettingsData data);
|
||||
IISOSettingsData LoadData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IStatusAndProgressBarFooterViewModel : IBaseViewModel
|
||||
{
|
||||
IStatusAndProgressFooterView View { get; set;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
|
||||
namespace DTS.Common.Interface.GroupTemplate
|
||||
{
|
||||
public interface ITestObjectTemplate
|
||||
{
|
||||
/// <summary>
|
||||
/// name of the test object template, this could be a GUID in the case of embedded test object templates
|
||||
/// </summary>
|
||||
string TemplateName { get; set; }
|
||||
/// <summary>
|
||||
/// a human readable name for the template, for an embedded template this is the original template name, for
|
||||
/// a non embedded template, this is the template name (embedded templates have guids for names)
|
||||
/// </summary>
|
||||
string TemplateNameOrOriginalTemplateName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// the icon for the template
|
||||
/// </summary>
|
||||
string Icon { get; set; }
|
||||
/// <summary>
|
||||
/// description for the template
|
||||
/// </summary>
|
||||
string Description { get; set; }
|
||||
/// <summary>
|
||||
/// whether this template is intended to only be used locally or not
|
||||
/// </summary>
|
||||
bool LocalOnly { get; set; }
|
||||
/// <summary>
|
||||
/// the version number of this template [not currently used?]
|
||||
/// </summary>
|
||||
int Version { get; set; }
|
||||
/// <summary>
|
||||
/// last person to modify this template
|
||||
/// </summary>
|
||||
string LastModifiedBy { get; set; }
|
||||
/// <summary>
|
||||
/// when this template was last modified
|
||||
/// </summary>
|
||||
DateTime LastModified { get; set; }
|
||||
/// <summary>
|
||||
/// a CRC32 for the template, but not currently used
|
||||
/// original idea was to allow us to not have to check changes in the template, just quickly calculate whether anything has changed
|
||||
/// </summary>
|
||||
int CRC32 { get; set; }
|
||||
/// <summary>
|
||||
/// test object (iso meta field) for this template
|
||||
/// </summary>
|
||||
string TestObject { get; set; }
|
||||
/// <summary>
|
||||
/// test object type (iso meta field) for this template, all channels are of this type ...
|
||||
/// </summary>
|
||||
string TestObjectType { get; set; }
|
||||
/// <summary>
|
||||
/// unsure if this is still used, was originally used to build up templates from sub templates,
|
||||
/// so an ATD could be composed of leg, arm, head, etc
|
||||
/// </summary>
|
||||
string TemplateParent { get; set; }
|
||||
/// <summary>
|
||||
/// unsure, I think this is whether the group is dynamically added or an existing
|
||||
/// </summary>
|
||||
bool SysBuilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the original template name [if we are embedded we got a new name that was a guid, but we store the old name here for readability purposes]
|
||||
/// </summary>
|
||||
string OriginalTemplateName { get; set; }
|
||||
/// <summary>
|
||||
/// whether this group is embedded in a test setup, or is a user created and living on it's own template
|
||||
/// </summary>
|
||||
bool Embedded { get; set; }
|
||||
|
||||
bool IsISOMode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Practices.Prism.Regions;
|
||||
|
||||
namespace DTS.Common
|
||||
{
|
||||
public class StackPanelRegionAdapter : RegionAdapterBase<StackPanel>
|
||||
{
|
||||
|
||||
public StackPanelRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
|
||||
: base(regionBehaviorFactory)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Adapt(IRegion region, StackPanel regionTarget)
|
||||
{
|
||||
if (region == null) return;
|
||||
|
||||
region.Views.CollectionChanged += (sender, e) =>
|
||||
{
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
|
||||
foreach (UIElement element in e.NewItems)
|
||||
{
|
||||
regionTarget.Children.Add(element);
|
||||
}
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
|
||||
foreach (UIElement elementLoopVariable in e.OldItems)
|
||||
{
|
||||
var element = elementLoopVariable;
|
||||
|
||||
if (regionTarget.Children.Contains(element))
|
||||
{
|
||||
regionTarget.Children.Remove(element);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override IRegion CreateRegion()
|
||||
{
|
||||
return new AllActiveRegion();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Events.RegionOfInterest;
|
||||
using DTS.Common.Events.RegionOfInterest.RegionOfInterestChannels;
|
||||
using DTS.Common.Interface.RegionOfInterest;
|
||||
using Microsoft.Practices.Prism.Events;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
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;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
_start = value;
|
||||
OnPropertyChanged("Start");
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double _end = double.MaxValue;
|
||||
public double End
|
||||
{
|
||||
get => _end;
|
||||
set
|
||||
{
|
||||
if (value <= Start)
|
||||
{
|
||||
value = Start + 0.01;
|
||||
}
|
||||
|
||||
if (value != _end)
|
||||
{
|
||||
_end = value;
|
||||
OnPropertyChanged("End");
|
||||
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 == ServiceLocator.Current) { return; }
|
||||
var eventAggregator = ServiceLocator.Current.GetInstance<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
|
||||
{
|
||||
if (_channelNames != value)
|
||||
{
|
||||
_channelNames = value ?? new string[] { };
|
||||
OnPropertyChanged("ChannelNames");
|
||||
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>
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user