init
This commit is contained in:
1
DataPRO/Modules/TestSetups/CachedItemsList/.svn/entries
Normal file
1
DataPRO/Modules/TestSetups/CachedItemsList/.svn/entries
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
1
DataPRO/Modules/TestSetups/CachedItemsList/.svn/format
Normal file
1
DataPRO/Modules/TestSetups/CachedItemsList/.svn/format
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
@@ -0,0 +1,481 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
using System;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using System.Linq;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace CachedItemsList
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles CachedItemsList functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class CachedItemsListViewModel : ICachedItemsListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The SensorList view
|
||||
/// </summary>
|
||||
public ICachedItemsListView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the CachedItemsListViewModel
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public CachedItemsListViewModel(ICachedItemsListView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Unset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
public bool SetCachedItems(ISensorData[] sensors, ISensorCalibration[] sensorCalibrations,
|
||||
IDASHardware[] hardware, IDASHardware[] allDAS)
|
||||
{
|
||||
return false;
|
||||
//var list = new List<ICachedItem>();
|
||||
|
||||
//#region SENSORS
|
||||
//var serialNumberToSensor = new Dictionary<string, ISensorData>();
|
||||
//var sensorsNeedingProcessing = new HashSet<string>();
|
||||
//foreach (var s in sensors)
|
||||
//{
|
||||
// serialNumberToSensor[s.SerialNumber] = s;
|
||||
// sensorsNeedingProcessing.Add(s.SerialNumber);
|
||||
//}
|
||||
|
||||
//#region Sensors IN DB
|
||||
|
||||
//#region analog
|
||||
|
||||
//var hr = DbOperations.SensorsAnalogGet(null, null, null, out var records);
|
||||
//if( 0 == hr && null != records && records.Any())
|
||||
//{
|
||||
// foreach( var record in records)
|
||||
// {
|
||||
// if (!sensorsNeedingProcessing.Contains(record.SerialNumber))
|
||||
// {
|
||||
// //either we didn't need to process this sensor, or we already have ...?
|
||||
// continue;
|
||||
// }
|
||||
// sensorsNeedingProcessing.Remove(record.SerialNumber);
|
||||
// var original = serialNumberToSensor[record.SerialNumber];
|
||||
// if (Math.Abs(record.LastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(record.SerialNumber, Resources.StringResources.Sensor,
|
||||
// original.LastModified, record.LastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region squib
|
||||
//hr = DbOperations.SensorsSquibGet(null, null, null, out var squibRecords);
|
||||
//if( 0 == hr && null != squibRecords && squibRecords.Any())
|
||||
//{
|
||||
// foreach( var squibRecord in squibRecords)
|
||||
// {
|
||||
// if( !sensorsNeedingProcessing.Contains(squibRecord.SerialNumber))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// sensorsNeedingProcessing.Remove(squibRecord.SerialNumber);
|
||||
// var original = serialNumberToSensor[squibRecord.SerialNumber];
|
||||
// var modifiedBy = squibRecord.LastModifiedBy;
|
||||
// var lastModified = squibRecord.LastModified;
|
||||
// if( Math.Abs(lastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(squibRecord.SerialNumber, Resources.StringResources.Sensor, original.LastModified, lastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region DigitalInputs
|
||||
//hr = DbOperations.SensorsDigitalInGet(null, null, null, out var digitalIns);
|
||||
//if (0 == hr && null != digitalIns && digitalIns.Any())
|
||||
//{
|
||||
// foreach( var digitalIn in digitalIns)
|
||||
// {
|
||||
// if (!sensorsNeedingProcessing.Contains(digitalIn.SerialNumber)) { continue; }
|
||||
// sensorsNeedingProcessing.Remove(digitalIn.SerialNumber);
|
||||
// var original = serialNumberToSensor[digitalIn.SerialNumber];
|
||||
// var lastModified = digitalIn.LastModified;
|
||||
// if (Math.Abs(lastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(digitalIn.SerialNumber, Resources.StringResources.Sensor, original.LastModified, lastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region DigitalOutputs
|
||||
//hr = DbOperations.SensorsDigitalOutGet(null, null, out var digitalOutRecords);
|
||||
//if (0 == hr && null != digitalOutRecords && digitalOutRecords.Any())
|
||||
//{
|
||||
// foreach( var record in digitalOutRecords)
|
||||
// {
|
||||
// if (!sensorsNeedingProcessing.Contains(record.SerialNumber))
|
||||
// {
|
||||
// //either we didn't need to process this sensor, or we already have ...?
|
||||
// continue;
|
||||
// }
|
||||
// sensorsNeedingProcessing.Remove(record.SerialNumber);
|
||||
// if (IsTestSpecificDigitalOutput(record.SerialNumber)) { continue; }
|
||||
// var original = serialNumberToSensor[record.SerialNumber];
|
||||
// var lastModified = record.LastModified;
|
||||
// if (Math.Abs(lastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(record.SerialNumber, Resources.StringResources.Sensor,
|
||||
// original.LastModified, lastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#endregion SENSORS IN DB
|
||||
|
||||
//#region Sensors NOT IN DB
|
||||
|
||||
//using (var eSensors = sensorsNeedingProcessing.GetEnumerator())
|
||||
//{
|
||||
// while (eSensors.MoveNext())
|
||||
// {
|
||||
// var original = serialNumberToSensor[eSensors.Current];
|
||||
// list.Add(new CachedItem(eSensors.Current, Resources.StringResources.Sensor, original.LastModified,
|
||||
// DateTime.MinValue));
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
//#endregion SENSORS
|
||||
|
||||
//#region Hardware
|
||||
|
||||
//var serialNumberToHardware = new Dictionary<string, IDASHardware>();
|
||||
//var hardwareNeedingProcessing = new HashSet<string>();
|
||||
//foreach (var h in hardware)
|
||||
//{
|
||||
// serialNumberToHardware[h.SerialNumber] = h;
|
||||
// hardwareNeedingProcessing.Add(h.SerialNumber);
|
||||
//}
|
||||
|
||||
//#region Hardware In DB
|
||||
|
||||
//foreach (var das in allDAS)
|
||||
//{
|
||||
// if (!hardwareNeedingProcessing.Contains(das.SerialNumber))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// hardwareNeedingProcessing.Remove(das.SerialNumber);
|
||||
// var original = serialNumberToHardware[das.SerialNumber];
|
||||
// if (Math.Abs(das.LastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(das.SerialNumber, Resources.StringResources.Hardware, original.LastModified,
|
||||
// das.LastModified));
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion Hardware In DB
|
||||
|
||||
//#region Hardware NOT IN DB
|
||||
|
||||
//using (var eHardware = hardwareNeedingProcessing.GetEnumerator())
|
||||
//{
|
||||
// while (eHardware.MoveNext())
|
||||
// {
|
||||
// var original = serialNumberToHardware[eHardware.Current];
|
||||
// list.Add(new CachedItem(original.SerialNumber, Resources.StringResources.Hardware,
|
||||
// original.LastModified, DateTime.MinValue));
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#endregion Hardware
|
||||
|
||||
//#region Calibrations
|
||||
//var serialNumberToLastCalibration = new Dictionary<string, ISensorCalibration>();
|
||||
//var serialNumberToLastCalibrationInDb = new Dictionary<string, ISensorCalibration>();
|
||||
//var calsNeedingProcessing = new HashSet<string>();
|
||||
|
||||
//foreach (var cal in sensorCalibrations)
|
||||
//{
|
||||
// if (!calsNeedingProcessing.Contains(cal.SerialNumber))
|
||||
// {
|
||||
// calsNeedingProcessing.Add(cal.SerialNumber);
|
||||
// serialNumberToLastCalibration[cal.SerialNumber] = cal;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serialNumberToLastCalibration[cal.SerialNumber].CalibrationDate < cal.CalibrationDate)
|
||||
// {
|
||||
// serialNumberToLastCalibration[cal.SerialNumber] = cal;
|
||||
// }
|
||||
// else if (serialNumberToLastCalibration[cal.SerialNumber].CalibrationDate == cal.CalibrationDate &&
|
||||
// serialNumberToLastCalibration[cal.SerialNumber].ModifyDate < cal.ModifyDate)
|
||||
// {
|
||||
// serialNumberToLastCalibration[cal.SerialNumber] = cal;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#region CalibrationsInDb
|
||||
//hr = DbOperations.SensorCalibrationsGet(null, null, out var calRecords);
|
||||
//if( 0 == hr && null != calRecords && calRecords.Any())
|
||||
//{
|
||||
// foreach( var record in calRecords)
|
||||
// {
|
||||
// var sc = new SensorCalibration(record);
|
||||
// if (!serialNumberToLastCalibration.ContainsKey(sc.SerialNumber))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// calsNeedingProcessing.Remove(sc.SerialNumber);
|
||||
// if (!serialNumberToLastCalibrationInDb.ContainsKey(sc.SerialNumber))
|
||||
// {
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber] = sc;
|
||||
// }
|
||||
// else if (serialNumberToLastCalibrationInDb[sc.SerialNumber].CalibrationDate <
|
||||
// sc.CalibrationDate)
|
||||
// {
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber] = sc;
|
||||
// }
|
||||
// else if (serialNumberToLastCalibrationInDb[sc.SerialNumber].CalibrationDate ==
|
||||
// sc.CalibrationDate &&
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber].ModifyDate < sc.ModifyDate)
|
||||
// {
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber] = sc;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//using (var eCals = serialNumberToLastCalibrationInDb.GetEnumerator())
|
||||
//{
|
||||
// while (eCals.MoveNext())
|
||||
// {
|
||||
// var original = serialNumberToLastCalibration[eCals.Current.Key];
|
||||
// var dbVersion = eCals.Current.Value;
|
||||
// if (original.CalibrationDate < dbVersion.CalibrationDate)
|
||||
// {
|
||||
// list.Add(new CachedItem(original.SerialNumber, Resources.StringResources.SensorCal,
|
||||
// original.ModifyDate, dbVersion.ModifyDate));
|
||||
// }
|
||||
// else if (original.CalibrationDate == dbVersion.CalibrationDate)
|
||||
// {
|
||||
// if (Math.Abs(dbVersion.ModifyDate.Subtract(original.ModifyDate).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(original.SerialNumber, Resources.StringResources.SensorCal,
|
||||
// original.ModifyDate, dbVersion.ModifyDate));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
//#region Calibrations NOT IN DB
|
||||
|
||||
//using (var eCals = calsNeedingProcessing.GetEnumerator())
|
||||
//{
|
||||
// while (eCals.MoveNext())
|
||||
// {
|
||||
// var cal = serialNumberToLastCalibration[eCals.Current];
|
||||
// list.Add(new CachedItem(cal.SerialNumber, Resources.StringResources.SensorCal, cal.ModifyDate,
|
||||
// DateTime.MinValue));
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
//#endregion
|
||||
//CachedItems = list.ToArray();
|
||||
//OnPropertyChanged("CachedItems");
|
||||
//return list.Any();
|
||||
}
|
||||
|
||||
private static bool IsTestSpecificDigitalOutput(string serialNumber)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(serialNumber))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return serialNumber.StartsWith(TEST_SPECIFIC_DIGITAL_OUT);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constants and Enums
|
||||
|
||||
private const string TEST_SPECIFIC_DIGITAL_OUT = "TSD_";
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public ICachedItem[] CachedItems { get; set; } = new ICachedItem[0];
|
||||
|
||||
public bool IsDirty => false;
|
||||
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasOutofDateCachedItems => CachedItems.Any();
|
||||
|
||||
public bool HasMissingSensors
|
||||
{
|
||||
get
|
||||
{
|
||||
return CachedItems.Any() && Array.Exists(CachedItems, item => item.DBTime.Equals(DateTime.MinValue) && item.ObjectType == Resources.StringResources.Sensor);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CacheTime" xml:space="preserve">
|
||||
<value>Cache Time</value>
|
||||
</data>
|
||||
<data name="DBTime" xml:space="preserve">
|
||||
<value>Db Time</value>
|
||||
</data>
|
||||
<data name="Deleted" xml:space="preserve">
|
||||
<value>[Deleted]</value>
|
||||
</data>
|
||||
<data name="Hardware" xml:space="preserve">
|
||||
<value>Hardware</value>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="ObjectType" xml:space="preserve">
|
||||
<value>(Type)</value>
|
||||
</data>
|
||||
<data name="Prepare_TestSetups_EditTestSetup_Page_Update" xml:space="preserve">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
<data name="Sensor" xml:space="preserve">
|
||||
<value>Sensor</value>
|
||||
</data>
|
||||
<data name="SensorCal" xml:space="preserve">
|
||||
<value>Sensor calibration</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,85 @@
|
||||
<base:BaseView x:Class="CachedItemsList.CachedItemsListView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:CachedItemsList"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<ListView ItemsSource="{Binding CachedItems, UpdateSourceTrigger=PropertyChanged}" AutomationProperties.AutomationId="CachedItemsListView" >
|
||||
<ListView.View>
|
||||
<GridView AutomationProperties.AutomationId="CachedItemsListGridView">
|
||||
<GridViewColumn AutomationProperties.AutomationId="Name">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="Name" Content="{strings:TranslateExtension Name}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding Name,FallbackValue='Name'}" AutomationProperties.AutomationId="NameLbl"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn AutomationProperties.AutomationId="ObjectType">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="ObjectType" Content="{strings:TranslateExtension ObjectType}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding ObjectType,FallbackValue='Type'}" AutomationProperties.AutomationId="ObjectTypeLbl"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn AutomationProperties.AutomationId="CacheTime">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="CacheTime" Content="{strings:TranslateExtension CacheTime}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding CacheTime,FallbackValue='CacheTime'}" AutomationProperties.AutomationId="CacheTimeLbl"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn AutomationProperties.AutomationId="DbTime">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="DbTime" Content="{strings:TranslateExtension DBTime}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding DBTime,FallbackValue='DBTime'}" AutomationProperties.AutomationId="DbTimeLbl" x:Name="DbTimeLbl"/>
|
||||
<ItemContainerTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding}" Value="{x:Static sys:DateTime.MinValue}">
|
||||
<Setter TargetName="DbTimeLbl" Property="Text" Value="{strings:TranslateExtension Deleted}" />
|
||||
</DataTrigger>
|
||||
</ItemContainerTemplate.Triggers>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using CachedItemsList.Resources;
|
||||
|
||||
namespace CachedItemsList
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
using System;
|
||||
|
||||
namespace CachedItemsList.Model
|
||||
{
|
||||
public class CachedItem : ICachedItem
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string ObjectType { get; private set; }
|
||||
public DateTime CacheTime { get; private set; }
|
||||
/// <summary>
|
||||
/// DateTime.MinValue indicates no longer in db, otherwise
|
||||
/// the LastModified time in the db
|
||||
/// </summary>
|
||||
public DateTime DBTime { get; private set; }
|
||||
|
||||
public CachedItem(string name, string objectType, DateTime cacheTime, DateTime dbTime)
|
||||
{
|
||||
Name = name;
|
||||
ObjectType = objectType;
|
||||
CacheTime = cacheTime;
|
||||
DBTime = dbTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CachedItemsList.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CachedItemsList.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cache Time.
|
||||
/// </summary>
|
||||
internal static string CacheTime {
|
||||
get {
|
||||
return ResourceManager.GetString("CacheTime", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Db Time.
|
||||
/// </summary>
|
||||
internal static string DBTime {
|
||||
get {
|
||||
return ResourceManager.GetString("DBTime", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to [Deleted].
|
||||
/// </summary>
|
||||
internal static string Deleted {
|
||||
get {
|
||||
return ResourceManager.GetString("Deleted", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hardware.
|
||||
/// </summary>
|
||||
internal static string Hardware {
|
||||
get {
|
||||
return ResourceManager.GetString("Hardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
internal static string Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to (Type).
|
||||
/// </summary>
|
||||
internal static string ObjectType {
|
||||
get {
|
||||
return ResourceManager.GetString("ObjectType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Refresh.
|
||||
/// </summary>
|
||||
internal static string Prepare_TestSetups_EditTestSetup_Page_Update {
|
||||
get {
|
||||
return ResourceManager.GetString("Prepare_TestSetups_EditTestSetup_Page_Update", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sensor.
|
||||
/// </summary>
|
||||
internal static string Sensor {
|
||||
get {
|
||||
return ResourceManager.GetString("Sensor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sensor calibration.
|
||||
/// </summary>
|
||||
internal static string SensorCal {
|
||||
get {
|
||||
return ResourceManager.GetString("SensorCal", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F676558B-E5CB-417D-BA4B-1E702A63480C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CachedItemsList</RootNamespace>
|
||||
<AssemblyName>CachedItemsList</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.Xaml.Behaviors">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.Abstractions">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Model\CachedItem.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CachedItemsListModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\CachedItemsListViewModel.cs" />
|
||||
<Compile Include="View\CachedItemsListView.xaml.cs">
|
||||
<DependentUpon>CachedItemsListView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Core\DTS.Common.Core.csproj">
|
||||
<Project>{fab1f470-1574-4301-b56e-d3364aa93679}</Project>
|
||||
<Name>DTS.Common.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.DAS.Concepts\DTS.Common.DAS.Concepts.csproj">
|
||||
<Project>{03D8C736-36EB-4CD1-A6D9-130452B23239}</Project>
|
||||
<Name>DTS.Common.DAS.Concepts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.ISO\DTS.Common.ISO.csproj">
|
||||
<Project>{4dccddd1-032f-430c-9a6f-231daca4fbd0}</Project>
|
||||
<Name>DTS.Common.ISO</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
|
||||
<Project>{e0d1a7d0-dce8-403d-ba85-5a5d66ba1313}</Project>
|
||||
<Name>DTS.Common.Storage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
|
||||
<Project>{03eace47-ea59-44ac-b49d-956e4dc4d618}</Project>
|
||||
<Name>DTS.Common.Utilities</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Users\Users.csproj">
|
||||
<Project>{BE8D217D-6DA9-4BCA-B62A-A82325B33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\CachedItemsListView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="CachedItemsList.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<CachedItemsList.Properties.Settings>
|
||||
</CachedItemsList.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CachedItemsList.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
|
||||
using CachedItemsList;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: CachedItemsListModuleName]
|
||||
[assembly: CachedItemsListModuleImageAttribute]
|
||||
namespace CachedItemsList
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "CachedItemsListModule")]
|
||||
public class CachedItemsListModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CachedItemsListModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public CachedItemsListModule(IUnityContainer unityContainer)
|
||||
{
|
||||
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<ICachedItemsListView, CachedItemsListView>();
|
||||
_unityContainer.RegisterType<ICachedItemsListViewModel, CachedItemsListViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class CachedItemsListModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public CachedItemsListModuleNameAttribute() : this(null) { }
|
||||
|
||||
public CachedItemsListModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.CachedItemsList.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(TextAttribute);
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class CachedItemsListModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public CachedItemsListModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.CachedItemsList.ToString()); return _img; }
|
||||
}
|
||||
public CachedItemsListModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.CachedItemsList.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.CachedItemsList.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.CachedItemsListRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace CachedItemsList
|
||||
{
|
||||
/// <inheritdoc cref="ICachedItemsListView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for CachedItemsListView.xaml
|
||||
/// </summary>
|
||||
public partial class CachedItemsListView : ICachedItemsListView
|
||||
{
|
||||
public CachedItemsListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
//private void ListViewHeader_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
//{
|
||||
// var colHeader = (GridViewColumnHeader)e.OriginalSource;
|
||||
// var viewModel = (ICachedItemsListViewModel)colHeader.DataContext;
|
||||
// viewModel.Sort(colHeader.Tag, true);
|
||||
//}
|
||||
|
||||
//private void MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
//{
|
||||
// var lv = sender as ListView;
|
||||
// if (null == lv)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// var index = GetCurrentIndex(e.GetPosition, lv);
|
||||
// if (index >= 0 && index < lv.Items.Count)
|
||||
// {
|
||||
// var vm = (ICachedItemsListViewModel) lv.DataContext;
|
||||
// vm.MouseDoubleClick(index);
|
||||
// }
|
||||
//}
|
||||
//delegate Point GetPositionDelegate(IInputElement element);
|
||||
//private int GetCurrentIndex(GetPositionDelegate getPosition, ListView lv)
|
||||
//{
|
||||
// int index = -1;
|
||||
// for (int i = 0; i < lv.Items.Count; i++)
|
||||
// {
|
||||
// ListViewItem item = GetListViewItem(i, lv);
|
||||
// if (item == null)
|
||||
// continue;
|
||||
// if (IsMouseOverTarget(item, getPosition))
|
||||
// {
|
||||
// index = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return index;
|
||||
//}
|
||||
//private ListViewItem GetListViewItem(int index, ListView lv)
|
||||
//{
|
||||
// return lv.ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem;
|
||||
//}
|
||||
//private bool IsMouseOverTarget(Visual target, GetPositionDelegate getPosition)
|
||||
//{
|
||||
// Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
|
||||
// Point mousePos = getPosition((IInputElement)target);
|
||||
// return bounds.Contains(mousePos);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CachedItemsList.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CachedItemsList")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("CachedItemsList")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("016e9db3-ef15-4c07-a46e-23f32804af42")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
BIN
DataPRO/Modules/TestSetups/CachedItemsList/.svn/wc.db
Normal file
BIN
DataPRO/Modules/TestSetups/CachedItemsList/.svn/wc.db
Normal file
Binary file not shown.
12
DataPRO/Modules/TestSetups/CachedItemsList/App.config
Normal file
12
DataPRO/Modules/TestSetups/CachedItemsList/App.config
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="CachedItemsList.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<CachedItemsList.Properties.Settings>
|
||||
</CachedItemsList.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F676558B-E5CB-417D-BA4B-1E702A63480C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CachedItemsList</RootNamespace>
|
||||
<AssemblyName>CachedItemsList</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.Xaml.Behaviors">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.Abstractions">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Model\CachedItem.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CachedItemsListModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\CachedItemsListViewModel.cs" />
|
||||
<Compile Include="View\CachedItemsListView.xaml.cs">
|
||||
<DependentUpon>CachedItemsListView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Core\DTS.Common.Core.csproj">
|
||||
<Project>{fab1f470-1574-4301-b56e-d3364aa93679}</Project>
|
||||
<Name>DTS.Common.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.DAS.Concepts\DTS.Common.DAS.Concepts.csproj">
|
||||
<Project>{03D8C736-36EB-4CD1-A6D9-130452B23239}</Project>
|
||||
<Name>DTS.Common.DAS.Concepts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.ISO\DTS.Common.ISO.csproj">
|
||||
<Project>{4dccddd1-032f-430c-9a6f-231daca4fbd0}</Project>
|
||||
<Name>DTS.Common.ISO</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
|
||||
<Project>{e0d1a7d0-dce8-403d-ba85-5a5d66ba1313}</Project>
|
||||
<Name>DTS.Common.Storage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
|
||||
<Project>{03eace47-ea59-44ac-b49d-956e4dc4d618}</Project>
|
||||
<Name>DTS.Common.Utilities</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Users\Users.csproj">
|
||||
<Project>{BE8D217D-6DA9-4BCA-B62A-A82325B33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\CachedItemsListView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
|
||||
using CachedItemsList;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: CachedItemsListModuleName]
|
||||
[assembly: CachedItemsListModuleImageAttribute]
|
||||
namespace CachedItemsList
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "CachedItemsListModule")]
|
||||
public class CachedItemsListModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CachedItemsListModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public CachedItemsListModule(IUnityContainer unityContainer)
|
||||
{
|
||||
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<ICachedItemsListView, CachedItemsListView>();
|
||||
_unityContainer.RegisterType<ICachedItemsListViewModel, CachedItemsListViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class CachedItemsListModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public CachedItemsListModuleNameAttribute() : this(null) { }
|
||||
|
||||
public CachedItemsListModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.CachedItemsList.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(TextAttribute);
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class CachedItemsListModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public CachedItemsListModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.CachedItemsList.ToString()); return _img; }
|
||||
}
|
||||
public CachedItemsListModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.CachedItemsList.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.CachedItemsList.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.CachedItemsListRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
using System;
|
||||
|
||||
namespace CachedItemsList.Model
|
||||
{
|
||||
public class CachedItem : ICachedItem
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string ObjectType { get; private set; }
|
||||
public DateTime CacheTime { get; private set; }
|
||||
/// <summary>
|
||||
/// DateTime.MinValue indicates no longer in db, otherwise
|
||||
/// the LastModified time in the db
|
||||
/// </summary>
|
||||
public DateTime DBTime { get; private set; }
|
||||
|
||||
public CachedItem(string name, string objectType, DateTime cacheTime, DateTime dbTime)
|
||||
{
|
||||
Name = name;
|
||||
ObjectType = objectType;
|
||||
CacheTime = cacheTime;
|
||||
DBTime = dbTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CachedItemsList")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("CachedItemsList")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("016e9db3-ef15-4c07-a46e-23f32804af42")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
26
DataPRO/Modules/TestSetups/CachedItemsList/Properties/Settings.Designer.cs
generated
Normal file
26
DataPRO/Modules/TestSetups/CachedItemsList/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CachedItemsList.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CachedItemsList.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
144
DataPRO/Modules/TestSetups/CachedItemsList/Resources/StringResources.Designer.cs
generated
Normal file
144
DataPRO/Modules/TestSetups/CachedItemsList/Resources/StringResources.Designer.cs
generated
Normal file
@@ -0,0 +1,144 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CachedItemsList.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CachedItemsList.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cache Time.
|
||||
/// </summary>
|
||||
internal static string CacheTime {
|
||||
get {
|
||||
return ResourceManager.GetString("CacheTime", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Db Time.
|
||||
/// </summary>
|
||||
internal static string DBTime {
|
||||
get {
|
||||
return ResourceManager.GetString("DBTime", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to [Deleted].
|
||||
/// </summary>
|
||||
internal static string Deleted {
|
||||
get {
|
||||
return ResourceManager.GetString("Deleted", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hardware.
|
||||
/// </summary>
|
||||
internal static string Hardware {
|
||||
get {
|
||||
return ResourceManager.GetString("Hardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
internal static string Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to (Type).
|
||||
/// </summary>
|
||||
internal static string ObjectType {
|
||||
get {
|
||||
return ResourceManager.GetString("ObjectType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Refresh.
|
||||
/// </summary>
|
||||
internal static string Prepare_TestSetups_EditTestSetup_Page_Update {
|
||||
get {
|
||||
return ResourceManager.GetString("Prepare_TestSetups_EditTestSetup_Page_Update", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sensor.
|
||||
/// </summary>
|
||||
internal static string Sensor {
|
||||
get {
|
||||
return ResourceManager.GetString("Sensor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sensor calibration.
|
||||
/// </summary>
|
||||
internal static string SensorCal {
|
||||
get {
|
||||
return ResourceManager.GetString("SensorCal", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CacheTime" xml:space="preserve">
|
||||
<value>Cache Time</value>
|
||||
</data>
|
||||
<data name="DBTime" xml:space="preserve">
|
||||
<value>Db Time</value>
|
||||
</data>
|
||||
<data name="Deleted" xml:space="preserve">
|
||||
<value>[Deleted]</value>
|
||||
</data>
|
||||
<data name="Hardware" xml:space="preserve">
|
||||
<value>Hardware</value>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="ObjectType" xml:space="preserve">
|
||||
<value>(Type)</value>
|
||||
</data>
|
||||
<data name="Prepare_TestSetups_EditTestSetup_Page_Update" xml:space="preserve">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
<data name="Sensor" xml:space="preserve">
|
||||
<value>Sensor</value>
|
||||
</data>
|
||||
<data name="SensorCal" xml:space="preserve">
|
||||
<value>Sensor calibration</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using CachedItemsList.Resources;
|
||||
|
||||
namespace CachedItemsList
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<base:BaseView x:Class="CachedItemsList.CachedItemsListView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:CachedItemsList"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<ListView ItemsSource="{Binding CachedItems, UpdateSourceTrigger=PropertyChanged}" AutomationProperties.AutomationId="CachedItemsListView" >
|
||||
<ListView.View>
|
||||
<GridView AutomationProperties.AutomationId="CachedItemsListGridView">
|
||||
<GridViewColumn AutomationProperties.AutomationId="Name">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="Name" Content="{strings:TranslateExtension Name}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding Name,FallbackValue='Name'}" AutomationProperties.AutomationId="NameLbl"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn AutomationProperties.AutomationId="ObjectType">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="ObjectType" Content="{strings:TranslateExtension ObjectType}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding ObjectType,FallbackValue='Type'}" AutomationProperties.AutomationId="ObjectTypeLbl"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn AutomationProperties.AutomationId="CacheTime">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="CacheTime" Content="{strings:TranslateExtension CacheTime}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding CacheTime,FallbackValue='CacheTime'}" AutomationProperties.AutomationId="CacheTimeLbl"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn AutomationProperties.AutomationId="DbTime">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Tag="DbTime" Content="{strings:TranslateExtension DBTime}" />
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding DBTime,FallbackValue='DBTime'}" AutomationProperties.AutomationId="DbTimeLbl" x:Name="DbTimeLbl"/>
|
||||
<ItemContainerTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding}" Value="{x:Static sys:DateTime.MinValue}">
|
||||
<Setter TargetName="DbTimeLbl" Property="Text" Value="{strings:TranslateExtension Deleted}" />
|
||||
</DataTrigger>
|
||||
</ItemContainerTemplate.Triggers>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,71 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace CachedItemsList
|
||||
{
|
||||
/// <inheritdoc cref="ICachedItemsListView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for CachedItemsListView.xaml
|
||||
/// </summary>
|
||||
public partial class CachedItemsListView : ICachedItemsListView
|
||||
{
|
||||
public CachedItemsListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
//private void ListViewHeader_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
//{
|
||||
// var colHeader = (GridViewColumnHeader)e.OriginalSource;
|
||||
// var viewModel = (ICachedItemsListViewModel)colHeader.DataContext;
|
||||
// viewModel.Sort(colHeader.Tag, true);
|
||||
//}
|
||||
|
||||
//private void MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
//{
|
||||
// var lv = sender as ListView;
|
||||
// if (null == lv)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// var index = GetCurrentIndex(e.GetPosition, lv);
|
||||
// if (index >= 0 && index < lv.Items.Count)
|
||||
// {
|
||||
// var vm = (ICachedItemsListViewModel) lv.DataContext;
|
||||
// vm.MouseDoubleClick(index);
|
||||
// }
|
||||
//}
|
||||
//delegate Point GetPositionDelegate(IInputElement element);
|
||||
//private int GetCurrentIndex(GetPositionDelegate getPosition, ListView lv)
|
||||
//{
|
||||
// int index = -1;
|
||||
// for (int i = 0; i < lv.Items.Count; i++)
|
||||
// {
|
||||
// ListViewItem item = GetListViewItem(i, lv);
|
||||
// if (item == null)
|
||||
// continue;
|
||||
// if (IsMouseOverTarget(item, getPosition))
|
||||
// {
|
||||
// index = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return index;
|
||||
//}
|
||||
//private ListViewItem GetListViewItem(int index, ListView lv)
|
||||
//{
|
||||
// return lv.ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem;
|
||||
//}
|
||||
//private bool IsMouseOverTarget(Visual target, GetPositionDelegate getPosition)
|
||||
//{
|
||||
// Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
|
||||
// Point mousePos = getPosition((IInputElement)target);
|
||||
// return bounds.Contains(mousePos);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,481 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface.TestSetups.CachedItemsList;
|
||||
using System;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using System.Linq;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace CachedItemsList
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles CachedItemsList functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class CachedItemsListViewModel : ICachedItemsListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The SensorList view
|
||||
/// </summary>
|
||||
public ICachedItemsListView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the CachedItemsListViewModel
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public CachedItemsListViewModel(ICachedItemsListView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Unset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
public bool SetCachedItems(ISensorData[] sensors, ISensorCalibration[] sensorCalibrations,
|
||||
IDASHardware[] hardware, IDASHardware[] allDAS)
|
||||
{
|
||||
return false;
|
||||
//var list = new List<ICachedItem>();
|
||||
|
||||
//#region SENSORS
|
||||
//var serialNumberToSensor = new Dictionary<string, ISensorData>();
|
||||
//var sensorsNeedingProcessing = new HashSet<string>();
|
||||
//foreach (var s in sensors)
|
||||
//{
|
||||
// serialNumberToSensor[s.SerialNumber] = s;
|
||||
// sensorsNeedingProcessing.Add(s.SerialNumber);
|
||||
//}
|
||||
|
||||
//#region Sensors IN DB
|
||||
|
||||
//#region analog
|
||||
|
||||
//var hr = DbOperations.SensorsAnalogGet(null, null, null, out var records);
|
||||
//if( 0 == hr && null != records && records.Any())
|
||||
//{
|
||||
// foreach( var record in records)
|
||||
// {
|
||||
// if (!sensorsNeedingProcessing.Contains(record.SerialNumber))
|
||||
// {
|
||||
// //either we didn't need to process this sensor, or we already have ...?
|
||||
// continue;
|
||||
// }
|
||||
// sensorsNeedingProcessing.Remove(record.SerialNumber);
|
||||
// var original = serialNumberToSensor[record.SerialNumber];
|
||||
// if (Math.Abs(record.LastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(record.SerialNumber, Resources.StringResources.Sensor,
|
||||
// original.LastModified, record.LastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region squib
|
||||
//hr = DbOperations.SensorsSquibGet(null, null, null, out var squibRecords);
|
||||
//if( 0 == hr && null != squibRecords && squibRecords.Any())
|
||||
//{
|
||||
// foreach( var squibRecord in squibRecords)
|
||||
// {
|
||||
// if( !sensorsNeedingProcessing.Contains(squibRecord.SerialNumber))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// sensorsNeedingProcessing.Remove(squibRecord.SerialNumber);
|
||||
// var original = serialNumberToSensor[squibRecord.SerialNumber];
|
||||
// var modifiedBy = squibRecord.LastModifiedBy;
|
||||
// var lastModified = squibRecord.LastModified;
|
||||
// if( Math.Abs(lastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(squibRecord.SerialNumber, Resources.StringResources.Sensor, original.LastModified, lastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region DigitalInputs
|
||||
//hr = DbOperations.SensorsDigitalInGet(null, null, null, out var digitalIns);
|
||||
//if (0 == hr && null != digitalIns && digitalIns.Any())
|
||||
//{
|
||||
// foreach( var digitalIn in digitalIns)
|
||||
// {
|
||||
// if (!sensorsNeedingProcessing.Contains(digitalIn.SerialNumber)) { continue; }
|
||||
// sensorsNeedingProcessing.Remove(digitalIn.SerialNumber);
|
||||
// var original = serialNumberToSensor[digitalIn.SerialNumber];
|
||||
// var lastModified = digitalIn.LastModified;
|
||||
// if (Math.Abs(lastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(digitalIn.SerialNumber, Resources.StringResources.Sensor, original.LastModified, lastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region DigitalOutputs
|
||||
//hr = DbOperations.SensorsDigitalOutGet(null, null, out var digitalOutRecords);
|
||||
//if (0 == hr && null != digitalOutRecords && digitalOutRecords.Any())
|
||||
//{
|
||||
// foreach( var record in digitalOutRecords)
|
||||
// {
|
||||
// if (!sensorsNeedingProcessing.Contains(record.SerialNumber))
|
||||
// {
|
||||
// //either we didn't need to process this sensor, or we already have ...?
|
||||
// continue;
|
||||
// }
|
||||
// sensorsNeedingProcessing.Remove(record.SerialNumber);
|
||||
// if (IsTestSpecificDigitalOutput(record.SerialNumber)) { continue; }
|
||||
// var original = serialNumberToSensor[record.SerialNumber];
|
||||
// var lastModified = record.LastModified;
|
||||
// if (Math.Abs(lastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(record.SerialNumber, Resources.StringResources.Sensor,
|
||||
// original.LastModified, lastModified));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#endregion SENSORS IN DB
|
||||
|
||||
//#region Sensors NOT IN DB
|
||||
|
||||
//using (var eSensors = sensorsNeedingProcessing.GetEnumerator())
|
||||
//{
|
||||
// while (eSensors.MoveNext())
|
||||
// {
|
||||
// var original = serialNumberToSensor[eSensors.Current];
|
||||
// list.Add(new CachedItem(eSensors.Current, Resources.StringResources.Sensor, original.LastModified,
|
||||
// DateTime.MinValue));
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
//#endregion SENSORS
|
||||
|
||||
//#region Hardware
|
||||
|
||||
//var serialNumberToHardware = new Dictionary<string, IDASHardware>();
|
||||
//var hardwareNeedingProcessing = new HashSet<string>();
|
||||
//foreach (var h in hardware)
|
||||
//{
|
||||
// serialNumberToHardware[h.SerialNumber] = h;
|
||||
// hardwareNeedingProcessing.Add(h.SerialNumber);
|
||||
//}
|
||||
|
||||
//#region Hardware In DB
|
||||
|
||||
//foreach (var das in allDAS)
|
||||
//{
|
||||
// if (!hardwareNeedingProcessing.Contains(das.SerialNumber))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// hardwareNeedingProcessing.Remove(das.SerialNumber);
|
||||
// var original = serialNumberToHardware[das.SerialNumber];
|
||||
// if (Math.Abs(das.LastModified.Subtract(original.LastModified).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(das.SerialNumber, Resources.StringResources.Hardware, original.LastModified,
|
||||
// das.LastModified));
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion Hardware In DB
|
||||
|
||||
//#region Hardware NOT IN DB
|
||||
|
||||
//using (var eHardware = hardwareNeedingProcessing.GetEnumerator())
|
||||
//{
|
||||
// while (eHardware.MoveNext())
|
||||
// {
|
||||
// var original = serialNumberToHardware[eHardware.Current];
|
||||
// list.Add(new CachedItem(original.SerialNumber, Resources.StringResources.Hardware,
|
||||
// original.LastModified, DateTime.MinValue));
|
||||
// }
|
||||
//}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#endregion Hardware
|
||||
|
||||
//#region Calibrations
|
||||
//var serialNumberToLastCalibration = new Dictionary<string, ISensorCalibration>();
|
||||
//var serialNumberToLastCalibrationInDb = new Dictionary<string, ISensorCalibration>();
|
||||
//var calsNeedingProcessing = new HashSet<string>();
|
||||
|
||||
//foreach (var cal in sensorCalibrations)
|
||||
//{
|
||||
// if (!calsNeedingProcessing.Contains(cal.SerialNumber))
|
||||
// {
|
||||
// calsNeedingProcessing.Add(cal.SerialNumber);
|
||||
// serialNumberToLastCalibration[cal.SerialNumber] = cal;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serialNumberToLastCalibration[cal.SerialNumber].CalibrationDate < cal.CalibrationDate)
|
||||
// {
|
||||
// serialNumberToLastCalibration[cal.SerialNumber] = cal;
|
||||
// }
|
||||
// else if (serialNumberToLastCalibration[cal.SerialNumber].CalibrationDate == cal.CalibrationDate &&
|
||||
// serialNumberToLastCalibration[cal.SerialNumber].ModifyDate < cal.ModifyDate)
|
||||
// {
|
||||
// serialNumberToLastCalibration[cal.SerialNumber] = cal;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//#region CalibrationsInDb
|
||||
//hr = DbOperations.SensorCalibrationsGet(null, null, out var calRecords);
|
||||
//if( 0 == hr && null != calRecords && calRecords.Any())
|
||||
//{
|
||||
// foreach( var record in calRecords)
|
||||
// {
|
||||
// var sc = new SensorCalibration(record);
|
||||
// if (!serialNumberToLastCalibration.ContainsKey(sc.SerialNumber))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// calsNeedingProcessing.Remove(sc.SerialNumber);
|
||||
// if (!serialNumberToLastCalibrationInDb.ContainsKey(sc.SerialNumber))
|
||||
// {
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber] = sc;
|
||||
// }
|
||||
// else if (serialNumberToLastCalibrationInDb[sc.SerialNumber].CalibrationDate <
|
||||
// sc.CalibrationDate)
|
||||
// {
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber] = sc;
|
||||
// }
|
||||
// else if (serialNumberToLastCalibrationInDb[sc.SerialNumber].CalibrationDate ==
|
||||
// sc.CalibrationDate &&
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber].ModifyDate < sc.ModifyDate)
|
||||
// {
|
||||
// serialNumberToLastCalibrationInDb[sc.SerialNumber] = sc;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//using (var eCals = serialNumberToLastCalibrationInDb.GetEnumerator())
|
||||
//{
|
||||
// while (eCals.MoveNext())
|
||||
// {
|
||||
// var original = serialNumberToLastCalibration[eCals.Current.Key];
|
||||
// var dbVersion = eCals.Current.Value;
|
||||
// if (original.CalibrationDate < dbVersion.CalibrationDate)
|
||||
// {
|
||||
// list.Add(new CachedItem(original.SerialNumber, Resources.StringResources.SensorCal,
|
||||
// original.ModifyDate, dbVersion.ModifyDate));
|
||||
// }
|
||||
// else if (original.CalibrationDate == dbVersion.CalibrationDate)
|
||||
// {
|
||||
// if (Math.Abs(dbVersion.ModifyDate.Subtract(original.ModifyDate).TotalSeconds) > 1)
|
||||
// {
|
||||
// list.Add(new CachedItem(original.SerialNumber, Resources.StringResources.SensorCal,
|
||||
// original.ModifyDate, dbVersion.ModifyDate));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
//#region Calibrations NOT IN DB
|
||||
|
||||
//using (var eCals = calsNeedingProcessing.GetEnumerator())
|
||||
//{
|
||||
// while (eCals.MoveNext())
|
||||
// {
|
||||
// var cal = serialNumberToLastCalibration[eCals.Current];
|
||||
// list.Add(new CachedItem(cal.SerialNumber, Resources.StringResources.SensorCal, cal.ModifyDate,
|
||||
// DateTime.MinValue));
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
//#endregion
|
||||
//CachedItems = list.ToArray();
|
||||
//OnPropertyChanged("CachedItems");
|
||||
//return list.Any();
|
||||
}
|
||||
|
||||
private static bool IsTestSpecificDigitalOutput(string serialNumber)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(serialNumber))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return serialNumber.StartsWith(TEST_SPECIFIC_DIGITAL_OUT);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constants and Enums
|
||||
|
||||
private const string TEST_SPECIFIC_DIGITAL_OUT = "TSD_";
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public ICachedItem[] CachedItems { get; set; } = new ICachedItem[0];
|
||||
|
||||
public bool IsDirty => false;
|
||||
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasOutofDateCachedItems => CachedItems.Any();
|
||||
|
||||
public bool HasMissingSensors
|
||||
{
|
||||
get
|
||||
{
|
||||
return CachedItems.Any() && Array.Exists(CachedItems, item => item.DBTime.Equals(DateTime.MinValue) && item.ObjectType == Resources.StringResources.Sensor);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
||||
Binary file not shown.
Binary file not shown.
1
DataPRO/Modules/TestSetups/Diagnostics/.svn/entries
Normal file
1
DataPRO/Modules/TestSetups/Diagnostics/.svn/entries
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
1
DataPRO/Modules/TestSetups/Diagnostics/.svn/format
Normal file
1
DataPRO/Modules/TestSetups/Diagnostics/.svn/format
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using Diagnostics.Resources;
|
||||
|
||||
namespace Diagnostics
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Diagnostics.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Diagnostics.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Diagnostics.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Diagnostics.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Channels.
|
||||
/// </summary>
|
||||
internal static string Channels {
|
||||
get {
|
||||
return ResourceManager.GetString("Channels", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Details.
|
||||
/// </summary>
|
||||
internal static string Details {
|
||||
get {
|
||||
return ResourceManager.GetString("Details", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Group(s).
|
||||
/// </summary>
|
||||
internal static string Groups {
|
||||
get {
|
||||
return ResourceManager.GetString("Groups", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hardware.
|
||||
/// </summary>
|
||||
internal static string Hardware {
|
||||
get {
|
||||
return ResourceManager.GetString("Hardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<base:BaseView x:Class="Diagnostics.DiagnosticsTreeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:behaviors="clr-namespace:DTS.Common.Behaviors;assembly=DTS.Common"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:Diagnostics"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyleWithToolTip}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{strings:TranslateExtension Groups}" />
|
||||
<Label Grid.Row="0" Grid.Column="1" Content="{strings:TranslateExtension Hardware}" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="{strings:TranslateExtension Channels}" />
|
||||
<Label Grid.Row="0" Grid.Column="3" Content="{strings:TranslateExtension Details}" />
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.TestSetups.Diagnostics;
|
||||
using Diagnostics;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: DiagnosticsModuleName]
|
||||
[assembly: DiagnosticsModuleImageAttribute]
|
||||
namespace Diagnostics
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "DiagnosticsModule")]
|
||||
public class DiagnosticsModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DiagnosticsModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public DiagnosticsModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<IDiagnosticsTreeView, DiagnosticsTreeView>();
|
||||
_unityContainer.RegisterType<IDiagnosticsViewModel, DiagnosticsViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class DiagnosticsModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public DiagnosticsModuleNameAttribute() : this(null) { }
|
||||
|
||||
public DiagnosticsModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.Diagnostics.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(TextAttribute);
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class DiagnosticsModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public DiagnosticsModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.Diagnostics.ToString()); return _img; }
|
||||
}
|
||||
public DiagnosticsModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.Diagnostics.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.Diagnostics.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.DiagnosticsRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interactivity;
|
||||
using DTS.Common.Interface.TestSetups.Diagnostics;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Diagnostics functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class DiagnosticsViewModel : IDiagnosticsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The DiagnosticsTreeView
|
||||
/// </summary>
|
||||
public IDiagnosticsTreeView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the DiagnosticsViewModel
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public DiagnosticsViewModel(IDiagnosticsTreeView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
TreeView = view;
|
||||
TreeView.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Unset()
|
||||
{
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public IDiagnosticsTreeView TreeView { get; set; }
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{177E39CC-6F94-4F22-9881-3E477B0AEE80}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Diagnostics</RootNamespace>
|
||||
<AssemblyName>Diagnostics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.Xaml.Behaviors">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.Abstractions">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DiagnosticsModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\DiagnosticsViewModel.cs" />
|
||||
<Compile Include="View\DiagnosticsTreeView.xaml.cs">
|
||||
<DependentUpon>DiagnosticsTreeView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
|
||||
<Project>{03eace47-ea59-44ac-b49d-956e4dc4d618}</Project>
|
||||
<Name>DTS.Common.Utilities</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\DiagnosticsTreeView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="Diagnostics.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<Diagnostics.Properties.Settings>
|
||||
</Diagnostics.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Diagnostics")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("Diagnostics")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("c91752c2-0792-475c-be1e-bc1aff79e56e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Channels" xml:space="preserve">
|
||||
<value>Channels</value>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>Details</value>
|
||||
</data>
|
||||
<data name="Groups" xml:space="preserve">
|
||||
<value>Group(s)</value>
|
||||
</data>
|
||||
<data name="Hardware" xml:space="preserve">
|
||||
<value>Hardware</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using DTS.Common.Interface.TestSetups.Diagnostics;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace Diagnostics
|
||||
{
|
||||
/// <inheritdoc cref="IDiagnosticsTreeView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for DiagnosticsTreeView.xaml
|
||||
/// </summary>
|
||||
public partial class DiagnosticsTreeView : IDiagnosticsTreeView
|
||||
{
|
||||
public DiagnosticsTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DataPRO/Modules/TestSetups/Diagnostics/.svn/wc.db
Normal file
BIN
DataPRO/Modules/TestSetups/Diagnostics/.svn/wc.db
Normal file
Binary file not shown.
12
DataPRO/Modules/TestSetups/Diagnostics/App.config
Normal file
12
DataPRO/Modules/TestSetups/Diagnostics/App.config
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="Diagnostics.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<Diagnostics.Properties.Settings>
|
||||
</Diagnostics.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
152
DataPRO/Modules/TestSetups/Diagnostics/Diagnostics.csproj
Normal file
152
DataPRO/Modules/TestSetups/Diagnostics/Diagnostics.csproj
Normal file
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{177E39CC-6F94-4F22-9881-3E477B0AEE80}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Diagnostics</RootNamespace>
|
||||
<AssemblyName>Diagnostics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.Xaml.Behaviors">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.Abstractions">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DiagnosticsModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\DiagnosticsViewModel.cs" />
|
||||
<Compile Include="View\DiagnosticsTreeView.xaml.cs">
|
||||
<DependentUpon>DiagnosticsTreeView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
|
||||
<Project>{03eace47-ea59-44ac-b49d-956e4dc4d618}</Project>
|
||||
<Name>DTS.Common.Utilities</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\DiagnosticsTreeView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
138
DataPRO/Modules/TestSetups/Diagnostics/DiagnosticsModule.cs
Normal file
138
DataPRO/Modules/TestSetups/Diagnostics/DiagnosticsModule.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.TestSetups.Diagnostics;
|
||||
using Diagnostics;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: DiagnosticsModuleName]
|
||||
[assembly: DiagnosticsModuleImageAttribute]
|
||||
namespace Diagnostics
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "DiagnosticsModule")]
|
||||
public class DiagnosticsModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DiagnosticsModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public DiagnosticsModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<IDiagnosticsTreeView, DiagnosticsTreeView>();
|
||||
_unityContainer.RegisterType<IDiagnosticsViewModel, DiagnosticsViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class DiagnosticsModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public DiagnosticsModuleNameAttribute() : this(null) { }
|
||||
|
||||
public DiagnosticsModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.Diagnostics.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(TextAttribute);
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class DiagnosticsModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public DiagnosticsModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.Diagnostics.ToString()); return _img; }
|
||||
}
|
||||
public DiagnosticsModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.Diagnostics.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.Diagnostics.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.DiagnosticsRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Diagnostics")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("Diagnostics")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("c91752c2-0792-475c-be1e-bc1aff79e56e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
26
DataPRO/Modules/TestSetups/Diagnostics/Properties/Settings.Designer.cs
generated
Normal file
26
DataPRO/Modules/TestSetups/Diagnostics/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Diagnostics.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Diagnostics.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
99
DataPRO/Modules/TestSetups/Diagnostics/Resources/StringResources.Designer.cs
generated
Normal file
99
DataPRO/Modules/TestSetups/Diagnostics/Resources/StringResources.Designer.cs
generated
Normal file
@@ -0,0 +1,99 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Diagnostics.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Diagnostics.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Channels.
|
||||
/// </summary>
|
||||
internal static string Channels {
|
||||
get {
|
||||
return ResourceManager.GetString("Channels", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Details.
|
||||
/// </summary>
|
||||
internal static string Details {
|
||||
get {
|
||||
return ResourceManager.GetString("Details", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Group(s).
|
||||
/// </summary>
|
||||
internal static string Groups {
|
||||
get {
|
||||
return ResourceManager.GetString("Groups", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hardware.
|
||||
/// </summary>
|
||||
internal static string Hardware {
|
||||
get {
|
||||
return ResourceManager.GetString("Hardware", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Channels" xml:space="preserve">
|
||||
<value>Channels</value>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>Details</value>
|
||||
</data>
|
||||
<data name="Groups" xml:space="preserve">
|
||||
<value>Group(s)</value>
|
||||
</data>
|
||||
<data name="Hardware" xml:space="preserve">
|
||||
<value>Hardware</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using Diagnostics.Resources;
|
||||
|
||||
namespace Diagnostics
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<base:BaseView x:Class="Diagnostics.DiagnosticsTreeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:behaviors="clr-namespace:DTS.Common.Behaviors;assembly=DTS.Common"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:Diagnostics"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyleWithToolTip}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{strings:TranslateExtension Groups}" />
|
||||
<Label Grid.Row="0" Grid.Column="1" Content="{strings:TranslateExtension Hardware}" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="{strings:TranslateExtension Channels}" />
|
||||
<Label Grid.Row="0" Grid.Column="3" Content="{strings:TranslateExtension Details}" />
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using DTS.Common.Interface.TestSetups.Diagnostics;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace Diagnostics
|
||||
{
|
||||
/// <inheritdoc cref="IDiagnosticsTreeView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for DiagnosticsTreeView.xaml
|
||||
/// </summary>
|
||||
public partial class DiagnosticsTreeView : IDiagnosticsTreeView
|
||||
{
|
||||
public DiagnosticsTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interactivity;
|
||||
using DTS.Common.Interface.TestSetups.Diagnostics;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Diagnostics functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class DiagnosticsViewModel : IDiagnosticsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The DiagnosticsTreeView
|
||||
/// </summary>
|
||||
public IDiagnosticsTreeView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the DiagnosticsViewModel
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public DiagnosticsViewModel(IDiagnosticsTreeView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
TreeView = view;
|
||||
TreeView.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Unset()
|
||||
{
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public IDiagnosticsTreeView TreeView { get; set; }
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
||||
Binary file not shown.
Binary file not shown.
1
DataPRO/Modules/TestSetups/Imports/TTS/.svn/entries
Normal file
1
DataPRO/Modules/TestSetups/Imports/TTS/.svn/entries
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
1
DataPRO/Modules/TestSetups/Imports/TTS/.svn/format
Normal file
1
DataPRO/Modules/TestSetups/Imports/TTS/.svn/format
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Interface;
|
||||
|
||||
namespace TTSImport.Model
|
||||
{
|
||||
public class SummaryChannel : ISummaryChannel
|
||||
{
|
||||
private string _channelType = string.Empty;
|
||||
public string ChannelType { get => _channelType; set { _channelType = value; OnPropertyChanged("ChannelType"); } }
|
||||
|
||||
private int _assigned;
|
||||
public int Assigned { get => _assigned; set { _assigned = value; OnPropertyChanged("Assigned"); } }
|
||||
|
||||
private string _unassigned = string.Empty;
|
||||
public string Unassigned { get => _unassigned; set { _unassigned = value; OnPropertyChanged("Unassigned"); } }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Events.TTSImport;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
using TTSImport.Model;
|
||||
using TTSImport.Resources;
|
||||
using DTS.DASLib.Service;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Level Trigger edit/create functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class TOMChannelsViewModel : ITOMChannelsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public ITOMChannelsView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="view">The ITOMChannelsView.</param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public TOMChannelsViewModel(ITOMChannelsView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<AssignedChannelsChangedEvent>().Subscribe(OnAssignedChannelsChangedEvent,
|
||||
ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanFinishedEvent>()
|
||||
.Subscribe(OnHardwareScanComplete, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportReadFileStatusEvent>().Subscribe(OnReadFileFinished, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
private void OnReadFileFinished(ReadFileStatusArg statusArg)
|
||||
{
|
||||
_setup = statusArg.TTSSetup;
|
||||
_hardware = null;
|
||||
}
|
||||
private void OnHardwareScanComplete(List<IDASHardware> hardware)
|
||||
{
|
||||
_hardware = hardware;
|
||||
}
|
||||
|
||||
private void OnAssignedChannelsChangedEvent(ITTSSetup setup)
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
OnAssignedChannelsChangedEvent(setup);
|
||||
}));
|
||||
return;
|
||||
}
|
||||
_setup = setup;
|
||||
if (null == _hardware || null == _setup) { return; }
|
||||
var channels = new ObservableCollection<Model.DASChannel>();
|
||||
var remainingChannels = new ObservableCollection<ITTSChannelRecord>();
|
||||
var channelIdToChannel = new Dictionary<string, Model.DASChannel>();
|
||||
foreach (var das in _hardware)
|
||||
{
|
||||
var ichannels = das.GetIHardwareChannels();
|
||||
for (var i = 0; i < ichannels.Length; i += 2)
|
||||
{
|
||||
var ch = ichannels[i];
|
||||
if (!ch.IsSquib) { continue; }
|
||||
var newChannel = new Model.DASChannel(ch);
|
||||
channels.Add(newChannel);
|
||||
channelIdToChannel[ch.GetId()] = newChannel;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var channelRecord in _setup.Channels)
|
||||
{
|
||||
if (channelRecord.IsEmptyRecord)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!channelRecord.IsSquib)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!channelRecord.IsChannelCodeValid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (channelRecord.ChannelCode == TTSChannelRecord.NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (null != channelRecord.HardwareChannel)
|
||||
{
|
||||
if (channelIdToChannel.ContainsKey(channelRecord.HardwareChannel.GetId()))
|
||||
{
|
||||
channelIdToChannel[channelRecord.HardwareChannel.GetId()].SetITTSChannelRecord(channelRecord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
remainingChannels.Add(channelRecord);
|
||||
}
|
||||
}
|
||||
|
||||
DASChannels = channels;
|
||||
RemainingChannels = remainingChannels;
|
||||
OnPropertyChanged("DASChannels");
|
||||
OnPropertyChanged("RemainingChannels");
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private ITTSSetup _setup;
|
||||
private IList<IDASHardware> _hardware;
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
public bool AssignEnabled { get; set; }
|
||||
public bool RemoveEnabled { get; set; }
|
||||
public bool EnableOrDisableEnabled { get; set; }
|
||||
public ObservableCollection<Model.DASChannel> DASChannels { get; set; } = new ObservableCollection<Model.DASChannel>();
|
||||
public ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; } =
|
||||
new ObservableCollection<ITTSChannelRecord>();
|
||||
|
||||
private ITTSChannelRecord _selectedRemainingChannel;
|
||||
public ITTSChannelRecord SelectedRemainingChannel
|
||||
{
|
||||
get => _selectedRemainingChannel;
|
||||
set
|
||||
{
|
||||
_selectedRemainingChannel = value;
|
||||
if (null == _selectedRemainingChannel || null == SelectedDASChannel) return;
|
||||
AssignEnabled = true;
|
||||
OnPropertyChanged("AssignEnabled");
|
||||
}
|
||||
}
|
||||
private void DetermineRemoveEnableStatus()
|
||||
{
|
||||
if (_selectedDASChannel?.Channel != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_selectedDASChannel.EID) &&
|
||||
_selectedDASChannel.EID == _selectedDASChannel.Channel.SensorEID)
|
||||
{
|
||||
//can only be replaced, can't be removed
|
||||
RemoveEnabled = false;
|
||||
}
|
||||
RemoveEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveEnabled = false;
|
||||
}
|
||||
OnPropertyChanged("RemoveEnabled");
|
||||
AssignEnabled = null != _selectedDASChannel && null != _selectedRemainingChannel;
|
||||
OnPropertyChanged("AssignEnabled");
|
||||
EnableOrDisableEnabled = _selectedDASChannel?.Channel != null;
|
||||
OnPropertyChanged("EnableOrDisableEnabled");
|
||||
OnPropertyChanged("EnableOrDisableText");
|
||||
}
|
||||
private Model.DASChannel _selectedDASChannel;
|
||||
public Model.DASChannel SelectedDASChannel
|
||||
{
|
||||
get => _selectedDASChannel;
|
||||
set
|
||||
{
|
||||
_selectedDASChannel = value;
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public string EnableOrDisableText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null)
|
||||
{
|
||||
return StringResources.Analog_Enable;
|
||||
}
|
||||
return SelectedDASChannel.Channel.Disabled
|
||||
? StringResources.Analog_Enable
|
||||
: StringResources.Analog_Disable;
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
#region assign
|
||||
/// <summary>
|
||||
/// Assign a channel code to a channel
|
||||
/// </summary>
|
||||
private DelegateCommand _assignCommand;
|
||||
public DelegateCommand AssignCommand => _assignCommand ?? (_assignCommand = new DelegateCommand(Assign));
|
||||
private void Assign()
|
||||
{
|
||||
if (SelectedRemainingChannel == null) { return; }
|
||||
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
//BEFORE we go any further, check the state of sensor ids
|
||||
//if the channel has a sensor id AND there's a sensor on the channel with the same id
|
||||
//then prompt on replacing the id
|
||||
//IF the channel has a sensor id and there's no sensor on the channel BUT the new sensor has a different id
|
||||
//then prompt on replacing the id
|
||||
var bReplacingID = false;
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
if (null != SelectedRemainingChannel && SelectedRemainingChannel.SensorEID != SelectedDASChannel.EID)
|
||||
{
|
||||
bReplacingID = true;
|
||||
}
|
||||
//if existing channel has this ID, we will need to clear out the old id and assign a new one...
|
||||
if (null != SelectedDASChannel.Channel && SelectedDASChannel.Channel.SensorEID == SelectedDASChannel.EID)
|
||||
{
|
||||
bReplacingID = true;
|
||||
}
|
||||
}
|
||||
if (bReplacingID)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var dialogResult = MessageBox.Show(StringResources.AssignSensorPrompt, StringResources.UserFeedbackRequired, MessageBoxButton.YesNo);
|
||||
if (dialogResult == MessageBoxResult.Yes)
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(AssignWork));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
AssignWork();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// assigns a channel record to a physical channel
|
||||
/// </summary>
|
||||
private void AssignWork()
|
||||
{
|
||||
if (null != SelectedDASChannel.Channel)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
SelectedDASChannel.Channel.SensorEID = "";
|
||||
}
|
||||
RemainingChannels.Add(SelectedDASChannel.Channel);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
SelectedRemainingChannel.SensorEID = SelectedDASChannel.EID;
|
||||
}
|
||||
|
||||
SelectedDASChannel.SetITTSChannelRecord(SelectedRemainingChannel);
|
||||
|
||||
var channel = SelectedRemainingChannel;
|
||||
var index = RemainingChannels.IndexOf(channel);
|
||||
SelectedRemainingChannel = null;
|
||||
RemainingChannels.Remove(channel);
|
||||
if (index < RemainingChannels.Count)
|
||||
{
|
||||
SelectedRemainingChannel = RemainingChannels[index];
|
||||
OnPropertyChanged("SelectedRemainingChannel");
|
||||
}
|
||||
else if (RemainingChannels.Count > 0)
|
||||
{
|
||||
SelectedRemainingChannel = RemainingChannels[index - 1];
|
||||
OnPropertyChanged("SelectedRemainingChannel");
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
index = DASChannels.IndexOf(SelectedDASChannel);
|
||||
for (var i = index; i < DASChannels.Count; i++)
|
||||
{
|
||||
var dasChannel = DASChannels[i];
|
||||
if (null != dasChannel.Channel) { continue; }
|
||||
SelectedDASChannel = dasChannel;
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//didn't find a match, start from the beginning?
|
||||
for (var i = 0; i < index; i++)
|
||||
{
|
||||
var dasChannel = DASChannels[i];
|
||||
if (null != dasChannel.Channel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SelectedDASChannel = dasChannel;
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//if we get here there's no new channel to go to, but we need to set the remove/enable/disable button status
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
#endregion
|
||||
#region remove
|
||||
private DelegateCommand _removeCommand;
|
||||
public DelegateCommand RemoveCommand => _removeCommand ?? (_removeCommand = new DelegateCommand(Remove));
|
||||
/// <summary>
|
||||
/// remove a hardware channel assignment (does not remove the channel from the test setup though?)
|
||||
/// </summary>
|
||||
private void Remove()
|
||||
{
|
||||
if (null == SelectedDASChannel || null == SelectedDASChannel.Channel) { return; }
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
RemainingChannels.Add(SelectedDASChannel.Channel);
|
||||
SelectedDASChannel.SetITTSChannelRecord(null);
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
var index = DASChannels.IndexOf(SelectedDASChannel);
|
||||
for (var i = index; i < DASChannels.Count; i++)
|
||||
{
|
||||
if (null == DASChannels[i].Channel) { continue; }
|
||||
SelectedDASChannel = DASChannels[i];
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < index; i++)
|
||||
{
|
||||
if (null == DASChannels[i].Channel) { continue; }
|
||||
SelectedDASChannel = DASChannels[i];
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//if we get here there's no new channel to go to, but we need to set the remove/enable/disable button status
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
#endregion
|
||||
#region enableordisable
|
||||
private DelegateCommand _enableOrDisableCommand;
|
||||
public DelegateCommand EnableOrDisableCommand =>
|
||||
_enableOrDisableCommand ?? (_enableOrDisableCommand = new DelegateCommand(EnableOrDisable));
|
||||
/// <summary>
|
||||
/// enables or disables a channel in the test.
|
||||
/// </summary>
|
||||
private void EnableOrDisable()
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null) { return; }
|
||||
SelectedDASChannel.Channel.Disabled = !SelectedDASChannel.Channel.Disabled;
|
||||
SelectedDASChannel.Disabled = SelectedDASChannel.Channel.Disabled;
|
||||
|
||||
OnPropertyChanged("EnableOrDisableText");
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,438 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Added" xml:space="preserve">
|
||||
<value>Added</value>
|
||||
</data>
|
||||
<data name="Analog_Assign" xml:space="preserve">
|
||||
<value>適用</value>
|
||||
</data>
|
||||
<data name="Analog_Disable" xml:space="preserve">
|
||||
<value>無効</value>
|
||||
</data>
|
||||
<data name="Analog_Enable" xml:space="preserve">
|
||||
<value>有効</value>
|
||||
</data>
|
||||
<data name="Analog_Remove" xml:space="preserve">
|
||||
<value>削除</value>
|
||||
</data>
|
||||
<data name="Assigned" xml:space="preserve">
|
||||
<value>アサイン</value>
|
||||
</data>
|
||||
<data name="BatteryVoltageStatusColumn" xml:space="preserve">
|
||||
<value>バッテリーステータス</value>
|
||||
</data>
|
||||
<data name="Browse" xml:space="preserve">
|
||||
<value>フォルダの参照</value>
|
||||
</data>
|
||||
<data name="CableMultiplier" xml:space="preserve">
|
||||
<value>ケーブル長補正</value>
|
||||
</data>
|
||||
<data name="Capacity" xml:space="preserve">
|
||||
<value>定格容量</value>
|
||||
</data>
|
||||
<data name="CHAN" xml:space="preserve">
|
||||
<value>DAS CH</value>
|
||||
</data>
|
||||
<data name="ChannelType" xml:space="preserve">
|
||||
<value>CH 種類</value>
|
||||
</data>
|
||||
<data name="Channel_Summary" xml:space="preserve">
|
||||
<value>チャンネル 一覧</value>
|
||||
</data>
|
||||
<data name="Code" xml:space="preserve">
|
||||
<value>CH名</value>
|
||||
</data>
|
||||
<data name="DASChannel" xml:space="preserve">
|
||||
<value>DAS CH</value>
|
||||
</data>
|
||||
<data name="DASChannels" xml:space="preserve">
|
||||
<value>DAS チャンネル</value>
|
||||
</data>
|
||||
<data name="DASSerial" xml:space="preserve">
|
||||
<value>DAS シリアル番号</value>
|
||||
</data>
|
||||
<data name="DAS_Summary" xml:space="preserve">
|
||||
<value>DAS 一覧</value>
|
||||
</data>
|
||||
<data name="EID" xml:space="preserve">
|
||||
<value>EID</value>
|
||||
</data>
|
||||
<data name="EIDFound" xml:space="preserve">
|
||||
<value>EID 数</value>
|
||||
</data>
|
||||
<data name="EULabel" xml:space="preserve">
|
||||
<value>単位</value>
|
||||
</data>
|
||||
<data name="HWSerialNumber" xml:space="preserve">
|
||||
<value>HW SN</value>
|
||||
</data>
|
||||
<data name="Import" xml:space="preserve">
|
||||
<value>xml 保存</value>
|
||||
</data>
|
||||
<data name="ImportFile" xml:space="preserve">
|
||||
<value>入力ファイルの選択</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_PossibleStatus_Done" xml:space="preserve">
|
||||
<value>完了</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_PossibleStatus_Failed" xml:space="preserve">
|
||||
<value>Failed</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_PossibleStatus_Working" xml:space="preserve">
|
||||
<value>処理中</value>
|
||||
</data>
|
||||
<data name="InputVoltageStatusColumn" xml:space="preserve">
|
||||
<value>入力電圧ステータス</value>
|
||||
</data>
|
||||
<data name="JCode" xml:space="preserve">
|
||||
<value>センサー詳細</value>
|
||||
</data>
|
||||
<data name="Mode" xml:space="preserve">
|
||||
<value>モード</value>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="NONE" xml:space="preserve">
|
||||
<value>-----</value>
|
||||
</data>
|
||||
<data name="Polarity" xml:space="preserve">
|
||||
<value>±</value>
|
||||
</data>
|
||||
<data name="PostTrigger" xml:space="preserve">
|
||||
<value>トリガー後 (sec)</value>
|
||||
</data>
|
||||
<data name="PreTrigger" xml:space="preserve">
|
||||
<value>トリガー前 (sec)</value>
|
||||
</data>
|
||||
<data name="Range" xml:space="preserve">
|
||||
<value>要求レンジ</value>
|
||||
</data>
|
||||
<data name="RemainingChannels" xml:space="preserve">
|
||||
<value>未処理チャンネル</value>
|
||||
</data>
|
||||
<data name="Requested" xml:space="preserve">
|
||||
<value>要求チャンネル</value>
|
||||
</data>
|
||||
<data name="RunTest" xml:space="preserve">
|
||||
<value>試験実施</value>
|
||||
</data>
|
||||
<data name="SampleRate" xml:space="preserve">
|
||||
<value>サンプル周波数 (per sec)</value>
|
||||
</data>
|
||||
<data name="Sens" xml:space="preserve">
|
||||
<value>校正値</value>
|
||||
</data>
|
||||
<data name="SensorSN" xml:space="preserve">
|
||||
<value>センサー SN</value>
|
||||
</data>
|
||||
<data name="SerialNumber" xml:space="preserve">
|
||||
<value>センサー SN</value>
|
||||
</data>
|
||||
<data name="TestLength" xml:space="preserve">
|
||||
<value>試験時間 (sec)</value>
|
||||
</data>
|
||||
<data name="TestSetupName" xml:space="preserve">
|
||||
<value>テストセットアップ名:</value>
|
||||
</data>
|
||||
<data name="ToyotaCode" xml:space="preserve">
|
||||
<value>Toyota Code</value>
|
||||
</data>
|
||||
<data name="Type" xml:space="preserve">
|
||||
<value>CH 種類</value>
|
||||
</data>
|
||||
<data name="Unassigned" xml:space="preserve">
|
||||
<value>未アサイン</value>
|
||||
</data>
|
||||
<data name="ValueEU" xml:space="preserve">
|
||||
<value>VAL (EU)</value>
|
||||
</data>
|
||||
<data name="ValuePercent" xml:space="preserve">
|
||||
<value>VAL (%)</value>
|
||||
</data>
|
||||
<data name="AssignSensorPrompt" xml:space="preserve">
|
||||
<value>Assign sensor? ID on the channel will be applied to the sensor and removed from any other sensors.</value>
|
||||
</data>
|
||||
<data name="UserFeedbackRequired" xml:space="preserve">
|
||||
<value>User feedback required</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>電流 (amp)</value>
|
||||
</data>
|
||||
<data name="Delay" xml:space="preserve">
|
||||
<value>遅延時間 (ms)</value>
|
||||
</data>
|
||||
<data name="Duration" xml:space="preserve">
|
||||
<value>持続時間 (ms)</value>
|
||||
</data>
|
||||
<data name="LimitDuration" xml:space="preserve">
|
||||
<value>持続時間制限</value>
|
||||
</data>
|
||||
<data name="ResHighTolerance" xml:space="preserve">
|
||||
<value>抵抗値 上限. (Ω)</value>
|
||||
</data>
|
||||
<data name="ResLowTolerance" xml:space="preserve">
|
||||
<value>抵抗値 加減. (Ω)</value>
|
||||
</data>
|
||||
<data name="CH" xml:space="preserve">
|
||||
<value>CH</value>
|
||||
</data>
|
||||
<data name="EditFile_AddCode" xml:space="preserve">
|
||||
<value>CH名追加</value>
|
||||
</data>
|
||||
<data name="EditFile_DeleteCode" xml:space="preserve">
|
||||
<value>CH名削除</value>
|
||||
</data>
|
||||
<data name="EditFile_Replace" xml:space="preserve">
|
||||
<value>センサー交換</value>
|
||||
</data>
|
||||
<data name="Filter" xml:space="preserve">
|
||||
<value>ソフトウエアフィルター</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_MustBeCSVOrXML" xml:space="preserve">
|
||||
<value>TTS import requires either .csv or .xml input file</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_NoOriginalCSV" xml:space="preserve">
|
||||
<value>TTS import requires a .csv filename in the OriginalImportFile attribute</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_UnexpectedZeroMethod" xml:space="preserve">
|
||||
<value>is an unexpected zero method type. Only None, AverageOverTime, and UsePreEventDiagnosticsZero are allowed</value>
|
||||
</data>
|
||||
<data name="JHyphenCode" xml:space="preserve">
|
||||
<value>センサー詳細</value>
|
||||
</data>
|
||||
<data name="NumChannelsAndSensors" xml:space="preserve">
|
||||
<value>要求チャンネル数:{0}, 予備センサー数:{1}</value>
|
||||
</data>
|
||||
<data name="SaveFile" xml:space="preserve">
|
||||
<value>ファイル保存</value>
|
||||
</data>
|
||||
<data name="Search" xml:space="preserve">
|
||||
<value>検索</value>
|
||||
</data>
|
||||
<data name="TestName" xml:space="preserve">
|
||||
<value>試験No</value>
|
||||
</data>
|
||||
<data name="Table_NA" xml:space="preserve">
|
||||
<value>---</value>
|
||||
</data>
|
||||
<data name="Analog" xml:space="preserve">
|
||||
<value>アナログ</value>
|
||||
</data>
|
||||
<data name="DigitalIn" xml:space="preserve">
|
||||
<value>Digital In</value>
|
||||
</data>
|
||||
<data name="TOM" xml:space="preserve">
|
||||
<value>TOM</value>
|
||||
</data>
|
||||
<data name="AllowEIDToBlankChannelChallenge" xml:space="preserve">
|
||||
<value>The sensor {0} has an EID, but no EID was found.\r\n\r\nPress OK to clear the EID for {0} and assign the sensor.\r\nPress Cancel to leave the EID unchanged and the sensor unassigned.</value>
|
||||
</data>
|
||||
<data name="ROIEnd" xml:space="preserve">
|
||||
<value>ダウンロード終了時間 (sec)</value>
|
||||
</data>
|
||||
<data name="ROIStart" xml:space="preserve">
|
||||
<value>ダウンロード開始時間 (sec)</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_DuplicateSensorSerialNumber" xml:space="preserve">
|
||||
<value>{0} が2箇所以上あります。</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_DuplicateChannelCode" xml:space="preserve">
|
||||
<value>{0} が2箇所以上あります。</value>
|
||||
</data>
|
||||
<data name="ImportTestSetup_DuplicateDescription" xml:space="preserve">
|
||||
<value>{0} が2箇所以上あります。</value>
|
||||
</data>
|
||||
<data name="DIn" xml:space="preserve">
|
||||
<value>D In</value>
|
||||
</data>
|
||||
<data name="DOut" xml:space="preserve">
|
||||
<value>D Out</value>
|
||||
</data>
|
||||
<data name="ECM" xml:space="preserve">
|
||||
<value>ECM</value>
|
||||
</data>
|
||||
<data name="G5" xml:space="preserve">
|
||||
<value>G5</value>
|
||||
</data>
|
||||
<data name="Rack" xml:space="preserve">
|
||||
<value>Rack</value>
|
||||
</data>
|
||||
<data name="SPD" xml:space="preserve">
|
||||
<value>SPD</value>
|
||||
</data>
|
||||
<data name="SPS" xml:space="preserve">
|
||||
<value>SPS</value>
|
||||
</data>
|
||||
<data name="SPT" xml:space="preserve">
|
||||
<value>SPT</value>
|
||||
</data>
|
||||
<data name="Squib" xml:space="preserve">
|
||||
<value>スクイブ</value>
|
||||
</data>
|
||||
<data name="Total" xml:space="preserve">
|
||||
<value>合計</value>
|
||||
</data>
|
||||
<data name="Units" xml:space="preserve">
|
||||
<value>単位</value>
|
||||
</data>
|
||||
<data name="AssignSensorExcitationError" xml:space="preserve">
|
||||
<value>Sensor Assignment Error</value>
|
||||
</data>
|
||||
<data name="InvalidExcitationAssignment" xml:space="preserve">
|
||||
<value>{0} V 印加電圧をサポートしていません。</value>
|
||||
</data>
|
||||
<data name="MissingECMSWarning" xml:space="preserve">
|
||||
<value>以下の IP Addresses の機器は応答していません. 対象機器を再起動してください。</value>
|
||||
</data>
|
||||
<data name="Warning" xml:space="preserve">
|
||||
<value>警告!</value>
|
||||
</data>
|
||||
<data name="EmptyChannelCodeWarning" xml:space="preserve">
|
||||
<value>Non empty channel codes are required, please complete channel codes to continue</value>
|
||||
</data>
|
||||
<data name="TestId" xml:space="preserve">
|
||||
<value>試験番号</value>
|
||||
</data>
|
||||
<data name="TESTID_PREFIX_SUFFIX_None" xml:space="preserve">
|
||||
<value>[-----]</value>
|
||||
</data>
|
||||
<data name="TESTID_PREFIX_SUFFIX_TestSetupName" xml:space="preserve">
|
||||
<value>[テストセットアップ名]</value>
|
||||
</data>
|
||||
<data name="TESTID_PREFIX_SUFFIX_TimeStamp" xml:space="preserve">
|
||||
<value>[タイムスタンプ]</value>
|
||||
</data>
|
||||
<data name="EditFile_ADDDI" xml:space="preserve">
|
||||
<value>DI追加</value>
|
||||
</data>
|
||||
<data name="EditFile_AddSquib" xml:space="preserve">
|
||||
<value>スクイブ追加</value>
|
||||
</data>
|
||||
<data name="AAF_SLICE" xml:space="preserve">
|
||||
<value>アンチエイリアスフィルター SLICE : {0}</value>
|
||||
</data>
|
||||
<data name="AAF_TDAS" xml:space="preserve">
|
||||
<value>アンチエイリアスフィルター TDAS : {0}</value>
|
||||
</data>
|
||||
<data name="ExcitationNotSupportedByChannel" xml:space="preserve">
|
||||
<value> {0} V 印加電圧はこのDASでは使用できません。</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,30 @@
|
||||
using DTS.Common.Interface;
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SummaryView.xaml
|
||||
/// </summary>
|
||||
public partial class SummaryView : ISummaryView
|
||||
{
|
||||
public SummaryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void UpdateTestIds(string[] serializedValues)
|
||||
{
|
||||
ctrlTestId.PopulateAllTestIdPrefixSuffixValues(serializedValues);
|
||||
}
|
||||
|
||||
public void SetTestName(string testName)
|
||||
{
|
||||
ctrlTestId.TestName = testName;
|
||||
ctrlTestId.TestSetupLabel = testName;
|
||||
}
|
||||
public string GetTestId()
|
||||
{
|
||||
return ctrlTestId.GetTestId();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,861 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
using TTSImport.Model;
|
||||
using TTSImport.Resources;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Level Trigger edit/create functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class EditFileViewModel : IEditFileViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public IEditFileView View { get; set; }
|
||||
private const string DOUBLEUPTO15 = "0.###############"; //Write up to 15 decimal places to .csv
|
||||
private const string STRINGWRITEFORMAT_CHANNELRANGE = DOUBLEUPTO15;
|
||||
private const string STRINGWRITEFORMAT_SENSITIVITY = DOUBLEUPTO15;
|
||||
private const string STRINGWRITEFORMAT_CAPACITY = DOUBLEUPTO15;
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
///<summary>
|
||||
///Occurs when a property value changes.
|
||||
///</summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
switch (propertyName)
|
||||
{
|
||||
case "TestName":
|
||||
ChangeValidationIsNeeded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public EditFileViewModel(EditFileView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>().Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportReadFileStatusEvent>().Subscribe(OnReadFileFinished, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// filters the available sensors from the db by the given text
|
||||
/// we keep two lists, allchannels and SystemSensors
|
||||
/// SystemSensors only holds those that aren't in use and are
|
||||
/// available
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void Search(string text)
|
||||
{
|
||||
SystemSensors.Clear();
|
||||
//build a list of sensors already used to exclude those sensors
|
||||
var hash = new HashSet<string>();
|
||||
foreach (var ch in RequiredChannels)
|
||||
{
|
||||
hash.Add(ch.SensorSerialNumber);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
//nothing to sort
|
||||
foreach (var s in _allChannels)
|
||||
{
|
||||
if (!hash.Contains(s.SensorSerialNumber))
|
||||
{
|
||||
SystemSensors.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.ToLower();
|
||||
foreach (var s in _allChannels)
|
||||
{
|
||||
if (s.SensorSerialNumber.ToLower().Contains(text))
|
||||
{
|
||||
if (!hash.Contains(s.SensorSerialNumber))
|
||||
{
|
||||
SystemSensors.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnReadFileFinished(ReadFileStatusArg statusArg)
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
OnReadFileFinished(statusArg);
|
||||
}));
|
||||
return;
|
||||
}
|
||||
if (!statusArg.Status) return;
|
||||
_setup = statusArg.TTSSetup;
|
||||
}
|
||||
|
||||
public void InitializeView()
|
||||
{
|
||||
if (_setup == null) return;
|
||||
|
||||
//turn off Change Validation and remove old channels/sensors, if any
|
||||
ChangeValidationIsNeeded = false;
|
||||
RequiredChannels.Clear();
|
||||
SystemSensors.Clear();
|
||||
//will turn Change Validation back on
|
||||
TestName = _setup.TestId;
|
||||
SaveFileEnabled = false;
|
||||
|
||||
var requiredChannels = new ObservableCollection<ITTSChannelRecord>();
|
||||
_allChannels.Clear();
|
||||
|
||||
foreach (var channelRecord in _setup.Channels)
|
||||
{
|
||||
if (channelRecord.IsDigitalOutput) { continue; }
|
||||
if (channelRecord.ChannelCode != TTSChannelRecord.NONE)
|
||||
{
|
||||
//isn't a "reserved sensor"
|
||||
var requiredChannel = channelRecord.Copy();
|
||||
requiredChannel.Parent = this;
|
||||
requiredChannels.Add(requiredChannel);
|
||||
}
|
||||
}
|
||||
foreach (var sensor in DTS.SensorDB.SensorsCollection.SensorsList.GetAllSensors(false))
|
||||
{
|
||||
if (sensor.IsDigitalOutput()) { continue; }
|
||||
if (sensor.IsTestSpecificSquib) { continue; }
|
||||
if (sensor.IsTestSpecificDigitalIn) { continue; }
|
||||
_allChannels.Add(new TTSChannelRecord(sensor) { Parent = this });
|
||||
}
|
||||
RequiredChannels = requiredChannels;
|
||||
Search(_searchText);
|
||||
ValidateChannelCodes();
|
||||
ValidateJCodes();
|
||||
_originalHash = GenerateHash();
|
||||
NumChannelsAndSensors = string.Format(StringResources.NumChannelsAndSensors, RequiredChannels.Count, SystemSensors.Count);
|
||||
SaveFileEnabled = false;
|
||||
}
|
||||
|
||||
private string GenerateHash()
|
||||
{
|
||||
var bytes = new List<byte>();
|
||||
foreach (var rc in RequiredChannels)
|
||||
{
|
||||
bytes.AddRange(rc.GetBytes());
|
||||
}
|
||||
foreach (var rs in SystemSensors)
|
||||
{
|
||||
bytes.AddRange(rs.GetBytes());
|
||||
}
|
||||
|
||||
var sha = new SHA256Managed();
|
||||
var hash = sha.ComputeHash(bytes.ToArray());
|
||||
return BitConverter.ToString(hash).Replace("-", string.Empty);
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// this is the list of all channels, this is a superset while SystemSensors is the subset
|
||||
/// this contains some records we don't want
|
||||
/// </summary>
|
||||
private readonly List<ITTSChannelRecord> _allChannels = new List<ITTSChannelRecord>();
|
||||
/// <summary>
|
||||
/// this is the current text the user is search for in available channels/sensors
|
||||
/// </summary>
|
||||
private readonly string _searchText = "";
|
||||
private ITTSSetup _setup;
|
||||
public bool ChangeValidationIsNeeded { get; set; }
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{ _isBusy = value; OnPropertyChanged("IsBusy"); }
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{ _isMenuIncluded = value; OnPropertyChanged("IsMenuIncluded"); }
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{ _isNavigationIncluded = value; OnPropertyChanged("IsNavigationIncluded"); }
|
||||
}
|
||||
|
||||
private bool _isTestNameValid;
|
||||
public bool IsTestNameValid { get => _isTestNameValid; set { _isTestNameValid = value; OnPropertyChanged("IsTestNameValid"); } }
|
||||
|
||||
private string _testName = string.Empty;
|
||||
public string TestName
|
||||
{
|
||||
get => _testName;
|
||||
set
|
||||
{
|
||||
_testName = value;
|
||||
IsTestNameValid = !string.IsNullOrWhiteSpace(value);
|
||||
OnPropertyChanged("TestName");
|
||||
}
|
||||
}
|
||||
private DelegateCommand<string> _testNameLostFocus;
|
||||
public DelegateCommand<string> TestNameLostFocus => _testNameLostFocus ?? (_testNameLostFocus = new DelegateCommand<string>(TestNameLostFocusMethod));
|
||||
public void TestNameLostFocusMethod(string code)
|
||||
{
|
||||
if (!ChangeValidationIsNeeded) return;
|
||||
ValidateChange();
|
||||
}
|
||||
private bool _saveFileEnabled;
|
||||
public bool SaveFileEnabled
|
||||
{
|
||||
get => _saveFileEnabled;
|
||||
set
|
||||
{
|
||||
_saveFileEnabled = value;
|
||||
OnPropertyChanged("SaveFileEnabled");
|
||||
|
||||
EnableOrDisableButtons();
|
||||
}
|
||||
}
|
||||
|
||||
private string _numChannelsAndSensors = string.Empty;
|
||||
public string NumChannelsAndSensors
|
||||
{
|
||||
get => _numChannelsAndSensors;
|
||||
set { _numChannelsAndSensors = value; OnPropertyChanged("NumChannelsAndSensors"); }
|
||||
}
|
||||
|
||||
private bool _replaceEnabled;
|
||||
public bool ReplaceEnabled
|
||||
{
|
||||
get => _replaceEnabled;
|
||||
set { _replaceEnabled = value; OnPropertyChanged("ReplaceEnabled"); }
|
||||
}
|
||||
|
||||
private bool _addCodeEnabled;
|
||||
public bool AddCodeEnabled
|
||||
{
|
||||
get => _addCodeEnabled;
|
||||
set { _addCodeEnabled = value; OnPropertyChanged("AddCodeEnabled"); }
|
||||
}
|
||||
|
||||
private bool _deleteCodeEnabled;
|
||||
public bool DeleteCodeEnabled
|
||||
{
|
||||
get => _deleteCodeEnabled;
|
||||
set { _deleteCodeEnabled = value; OnPropertyChanged("DeleteCodeEnabled"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// stores a hash representing the state of channels at the time they were read in
|
||||
/// this is used to determine if any changes of significance were made in edit file
|
||||
/// </summary>
|
||||
private string _originalHash;
|
||||
|
||||
private ObservableCollection<ITTSChannelRecord> _requiredChannels = new ObservableCollection<ITTSChannelRecord>();
|
||||
public ObservableCollection<ITTSChannelRecord> RequiredChannels
|
||||
{
|
||||
get => _requiredChannels;
|
||||
set
|
||||
{ _requiredChannels = value; OnPropertyChanged("RequiredChannels"); }
|
||||
}
|
||||
private ObservableCollection<ITTSChannelRecord> _systemSensors = new ObservableCollection<ITTSChannelRecord>();
|
||||
public ObservableCollection<ITTSChannelRecord> SystemSensors
|
||||
{
|
||||
get => _systemSensors;
|
||||
set
|
||||
{ _systemSensors = value; OnPropertyChanged("SystemSensors"); }
|
||||
}
|
||||
|
||||
private ITTSChannelRecord _selectedRequiredChannel;
|
||||
public ITTSChannelRecord SelectedRequiredChannel
|
||||
{
|
||||
get => _selectedRequiredChannel;
|
||||
set
|
||||
{
|
||||
_selectedRequiredChannel = value; OnPropertyChanged("SelectedRequiredChannel");
|
||||
|
||||
EnableOrDisableButtons();
|
||||
}
|
||||
}
|
||||
|
||||
private ITTSChannelRecord _selectedSystemSensor;
|
||||
public ITTSChannelRecord SelectedSystemSensor
|
||||
{
|
||||
get => _selectedSystemSensor;
|
||||
set
|
||||
{
|
||||
_selectedSystemSensor = value;
|
||||
OnPropertyChanged("SelectedSystemSensor");
|
||||
EnableOrDisableButtons();
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableOrDisableButtons()
|
||||
{
|
||||
if (null == _selectedRequiredChannel || null == _selectedSystemSensor) { ReplaceEnabled = false; }
|
||||
else if (_selectedRequiredChannel.IsDigitalInput)
|
||||
{
|
||||
ReplaceEnabled = _selectedSystemSensor.IsDigitalInput;
|
||||
}
|
||||
else if (_selectedRequiredChannel.IsDigitalOutput)
|
||||
{
|
||||
ReplaceEnabled = _selectedSystemSensor.IsDigitalOutput;
|
||||
}
|
||||
else if (_selectedRequiredChannel.IsSquib)
|
||||
{
|
||||
ReplaceEnabled = _selectedSystemSensor.IsSquib;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReplaceEnabled = !(_selectedSystemSensor.IsSquib
|
||||
|| _selectedSystemSensor.IsDigitalInput ||
|
||||
_selectedSystemSensor.IsDigitalOutput);
|
||||
}
|
||||
|
||||
|
||||
AddCodeEnabled = _selectedSystemSensor != null;
|
||||
DeleteCodeEnabled = _selectedRequiredChannel != null;
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
/// <summary>
|
||||
/// Browse to import file
|
||||
/// </summary>
|
||||
private DelegateCommand _saveFileClicked;
|
||||
public DelegateCommand SaveFileClicked => _saveFileClicked ?? (_saveFileClicked = new DelegateCommand(SaveFileMethod));
|
||||
public void SaveFileMethod()
|
||||
{
|
||||
using (var sfd = new System.Windows.Forms.SaveFileDialog())
|
||||
{
|
||||
var fullFilePath = Path.GetFullPath(_setup.OriginalImportFile);
|
||||
sfd.Filter = @"TTS import (*.csv)|*.csv";
|
||||
sfd.RestoreDirectory = true;
|
||||
sfd.FilterIndex = 0;
|
||||
var fi = new FileInfo(fullFilePath);
|
||||
|
||||
sfd.FileName = fi.Name;
|
||||
|
||||
if (fi.DirectoryName != null) sfd.InitialDirectory = Path.GetFullPath(fi.DirectoryName);
|
||||
var result = sfd.ShowDialog();
|
||||
if (result != System.Windows.Forms.DialogResult.OK) return;
|
||||
fullFilePath = sfd.FileName;
|
||||
|
||||
var csv = new StringBuilder();
|
||||
|
||||
var newRow = _setup.Line1;
|
||||
csv.Append(newRow + Environment.NewLine);
|
||||
|
||||
newRow = _setup.Line2;
|
||||
_setup.TestId = TestName;
|
||||
if (_setup.Line2 != null)
|
||||
{
|
||||
var fields = _setup.Line2.Split(',');
|
||||
var newLine2 = fields.Where((t, index) => index > 0).Aggregate(_setup.TestId, (current, t) => current + "," + t);
|
||||
newRow = newLine2;
|
||||
}
|
||||
csv.Append(newRow + Environment.NewLine);
|
||||
|
||||
newRow = _setup.Line3;
|
||||
csv.Append(newRow + Environment.NewLine);
|
||||
|
||||
newRow = _setup.Line4;
|
||||
csv.Append(newRow + Environment.NewLine);
|
||||
|
||||
//Order the required channels first
|
||||
var channelList = RequiredChannels.ToList();
|
||||
|
||||
_setup.Channels = channelList.ToArray();
|
||||
|
||||
foreach (var channel in _setup.Channels)
|
||||
{
|
||||
var channelNumber = channel.ChannelNumber.ToString();
|
||||
var channelCode = channel.ChannelCode;
|
||||
var channelRange = channel.IsSquib ? channel.SquibFireDelayMs.ToString(STRINGWRITEFORMAT_CHANNELRANGE) : channel.ChannelRange.ToString(STRINGWRITEFORMAT_CHANNELRANGE); //Write up to 15 decimal places to .csv
|
||||
var channelFilter = channel.IsSquib ? channel.SquibFireDurationMs.ToString(STRINGWRITEFORMAT_CHANNELRANGE) : channel.ChannelFilterHz.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
if (channel.ChannelCode == TTSChannelRecord.NONE)
|
||||
{
|
||||
//Blank the following fields from reserved sensors
|
||||
channelNumber = "";
|
||||
channelCode = "";
|
||||
channelRange = "";
|
||||
channelFilter = "";
|
||||
}
|
||||
|
||||
var sensorSensitivity = channel.SensorSensitivity.ToString(STRINGWRITEFORMAT_SENSITIVITY); //Write up to 15 decimal places to .csv
|
||||
var sensorExcitationVolts = channel.SensorExcitationVolts.ToString("0.#");
|
||||
var sensorCapacity = channel.SensorCapacity.ToString(STRINGWRITEFORMAT_CAPACITY); //Write up to 15 decimal places to .csv
|
||||
var sensorPolarity = channel.SensorPolarity ? "+" : "-";
|
||||
|
||||
//Only FullBridge and HalfBridge contain a space
|
||||
string channelType;
|
||||
switch (channel.ChannelType)
|
||||
{
|
||||
case DTS.Common.Enums.TTS.ToyotaBridgeType.FullBridge:
|
||||
channelType = "Full Bridge";
|
||||
break;
|
||||
case DTS.Common.Enums.TTS.ToyotaBridgeType.HalfBridge:
|
||||
channelType = "Half Bridge";
|
||||
break;
|
||||
default:
|
||||
channelType = channel.ChannelType.ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
var proportionalToExcitation = channel.ProportionalToExcitation ? "mv/V/EU" : "";
|
||||
var bridgeResistance = channel.BridgeResistance.ToString("0.#");
|
||||
var initialOffsetVoltage = channel.InitialOffsetVoltage.ToString("0.#");
|
||||
var initialOffsetVoltageTolerance = channel.InitialOffsetVoltageTolerance.ToString("0.#");
|
||||
var removeOffset = channel.RemoveOffset ? "1" : "0";
|
||||
var zeroMethod = ((int)channel.ZeroMethod).ToString();
|
||||
var initialEUInMv = double.IsNaN(channel.InitialEUInMV) ? "" : channel.InitialEUInMV.ToString("0.##");
|
||||
var initialEUInEU = double.IsNaN(channel.InitialEUInEU) ? "" : channel.InitialEUInEU.ToString("0.##");
|
||||
var iRTraccExponent = double.IsNaN(channel.IRTraccExponent) ? "" : channel.IRTraccExponent.ToString("0.##");
|
||||
var polynomialConstant = double.IsNaN(channel.PolynomialConstant) ? "" : channel.PolynomialConstant.ToString("0.##");
|
||||
var polynomialCoefficientC = double.IsNaN(channel.PolynomialCoefficientC) ? "" : channel.PolynomialCoefficientC.ToString("0.##");
|
||||
var polynomialCoefficentB = double.IsNaN(channel.PolynomialCoefficentB) ? "" : channel.PolynomialCoefficentB.ToString("0.##");
|
||||
var polynomialCoefficientA = double.IsNaN(channel.PolynomialCoefficientA) ? "" : channel.PolynomialCoefficientA.ToString("0.##");
|
||||
var polynomialCoefficientAlpha = double.IsNaN(channel.PolynomialCoefficientAlpha) ? "" : channel.PolynomialCoefficientAlpha.ToString("0.##");
|
||||
var diagnosticsMode = channel.DiagnosticsMode ? TTSChannelRecord.DIAGNOSTICSMODE : "";
|
||||
|
||||
if (channel.IsDigitalInput)
|
||||
{
|
||||
channelRange = string.Empty;
|
||||
channelFilter = string.Empty;
|
||||
}
|
||||
|
||||
if (channel.IsDigitalOutput)
|
||||
{
|
||||
//14708 Squib appears to be unassigned when using edit file during TTS import
|
||||
//I changed this to be consistent with the reader, which only reads the first 3
|
||||
//fields for digital outputs
|
||||
newRow = $"{channelNumber},{channelCode},{channel.JCodeOrDescription}{Environment.NewLine}";
|
||||
}
|
||||
|
||||
if (channel.IsDigitalInput || channel.IsSquib)
|
||||
{
|
||||
//14708 Squib appears to be unassigned when using edit file during TTS import
|
||||
//don't wipe out EID or serial number, these are valid fields for these sensors
|
||||
//isocode and description should be valid too? as well as channel description?
|
||||
//note that the import reads up to the serial number, so no point it writing more
|
||||
newRow =
|
||||
$"{channelNumber},{channelCode},{channel.JCodeOrDescription},{channelRange},{channelFilter},{channel.SensorEID},{channel.SensorSerialNumber}{Environment.NewLine}";
|
||||
}
|
||||
else
|
||||
{
|
||||
newRow = $"{channelNumber},{channelCode},{channel.JCodeOrDescription},{channelRange},{channelFilter},{channel.SensorEID},{channel.SensorSerialNumber},{sensorSensitivity},{sensorExcitationVolts},{sensorCapacity},{channel.SensorEU}," +
|
||||
$"{sensorPolarity},{channelType},{channel.Description},{proportionalToExcitation},{bridgeResistance},{initialOffsetVoltage},{initialOffsetVoltageTolerance},{removeOffset},{zeroMethod},{channel.CableMultiplier.ToString(System.Globalization.CultureInfo.InvariantCulture)}," +
|
||||
$"{initialEUInMv},{initialEUInEU},{iRTraccExponent},{polynomialConstant},{polynomialCoefficientC},{polynomialCoefficentB},{polynomialCoefficientA},{polynomialCoefficientAlpha},{channel.ISOCode},{channel.ISODescription},{channel.ISOPolarity},{diagnosticsMode}{Environment.NewLine}";
|
||||
}
|
||||
|
||||
csv.Append(newRow);
|
||||
}
|
||||
|
||||
File.WriteAllText(fullFilePath, csv.ToString(), Encoding.GetEncoding("Shift-JIS"));
|
||||
_setup.OriginalImportFile = fullFilePath;
|
||||
}
|
||||
SaveFileEnabled = false;
|
||||
//Enable future nav steps since changes have been saved
|
||||
_eventAggregator.GetEvent<TTSImportSavedChangesStatusEvent>().Publish(true);
|
||||
_originalHash = GenerateHash();
|
||||
}
|
||||
|
||||
|
||||
#region Replace
|
||||
/// <summary>
|
||||
/// Swap the assignments of a Required Channel and a Reserved Sensor
|
||||
/// </summary>
|
||||
private DelegateCommand _replaceCommand;
|
||||
public DelegateCommand ReplaceCommand => _replaceCommand ?? (_replaceCommand = new DelegateCommand(Replace));
|
||||
private void Replace()
|
||||
{
|
||||
//11574 replace button removed JCode and range and filter from an "add code" channel in edit file
|
||||
//we preserve the original channel settings when doing replace
|
||||
//Initialize a Reserved Sensor that's about to become a Required Channel
|
||||
SelectedSystemSensor.ChannelNumber = SelectedRequiredChannel.ChannelNumber;
|
||||
SelectedSystemSensor.ChannelCode = SelectedRequiredChannel.ChannelCode;
|
||||
SelectedRequiredChannel.ChannelCode = TTSChannelRecord.NONE;
|
||||
SelectedSystemSensor.JCodeOrDescription = SelectedRequiredChannel.JCodeOrDescription;
|
||||
SelectedSystemSensor.ChannelRange = SelectedRequiredChannel.ChannelRange;
|
||||
SelectedSystemSensor.ChannelFilterHz = SelectedRequiredChannel.ChannelFilterHz;
|
||||
|
||||
// Save off the channels that are about to be removed from their old lists
|
||||
var savedSelectedSystemSensor = SelectedSystemSensor;
|
||||
var savedSelectedRequiredChannel = SelectedRequiredChannel;
|
||||
|
||||
//Save the indices of the channels that are about to be removed from their old lists
|
||||
var selectedRequiredChannelIndex = RequiredChannels.IndexOf(SelectedRequiredChannel);
|
||||
var selectedSystemSensorIndex = SystemSensors.IndexOf(SelectedSystemSensor);
|
||||
|
||||
//Remove the channels from their old lists
|
||||
RequiredChannels.Remove(SelectedRequiredChannel);
|
||||
SystemSensors.Remove(SelectedSystemSensor);
|
||||
|
||||
//Insert the saved channels into their new lists
|
||||
RequiredChannels.Insert(selectedRequiredChannelIndex, savedSelectedSystemSensor);
|
||||
SystemSensors.Insert(selectedSystemSensorIndex, savedSelectedRequiredChannel);
|
||||
|
||||
//Re-select the same rows in the tables
|
||||
SelectedRequiredChannel = RequiredChannels[selectedRequiredChannelIndex];
|
||||
SelectedSystemSensor = SystemSensors[selectedSystemSensorIndex];
|
||||
|
||||
UpdateAndValidate();
|
||||
}
|
||||
#endregion Replace
|
||||
|
||||
#region Add Code
|
||||
private DelegateCommand _addCodeCommand;
|
||||
public DelegateCommand AddCodeCommand => _addCodeCommand ?? (_addCodeCommand = new DelegateCommand(AddCode));
|
||||
/// <summary>
|
||||
/// remove a hardware channel assignment(does not remove the channel from the test setup though?)
|
||||
/// </summary>
|
||||
private void AddCode()
|
||||
{
|
||||
AddSystemSensor();
|
||||
UpdateAndValidate();
|
||||
}
|
||||
|
||||
private void AddSystemSensor()
|
||||
{
|
||||
var maxChannelNumber = RequiredChannels.Select(requiredChannel => requiredChannel.ChannelNumber).Concat(new[] { 0 }).Max();
|
||||
SelectedSystemSensor.ChannelNumber = maxChannelNumber + 1;
|
||||
SelectedSystemSensor.ChannelCode = string.Empty;
|
||||
SelectedSystemSensor.JCodeOrDescription = string.Empty;
|
||||
SelectedSystemSensor.ChannelRange = 0;
|
||||
SelectedSystemSensor.ChannelFilterHz = -1;
|
||||
RequiredChannels.Add(SelectedSystemSensor);
|
||||
|
||||
var selectedSystemSensorIndex = SystemSensors.IndexOf(SelectedSystemSensor);
|
||||
SystemSensors.Remove(SelectedSystemSensor);
|
||||
if (SystemSensors.Count > 0)
|
||||
{
|
||||
//If removing from the end of the list, set the previous record to Selected, otherwise set next record to Selected
|
||||
SelectedSystemSensor = selectedSystemSensorIndex == SystemSensors.Count ? SystemSensors[selectedSystemSensorIndex - 1] : SystemSensors[selectedSystemSensorIndex];
|
||||
}
|
||||
}
|
||||
#endregion Add Code
|
||||
|
||||
private DelegateCommand _addSquibCommand;
|
||||
|
||||
public DelegateCommand AddSquibCommand =>
|
||||
_addSquibCommand ?? (_addSquibCommand = new DelegateCommand(AddSquib));
|
||||
private void AddSquib()
|
||||
{
|
||||
var maxChannelNumber = RequiredChannels.Select(requiredChannel => requiredChannel.ChannelNumber).Concat(new[] { 0 }).Max();
|
||||
var channelRecord = new TTSChannelRecord();
|
||||
channelRecord.ChannelNumber = ++maxChannelNumber;
|
||||
channelRecord.IsSquib = true;
|
||||
int maxSquibNumber = 0;
|
||||
foreach (var rc in RequiredChannels)
|
||||
{
|
||||
if (!rc.IsSquib) continue;
|
||||
var channelCode = rc.ChannelCode.Replace("TF", "").Replace("SQ", "");
|
||||
if (int.TryParse(channelCode, out var temp))
|
||||
{
|
||||
maxSquibNumber = Math.Max(temp, maxSquibNumber);
|
||||
}
|
||||
}
|
||||
maxSquibNumber++;
|
||||
channelRecord.ChannelCode = $"SQ{maxSquibNumber}";
|
||||
channelRecord.JCodeOrDescription = string.Empty;
|
||||
channelRecord.LimitDuration = true;
|
||||
channelRecord.ChannelRange = (int)channelRecord.SquibFireDelayMs;
|
||||
channelRecord.SquibFireDurationMs = _setup.DefaultSquibFireDurationMs;
|
||||
channelRecord.ChannelFilterHz = (int)channelRecord.SquibFireDurationMs; //-1;
|
||||
channelRecord.Parent = this;
|
||||
RequiredChannels.Add(channelRecord);
|
||||
Validate();
|
||||
}
|
||||
|
||||
private DelegateCommand _addDICommand;
|
||||
|
||||
public DelegateCommand ADDDICommand =>
|
||||
_addDICommand ?? (_addDICommand = new DelegateCommand(AddDI));
|
||||
|
||||
private void AddDI()
|
||||
{
|
||||
var maxChannelNumber = RequiredChannels.Select(requiredChannel => requiredChannel.ChannelNumber).Concat(new[] { 0 }).Max();
|
||||
var channelRecord = new TTSChannelRecord();
|
||||
channelRecord.ChannelNumber = ++maxChannelNumber;
|
||||
channelRecord.IsDigitalInput = true;
|
||||
int maxDINumber = 0;
|
||||
foreach (var rc in RequiredChannels)
|
||||
{
|
||||
if (!rc.IsDigitalInput) continue;
|
||||
var channelCode = rc.ChannelCode.Replace("DI", "");
|
||||
if (int.TryParse(channelCode, out var temp))
|
||||
{
|
||||
maxDINumber = Math.Max(temp, maxDINumber);
|
||||
}
|
||||
}
|
||||
maxDINumber++;
|
||||
channelRecord.ChannelCode = $"DI{maxDINumber}";
|
||||
channelRecord.JCodeOrDescription = string.Empty;
|
||||
channelRecord.ChannelFilterHz = -1;
|
||||
channelRecord.Parent = this;
|
||||
channelRecord.IsChannelCodeValid = true;
|
||||
RequiredChannels.Add(channelRecord);
|
||||
}
|
||||
|
||||
#region Delete Code
|
||||
private DelegateCommand _deleteCodeCommand;
|
||||
public DelegateCommand DeleteCodeCommand =>
|
||||
_deleteCodeCommand ?? (_deleteCodeCommand = new DelegateCommand(DeleteCode));
|
||||
/// <summary>
|
||||
/// enables or disables a channel in the test.
|
||||
/// </summary>
|
||||
private void DeleteCode()
|
||||
{
|
||||
DeleteRequiredChannel();
|
||||
UpdateAndValidate();
|
||||
}
|
||||
|
||||
private void DeleteRequiredChannel()
|
||||
{
|
||||
if (null == SelectedRequiredChannel) { return; }
|
||||
SelectedRequiredChannel.ChannelCode = TTSChannelRecord.NONE; //So that when it's saved, these fields will be set to empty strings, but if it's re-Added, force user to enter a value.
|
||||
SelectedRequiredChannel.JCodeOrDescription = string.Empty; //In case it's re-Added, force user to enter a value.
|
||||
SelectedRequiredChannel.ChannelRange = 0; //In case it's re-Added, force user to enter a value.
|
||||
SelectedRequiredChannel.ChannelFilterHz = -1; //In case it's re-Added, force user to choose a filter or "None".
|
||||
SelectedRequiredChannel.HardwareChannel = null;
|
||||
SystemSensors.Add(SelectedRequiredChannel);
|
||||
|
||||
var selectedRequiredChannelIndex = RequiredChannels.IndexOf(SelectedRequiredChannel);
|
||||
RequiredChannels.Remove(SelectedRequiredChannel);
|
||||
if (RequiredChannels.Count > 0)
|
||||
{
|
||||
//Ensure the channels don't have any gaps
|
||||
foreach (var channel in RequiredChannels)
|
||||
{
|
||||
channel.ChannelNumber = RequiredChannels.IndexOf(channel) + 1;
|
||||
}
|
||||
|
||||
//If removing from the end of the list, set the previous record to Selected, otherwise set next record to Selected
|
||||
SelectedRequiredChannel = selectedRequiredChannelIndex == RequiredChannels.Count ? RequiredChannels[selectedRequiredChannelIndex - 1] : RequiredChannels[selectedRequiredChannelIndex];
|
||||
}
|
||||
}
|
||||
#endregion Delete Code
|
||||
|
||||
private void UpdateAndValidate()
|
||||
{
|
||||
NumChannelsAndSensors = string.Format(StringResources.NumChannelsAndSensors, RequiredChannels.Count, SystemSensors.Count);
|
||||
EnableOrDisableButtons();
|
||||
ValidateChange();
|
||||
CollectionViewSource.GetDefaultView(RequiredChannels)?.Refresh();
|
||||
}
|
||||
#endregion Commands
|
||||
|
||||
/// <summary>
|
||||
/// Returns True if all fields are valid, False if not
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Validate()
|
||||
{
|
||||
var duplicates = RequiredChannels.GroupBy(x => x.ChannelCode).Any(g => g.Count() > 1);
|
||||
return !duplicates && IsTestNameValid && RequiredChannels.All(x => x.IsChannelCodeValid /*&& x.IsJCodeValid*/ &&
|
||||
(x.IsRangeValid || x.RangeVisible != System.Windows.Visibility.Visible) &&
|
||||
(x.IsFilterValid || x.FilterVisible != System.Windows.Visibility.Visible));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if there are any changes that have not been saved yet
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool HasUnsavedChanges()
|
||||
{
|
||||
var hash = GenerateHash();
|
||||
return hash != _originalHash;
|
||||
}
|
||||
/// <summary>
|
||||
/// If all fields are valid after a change, enables the Save File button and returns True.
|
||||
/// If not all fields are valid after a change, disables the Save File button and returns False.
|
||||
/// Disables all future nav steps (they will be enabled when the Save File button is clicked).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ValidateChange(ITTSChannelRecord record = null)
|
||||
{
|
||||
//Enable the Save File button if everything is valid
|
||||
ValidateChannelCodes();
|
||||
ValidateJCodes();
|
||||
bool bValid = Validate();
|
||||
SaveFileEnabled = bValid && HasUnsavedChanges();
|
||||
|
||||
//Prevent calls to Validate if losing focus on an unchanged control, for example
|
||||
ChangeValidationIsNeeded = false;
|
||||
|
||||
//Disable future nav steps since changes have been made but not saved, or are just or are just invalid
|
||||
_eventAggregator.GetEvent<TTSImportSavedChangesStatusEvent>().Publish(!SaveFileEnabled);
|
||||
return SaveFileEnabled;
|
||||
}
|
||||
|
||||
private void ValidateChannelCodes()
|
||||
{
|
||||
var channelCodeToChannel = new Dictionary<string, ITTSChannelRecord>();
|
||||
foreach (var channel in RequiredChannels)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(channel.ChannelCode))
|
||||
{
|
||||
channel.IsChannelCodeValid = false;
|
||||
}
|
||||
else if (channel.ChannelCode == TTSChannelRecord.NONE)
|
||||
{
|
||||
channel.IsChannelCodeValid = false;
|
||||
}
|
||||
else if (channelCodeToChannel.ContainsKey(channel.ChannelCode))
|
||||
{
|
||||
channelCodeToChannel[channel.ChannelCode].IsChannelCodeValid = false;
|
||||
channel.IsChannelCodeValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
channelCodeToChannel[channel.ChannelCode] = channel;
|
||||
channel.IsChannelCodeValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateJCodes()
|
||||
{
|
||||
var channelJCodeToChannel = new Dictionary<string, ITTSChannelRecord>();
|
||||
foreach (var channel in RequiredChannels)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(channel.JCodeOrDescription))
|
||||
{
|
||||
channel.IsJCodeValid = false;
|
||||
}
|
||||
//else if (channelJCodeToChannel.ContainsKey(channel.JCodeOrDescription))
|
||||
//{
|
||||
// channelJCodeToChannel[channel.JCodeOrDescription].IsJCodeValid = false;
|
||||
// channel.IsJCodeValid = false;
|
||||
//}
|
||||
else
|
||||
{
|
||||
channelJCodeToChannel[channel.JCodeOrDescription] = channel;
|
||||
channel.IsJCodeValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Events.TTSImport;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
using TTSImport.Model;
|
||||
using TTSImport.Resources;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Level Trigger edit/create functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class DigitalOutputChannelsViewModel : IDigitalOutputChannelsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public IDigitalOutputChannelsView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="view">The IDigitalOutputChannelsView.</param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public DigitalOutputChannelsViewModel(IDigitalOutputChannelsView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<AssignedChannelsChangedEvent>().Subscribe(OnAssignedChannelsChangedEvent,
|
||||
ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanFinishedEvent>()
|
||||
.Subscribe(OnHardwareScanComplete, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<EIDMappingEvent>()
|
||||
.Subscribe(OnEIDComplete, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
private void OnEIDComplete(IDictionary<string, string> sensorIdToChannelId)
|
||||
{
|
||||
var channelIdToSensorId = new Dictionary<string, string>();
|
||||
using (var e = sensorIdToChannelId.GetEnumerator())
|
||||
{
|
||||
while (e.MoveNext())
|
||||
{
|
||||
channelIdToSensorId[e.Current.Value] = e.Current.Key;
|
||||
}
|
||||
}
|
||||
_hardwareChannelIdToSensorId = channelIdToSensorId;
|
||||
}
|
||||
private void OnHardwareScanComplete(List<IDASHardware> hardware)
|
||||
{
|
||||
_hardware = hardware;
|
||||
}
|
||||
|
||||
private void OnAssignedChannelsChangedEvent(ITTSSetup setup)
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
OnAssignedChannelsChangedEvent(setup);
|
||||
}));
|
||||
return;
|
||||
}
|
||||
_setup = setup;
|
||||
if (null == _hardware || null == _setup) { return; }
|
||||
var channels = new ObservableCollection<DASChannel>();
|
||||
var channelIdToChannelRecord = new Dictionary<string, ITTSChannelRecord>();
|
||||
foreach (var ch in _setup.Channels)
|
||||
{
|
||||
if (!ch.IsDigitalOutput) { continue; }
|
||||
if (null == ch.HardwareChannel) { continue; }
|
||||
if (ch.ChannelCode == TTSChannelRecord.NONE) { continue; }
|
||||
channelIdToChannelRecord[ch.HardwareChannel.GetId()] = ch;
|
||||
}
|
||||
var channelIdToDASChannel = new Dictionary<string, DASChannel>();
|
||||
foreach (var das in _hardware)
|
||||
{
|
||||
var ichannels = das.GetIHardwareChannels();
|
||||
foreach (var ch in ichannels)
|
||||
{
|
||||
if (!ch.IsDigitalOut) { continue; }
|
||||
var newChannel = new DASChannel(ch, _setup);
|
||||
if (_hardwareChannelIdToSensorId.ContainsKey(ch.GetId()))
|
||||
{
|
||||
newChannel.EID = _hardwareChannelIdToSensorId[ch.GetId()];
|
||||
}
|
||||
channels.Add(newChannel);
|
||||
channelIdToDASChannel[newChannel.HardwareChannel.GetId()] = newChannel;
|
||||
if (channelIdToChannelRecord.ContainsKey(ch.GetId()))
|
||||
{
|
||||
newChannel.SetITTSChannelRecord(channelIdToChannelRecord[ch.GetId()]);
|
||||
newChannel.Channel.ChannelCode = $"Digital Out {ch.ToString()}";
|
||||
newChannel.Channel.SensorSerialNumber = newChannel.Channel.ChannelCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using (var enumChannels = channelIdToDASChannel.GetEnumerator())
|
||||
{
|
||||
while (enumChannels.MoveNext())
|
||||
{
|
||||
if (null == enumChannels.Current.Value.Channel)
|
||||
{
|
||||
//CREATE new channel
|
||||
var ch = new TTSChannelRecord();
|
||||
ch.ChannelCode = $"Digital Out {enumChannels.Current.Value.HardwareChannel?.ToString()}";
|
||||
ch.IsChannelCodeValid = true;
|
||||
ch.IsDigitalOutput = true;
|
||||
ch.SensorEU = "V";
|
||||
ch.HardwareChannel = enumChannels.Current.Value.HardwareChannel;
|
||||
//ch.SensorSerialNumber = ch.ChannelCode;
|
||||
enumChannels.Current.Value.SetITTSChannelRecord(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DASChannels = channels;
|
||||
OnPropertyChanged("DASChannels");
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private ITTSSetup _setup;
|
||||
private IList<IDASHardware> _hardware;
|
||||
private IDictionary<string, string> _hardwareChannelIdToSensorId = new Dictionary<string, string>();
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
public ObservableCollection<DASChannel> DASChannels { get; set; } = new ObservableCollection<DASChannel>();
|
||||
|
||||
private DASChannel _selectedDASChannel;
|
||||
public DASChannel SelectedDASChannel
|
||||
{
|
||||
get => _selectedDASChannel;
|
||||
set => _selectedDASChannel = value;
|
||||
}
|
||||
|
||||
public string EnableOrDisableText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null)
|
||||
{
|
||||
return StringResources.Analog_Enable;
|
||||
}
|
||||
return SelectedDASChannel.Channel.Disabled
|
||||
? StringResources.Analog_Enable
|
||||
: StringResources.Analog_Disable;
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<base:BaseView x:Class="TTSImport.EditFileView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:TTSImport"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1100">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/brushes.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
|
||||
<converters:BooleanToBorderThicknessConverter x:Key="BooleanToBorderThickness" />
|
||||
<converters:BooleanToColorConverter x:Key="BooleanToColor" />
|
||||
<converters:BooleanToColorConverter x:Key="BooleanToWarningColor" WarningBrush="True" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="{strings:TranslateExtension SaveFile}" IsEnabled="{Binding SaveFileEnabled}" AutomationProperties.AutomationId="SaveFileButton" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding SaveFileClicked}" AutomationProperties.AutomationId="SaveFileClickedCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<TextBlock Text="{strings:TranslateExtension TestName}" AutomationProperties.AutomationId="TestNameTextBlock" />
|
||||
<TextBox Text="{Binding TestName, UpdateSourceTrigger=PropertyChanged, FallbackValue=NO_LABEL}" Width="500"
|
||||
BorderBrush="{Binding IsTestNameValid, Converter={StaticResource BooleanToColor}}"
|
||||
BorderThickness="{Binding IsTestNameValid, Converter={StaticResource BooleanToBorderThickness}}" AutomationProperties.AutomationId="TestNameTextBox" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="LostFocus">
|
||||
<i:InvokeCommandAction Command="{Binding TestNameLostFocus}" CommandParameter="{Binding TestName}" AutomationProperties.AutomationId="TestNameLostFocusCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right">
|
||||
<TextBlock Text="{strings:TranslateExtension Search}" AutomationProperties.AutomationId="SearchTextBlock" Margin="3,0" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Search}" AutomationProperties.AutomationId="SearchTextBox" Width="200" TextChanged="TextBox_TextChanged"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding NumChannelsAndSensors, FallbackValue=NO_LABEL}" HorizontalAlignment="Left" AutomationProperties.AutomationId="NumChannelAndSensorsTextBlock" />
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListView Grid.Row="0" Grid.Column="0" ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding RequiredChannels}" SelectedItem="{Binding SelectedRequiredChannel}" AutomationProperties.AutomationId="RequiredChannelsListView" >
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView>
|
||||
<GridViewColumn Header="{strings:TranslateExtension CH}" Width="50" DisplayMemberBinding="{Binding ChannelNumber}" AutomationProperties.AutomationId="ChannelNumber" />
|
||||
<GridViewColumn Header="{strings:TranslateExtension Code}" AutomationProperties.AutomationId="ChannelCode" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding ChannelCode, UpdateSourceTrigger=PropertyChanged}" MinWidth="180" AutomationProperties.AutomationId="ChannelCodeTextBox"
|
||||
BorderBrush="{Binding IsChannelCodeValid, Converter={StaticResource BooleanToColor}}"
|
||||
BorderThickness="{Binding IsChannelCodeValid, Converter={StaticResource BooleanToBorderThickness}}" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="LostFocus">
|
||||
<i:InvokeCommandAction Command="{Binding ControlLostFocus}" CommandParameter="{Binding ChannelCode}" AutomationProperties.AutomationId="ChannelCodeLostFocusCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension JHyphenCode}" AutomationProperties.AutomationId="JCode" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding JCodeOrDescription, UpdateSourceTrigger=PropertyChanged}" MinWidth="180"
|
||||
BorderBrush="{Binding IsJCodeValid, Converter={StaticResource BooleanToWarningColor}}"
|
||||
BorderThickness="{Binding IsJCodeValid, Converter={StaticResource BooleanToBorderThickness}}" AutomationProperties.AutomationId="JCodeTextBox" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="LostFocus">
|
||||
<i:InvokeCommandAction Command="{Binding ControlLostFocus}" CommandParameter="{Binding JCodeOrDescription}" AutomationProperties.AutomationId="JCodeOrDescriptionLostFocusCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Range}" AutomationProperties.AutomationId="Range" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding ChannelRangeString}" MinWidth="120" Visibility="{Binding RangeVisible}"
|
||||
BorderBrush="{Binding IsRangeValid, Converter={StaticResource BooleanToColor}}"
|
||||
BorderThickness="{Binding IsRangeValid, Converter={StaticResource BooleanToBorderThickness}}" AutomationProperties.AutomationId="RangeTextBox" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="LostFocus">
|
||||
<i:InvokeCommandAction Command="{Binding ControlLostFocus}" CommandParameter="{Binding ChannelRangeString}" AutomationProperties.AutomationId="RangeControlLostFocusCommand"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Filter}" AutomationProperties.AutomationId="Filter" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<ComboBox ItemsSource="{Binding Filters}" MinWidth="70"
|
||||
SelectedItem="{Binding FilterString, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding FilterVisible}"
|
||||
BorderBrush="{Binding IsFilterValid, Converter={StaticResource BooleanToColor}}"
|
||||
BorderThickness="{Binding IsFilterValid, Converter={StaticResource BooleanToBorderThickness}}"
|
||||
AutomationProperties.AutomationId="FilterComboBox">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding FilterSelectionChanged}"
|
||||
CommandParameter="{Binding FilterString}" AutomationProperties.AutomationId="FilterSelectionChangedCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</ComboBox>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension SensorSN}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock MinWidth="170" Text="{Binding SensorSerialNumber}" AutomationProperties.AutomationId="SensorSerialNumber"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Grid.Row="0" Grid.Column="1">
|
||||
<Button Content="{strings:TranslateExtension EditFile_Replace}" IsEnabled="{Binding ReplaceEnabled}" Width="85" AutomationProperties.AutomationId="ReplaceButton" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding ReplaceCommand}" AutomationProperties.AutomationId="ReplaceCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{strings:TranslateExtension EditFile_AddCode}" IsEnabled="{Binding AddCodeEnabled}" Width="85" AutomationProperties.AutomationId="AddCodeButton" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding AddCodeCommand}" AutomationProperties.AutomationId="AddCodeCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{strings:TranslateExtension EditFile_DeleteCode}" IsEnabled="{Binding DeleteCodeEnabled}" Width="85" AutomationProperties.AutomationId="DeleteCodeButton" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding DeleteCodeCommand}" AutomationProperties.AutomationId="DeleteCodeCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{strings:TranslateExtension EditFile_AddSquib}" Width="85" AutomationProperties.AutomationId="AddSquibButton" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding AddSquibCommand}" AutomationProperties.AutomationId="AddSquibCommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{strings:TranslateExtension EditFile_ADDDI}" Width="85" AutomationProperties.AutomationId="ADDDIButton" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding ADDDICommand}" AutomationProperties.AutomationId="ADDDICommand" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<ListView Grid.Row="0" Grid.Column="2"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding SystemSensors}"
|
||||
SelectedItem="{Binding SelectedSystemSensor}" AutomationProperties.AutomationId="SystemSensorsListView" >
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{strings:TranslateExtension SensorSN}" Width="200">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding SensorSerialNumber}" AutomationProperties.AutomationId="SysSensorSerialNumber" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,159 @@
|
||||
<base:BaseView x:Class="TTSImport.SummaryView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:ttsImport="clr-namespace:TTSImport"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/brushes.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}">
|
||||
<Setter Property="Margin" Value="0,0,3,3"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}">
|
||||
<Setter Property="Margin" Value="0,0,3,3"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
</Style>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}">
|
||||
<Setter Property="Height" Value="28"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Width" Value="150"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="Margin" Value="0,0,3,3"/>
|
||||
</Style>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<Style TargetType="xctk:DoubleUpDown" BasedOn="{StaticResource PageContentXCDoubleUpDown}">
|
||||
<Setter Property="Increment" Value="0.1"/>
|
||||
<Setter Property="Width" Value="150"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="Margin" Value="0,0,3,3"/>
|
||||
</Style>
|
||||
<converters:NonZeroToColorConverter x:Key="NonZeroToColor" />
|
||||
<converters:BooleanToBorderThicknessConverter x:Key="BooleanToBorderThickness" />
|
||||
<converters:BooleanToColorConverter x:Key="BooleanToColor" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:CommonStatusRibbon Content="{Binding StatusAndProgressBarView}" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{ttsImport:TranslateExtension ImportFile}" VerticalAlignment="Top"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding ImportFileName}" VerticalAlignment="Top" AutomationProperties.AutomationId="ImportFileName" />
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{ttsImport:TranslateExtension TestSetupName}" VerticalAlignment="Top"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding TestSetupName}" Width="150" VerticalAlignment="Top" AutomationProperties.AutomationId="TestSetupName" />
|
||||
<Button Grid.Row="2" Grid.Column="2" Background="White" Content="{ttsImport:TranslateExtension Import}" Width="150"
|
||||
IsEnabled="{Binding ImportEnabled}" HorizontalAlignment="Left" AutomationProperties.AutomationId="btnImport" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding ImportClicked}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{ttsImport:TranslateExtension TestId}"/>
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||
<controls:TestIdControl x:Name="ctrlTestId" AutomationProperties.AutomationId="TestIdControl"/>
|
||||
<Button Background="White" Content="{ttsImport:TranslateExtension RunTest}" Width="150"
|
||||
Visibility="{Binding RunTestVisible}" HorizontalAlignment="Left" AutomationProperties.AutomationId="btnRunTest" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding RunTestClicked}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="{ttsImport:TranslateExtension SampleRate}" VerticalAlignment="Top"/>
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" AutomationProperties.AutomationId="SampleRateComboBox"
|
||||
ItemsSource="{Binding AvailableSampleRates}" SelectedItem ="{Binding SampleRate, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="{ttsImport:TranslateExtension Mode}"/>
|
||||
<ComboBox Grid.Row="5" Grid.Column="1" AutomationProperties.AutomationId="ModeComboBox"
|
||||
ItemsSource="{Binding AvailableRecordingModes}"
|
||||
SelectedItem="{Binding RecordingMode, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Text="{ttsImport:TranslateExtension PreTrigger}" Visibility="{Binding SummaryPreTriggerVisibility}" />
|
||||
<xctk:DoubleUpDown Grid.Row="6" Grid.Column="1" Value="{Binding PreTrigger}" Minimum="0" AutomationProperties.AutomationId="PreTriggerUpDown"
|
||||
Visibility="{Binding SummaryPreTriggerVisibility}"/>
|
||||
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Text="{Binding PostTriggerOrTestLength}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
<xctk:DoubleUpDown Grid.Row="7" Grid.Column="1" Value="{Binding PostTrigger}" Minimum="0" AutomationProperties.AutomationId="PostTriggerUpDown" />
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Text="{ttsImport:TranslateExtension ROIStart}" VerticalAlignment="Top" HorizontalAlignment="Left" />
|
||||
<xctk:DoubleUpDown Grid.Row="8" Grid.Column="1" Value="{Binding ROIStart}" AutomationProperties.AutomationId="ROIStartUpDown"
|
||||
BorderBrush="{Binding IsROIStartValid, Converter={StaticResource BooleanToColor}}"
|
||||
BorderThickness="{Binding IsROIStartValid, Converter={StaticResource BooleanToBorderThickness}}"/>
|
||||
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Text="{ttsImport:TranslateExtension ROIEnd}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
<xctk:DoubleUpDown Grid.Row="9" Grid.Column="1" Value="{Binding ROIEnd}" AutomationProperties.AutomationId="ROIEndUpDown"
|
||||
BorderBrush="{Binding IsROIEndValid, Converter={StaticResource BooleanToColor}}"
|
||||
BorderThickness="{Binding IsROIEndValid, Converter={StaticResource BooleanToBorderThickness}}"/>
|
||||
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="3" Text="{Binding AAF_TDAS}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="3" Text="{Binding AAF_SLICE}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
<ScrollViewer Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="3" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<ListView ItemsSource="{Binding SummaryChannelList}" HorizontalAlignment="Left">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{ttsImport:TranslateExtension Type}" Width="100" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ChannelType,FallbackValue='Channel Type'}" Width="100" AutomationProperties.AutomationId="ChannelType" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{ttsImport:TranslateExtension Assigned}" Width="100">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Assigned,FallbackValue='Assigned'}" Width="100" AutomationProperties.AutomationId="Assigned" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{ttsImport:TranslateExtension Unassigned}" Width="100">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Unassigned,FallbackValue='Unassigned'}" Width="100" Background="{Binding Unassigned, Converter={StaticResource NonZeroToColor}}" AutomationProperties.AutomationId="Unassigned" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,622 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Events.TTSImport;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using TTSImport.Resources;
|
||||
using Application = System.Windows.Application;
|
||||
using DASChannel = TTSImport.Model.DASChannel;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using DTS.Common.DAS.Concepts;
|
||||
using DTS.Common.Enums;
|
||||
using TTSImport.Model;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Level Trigger edit/create functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class AnalogChannelsViewModel : IAnalogChannelsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public IAnalogChannelsView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region constructors and initializers
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public AnalogChannelsViewModel(IAnalogChannelsView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<AssignedChannelsChangedEvent>().Subscribe(OnAssignedChannelsChangedEvent,
|
||||
ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanFinishedEvent>()
|
||||
.Subscribe(OnHardwareScanComplete, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<EIDMappingEvent>()
|
||||
.Subscribe(OnEIDComplete, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
private void OnEIDComplete(IDictionary<string, string> sensorIdToChannelId)
|
||||
{
|
||||
var channelIdToSensorId = new Dictionary<string, string>();
|
||||
using (var e = sensorIdToChannelId.GetEnumerator())
|
||||
{
|
||||
while (e.MoveNext())
|
||||
{
|
||||
channelIdToSensorId[e.Current.Value] = e.Current.Key;
|
||||
}
|
||||
}
|
||||
_hardwareChannelIdToSensorId = channelIdToSensorId;
|
||||
}
|
||||
|
||||
public string Validate()
|
||||
{
|
||||
var bEmptyChannelCodes = false;
|
||||
|
||||
foreach (var channel in DASChannels)
|
||||
{
|
||||
if (null == channel.Channel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(channel.ToyotaCode))
|
||||
{
|
||||
bEmptyChannelCodes = true;
|
||||
}
|
||||
}
|
||||
return bEmptyChannelCodes ? StringResources.EmptyChannelCodeWarning : string.Empty;
|
||||
}
|
||||
private void OnHardwareScanComplete(List<IDASHardware> hardware)
|
||||
{
|
||||
_hardware = hardware;
|
||||
}
|
||||
|
||||
private void OnAssignedChannelsChangedEvent(ITTSSetup setup)
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
OnAssignedChannelsChangedEvent(setup);
|
||||
}));
|
||||
return;
|
||||
}
|
||||
_setup = setup;
|
||||
if (null == _hardware || null == _setup) { return; }
|
||||
var channels = new ObservableCollection<DASChannel>();
|
||||
var remainingChannels = new ObservableCollection<ITTSChannelRecord>();
|
||||
|
||||
var channelIdToDASChannel = new Dictionary<string, DASChannel>();
|
||||
foreach (var das in _hardware)
|
||||
{
|
||||
if (das.IsSLICEEthernetController) { continue; }
|
||||
var ichannels = das.GetIHardwareChannels();
|
||||
foreach (var ch in ichannels)
|
||||
{
|
||||
if (!ch.IsAnalog) { continue; }
|
||||
var newChannel = new DASChannel(ch);
|
||||
if (_hardwareChannelIdToSensorId.ContainsKey(ch.GetId()))
|
||||
{
|
||||
newChannel.EID = _hardwareChannelIdToSensorId[ch.GetId()];
|
||||
}
|
||||
channels.Add(newChannel);
|
||||
channelIdToDASChannel[newChannel.HardwareChannel.GetId()] = newChannel;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var channelRecord in _setup.Channels)
|
||||
{
|
||||
if (channelRecord.IsEmptyRecord) { continue; }
|
||||
if (channelRecord.IsDigitalInput) { continue; }
|
||||
if (channelRecord.IsDigitalOutput) { continue; }
|
||||
if (channelRecord.IsSquib) { continue; }
|
||||
if (!channelRecord.IsChannelCodeValid) { continue; }
|
||||
if (channelRecord.ChannelCode == TTSChannelRecord.NONE) { continue; }
|
||||
if (null != channelRecord.HardwareChannel)
|
||||
{
|
||||
var key = channelRecord.HardwareChannel.GetId();
|
||||
if (channelIdToDASChannel.ContainsKey(key))
|
||||
{
|
||||
channelIdToDASChannel[key].SetITTSChannelRecord(channelRecord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
remainingChannels.Add(channelRecord);
|
||||
}
|
||||
}
|
||||
|
||||
DASChannels = channels;
|
||||
RemainingChannels = remainingChannels;
|
||||
OnPropertyChanged("DASChannels");
|
||||
OnPropertyChanged("RemainingChannels");
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private ITTSSetup _setup;
|
||||
private IList<IDASHardware> _hardware;
|
||||
private IDictionary<string, string> _hardwareChannelIdToSensorId = new Dictionary<string, string>();
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
public bool AssignEnabled { get; set; }
|
||||
public bool RemoveEnabled { get; set; }
|
||||
public bool EnableOrDisableEnabled { get; set; }
|
||||
public ObservableCollection<DASChannel> DASChannels { get; set; } = new ObservableCollection<DASChannel>();
|
||||
public ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; } =
|
||||
new ObservableCollection<ITTSChannelRecord>();
|
||||
|
||||
private ITTSChannelRecord _selectedRemainingChannel;
|
||||
public ITTSChannelRecord SelectedRemainingChannel
|
||||
{
|
||||
get => _selectedRemainingChannel;
|
||||
set
|
||||
{
|
||||
_selectedRemainingChannel = value;
|
||||
if (null == _selectedRemainingChannel || null == SelectedDASChannel) return;
|
||||
AssignEnabled = true;
|
||||
OnPropertyChanged("AssignEnabled");
|
||||
}
|
||||
}
|
||||
private DASChannel _selectedDASChannel;
|
||||
public DASChannel SelectedDASChannel
|
||||
{
|
||||
get => _selectedDASChannel;
|
||||
set
|
||||
{
|
||||
_selectedDASChannel = value;
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
}
|
||||
public void DetermineRemoveEnableStatus()
|
||||
{
|
||||
if (_selectedDASChannel?.Channel != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_selectedDASChannel.EID) &&
|
||||
_selectedDASChannel.EID == _selectedDASChannel.Channel.SensorEID)
|
||||
{
|
||||
//can only be replaced, can't be removed
|
||||
RemoveEnabled = false;
|
||||
}
|
||||
RemoveEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveEnabled = false;
|
||||
}
|
||||
OnPropertyChanged("RemoveEnabled");
|
||||
AssignEnabled = null != _selectedDASChannel && null != _selectedRemainingChannel;
|
||||
OnPropertyChanged("AssignEnabled");
|
||||
EnableOrDisableEnabled = null != _selectedDASChannel && null != _selectedDASChannel.Channel;
|
||||
OnPropertyChanged("EnableOrDisableEnabled");
|
||||
OnPropertyChanged("EnableOrDisableText");
|
||||
}
|
||||
|
||||
public string EnableOrDisableText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null)
|
||||
{
|
||||
return StringResources.Analog_Enable;
|
||||
}
|
||||
return SelectedDASChannel.Channel.Disabled
|
||||
? StringResources.Analog_Enable
|
||||
: StringResources.Analog_Disable;
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
#region assign
|
||||
/// <summary>
|
||||
/// Assign a channel code to a channel
|
||||
/// </summary>
|
||||
private DelegateCommand _assignCommand;
|
||||
public DelegateCommand AssignCommand => _assignCommand ?? (_assignCommand = new DelegateCommand(Assign));
|
||||
private void Assign()
|
||||
{
|
||||
if (SelectedRemainingChannel == null) { return; }
|
||||
|
||||
var error = string.Empty;
|
||||
if (!VoltageIsValid(SelectedRemainingChannel, SelectedDASChannel, out error))
|
||||
{
|
||||
var window = Application.Current.MainWindow;
|
||||
if (null == window) { return; }
|
||||
MessageBox.Show(window, error, StringResources.AssignSensorExcitationError, MessageBoxButton.OK);
|
||||
return;
|
||||
}
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
//BEFORE we go any further, check the state of sensor ids
|
||||
//if the channel has a sensor id AND there's a sensor on the channel with the same id
|
||||
//then prompt on replacing the id
|
||||
//IF the channel has a sensor id and there's no sensor on the channel BUT the new sensor has a different id
|
||||
//then prompt on replacing the id
|
||||
var bReplacingID = false;
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
if (null != SelectedRemainingChannel && SelectedRemainingChannel.SensorEID != SelectedDASChannel.EID)
|
||||
{
|
||||
bReplacingID = true;
|
||||
}
|
||||
//if existing channel has this ID, we will need to clear out the old id and assign a new one...
|
||||
if (null != SelectedDASChannel.Channel &&
|
||||
SelectedDASChannel.Channel.SensorEID == SelectedDASChannel.EID)
|
||||
{
|
||||
bReplacingID = true;
|
||||
}
|
||||
}
|
||||
else if (_setup.RequireEIDFound && !string.IsNullOrWhiteSpace(SelectedRemainingChannel.SensorEID))
|
||||
{
|
||||
var window = Application.Current.MainWindow;
|
||||
if (null == window) { return; }
|
||||
var msg = string.Format(StringResources.AllowEIDToBlankChannelChallenge, SelectedRemainingChannel.SensorSerialNumber);
|
||||
msg = msg.Replace("\\r\\n", "\r\n");
|
||||
|
||||
var dialogResult = MessageBox.Show(window, msg, StringResources.UserFeedbackRequired, MessageBoxButton.OKCancel);
|
||||
APILogger.Log(msg, $"User pressed {dialogResult.ToString()}");
|
||||
if (dialogResult == MessageBoxResult.OK)
|
||||
{
|
||||
SelectedRemainingChannel.SensorEID = string.Empty;
|
||||
AssignWork();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (bReplacingID)
|
||||
{
|
||||
var window = Application.Current.MainWindow;
|
||||
if (null == window) { return; }
|
||||
var dialogResult = MessageBox.Show(window, StringResources.AssignSensorPrompt, StringResources.UserFeedbackRequired, MessageBoxButton.YesNo);
|
||||
APILogger.Log(StringResources.AssignSensorPrompt, $"User pressed {dialogResult.ToString()}");
|
||||
if (dialogResult == MessageBoxResult.Yes)
|
||||
{
|
||||
AssignWork();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
AssignWork();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns True if the sensor's voltage is supported by the hardware channel, or an error message and False if not
|
||||
/// </summary>
|
||||
/// <param name="selectedRemainingChannel"></param>
|
||||
/// <param name="selectedDASChannel"></param>
|
||||
/// <param name="error"></param>
|
||||
/// <returns></returns>
|
||||
private bool VoltageIsValid(ITTSChannelRecord selectedRemainingChannel, DASChannel selectedDASChannel, out string error)
|
||||
{
|
||||
error = string.Empty;
|
||||
var voltageEnum = ExcitationVoltageOptions.ExcitationVoltageOption.Undefined;
|
||||
try
|
||||
{
|
||||
voltageEnum = Test.Module.Channel.Sensor.GetExcitationVoltageEnumFromMagnitude(selectedRemainingChannel.SensorExcitationVolts);
|
||||
}
|
||||
catch { } //GetExcitationVoltageEnumFromMagnitude will throw an exception if an invalid voltage is passed to it
|
||||
|
||||
if (selectedDASChannel.HardwareChannel.IsSupportedExcitation(voltageEnum)) return true;
|
||||
error = string.Format(StringResources.InvalidExcitationAssignment, selectedRemainingChannel.SensorExcitationVolts);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// removes the channel as a selected channel for any level triggers
|
||||
/// removes the channel as a possible channel for any level triggers
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
private void RemoveFromLevelTriggers(ITTSChannelRecord channel)
|
||||
{
|
||||
if (null != _setup)
|
||||
{
|
||||
foreach (var lt in _setup.LevelTriggers)
|
||||
{
|
||||
lt.Remove(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// adds the channel as a possible channel to any level triggers
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
private void AddToLevelTriggers(ITTSChannelRecord channel)
|
||||
{
|
||||
if (null != _setup)
|
||||
{
|
||||
foreach (var lt in _setup.LevelTriggers)
|
||||
{
|
||||
lt.Add(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// assigns a channel record to a physical channel
|
||||
/// </summary>
|
||||
private void AssignWork()
|
||||
{
|
||||
if (null == SelectedDASChannel || null == SelectedRemainingChannel) { return; }
|
||||
var excitation =
|
||||
Test.Module.Channel.Sensor.GetExcitationVoltageEnumFromMagnitude(SelectedRemainingChannel
|
||||
.SensorExcitationVolts);
|
||||
if (!SelectedDASChannel.HardwareChannel.IsSupportedExcitation(excitation))
|
||||
{
|
||||
var window = Application.Current.MainWindow;
|
||||
if (null == window) { return; }
|
||||
var msg = string.Format(StringResources.ExcitationNotSupportedByChannel, excitation.ToString());
|
||||
var result = MessageBox.Show(window, msg, StringResources.Warning, MessageBoxButton.OK);
|
||||
APILogger.Log(msg, $"user pressed {result.ToString()}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (null != SelectedDASChannel.Channel)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
SelectedDASChannel.Channel.SensorEID = "";
|
||||
}
|
||||
RemainingChannels.Add(SelectedDASChannel.Channel);
|
||||
RemoveFromLevelTriggers(SelectedDASChannel.Channel);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
SelectedRemainingChannel.SensorEID = SelectedDASChannel.EID;
|
||||
}
|
||||
|
||||
SelectedDASChannel.SetITTSChannelRecord(SelectedRemainingChannel);
|
||||
|
||||
AddToLevelTriggers(SelectedDASChannel.Channel);
|
||||
var channel = SelectedRemainingChannel;
|
||||
var index = RemainingChannels.IndexOf(channel);
|
||||
SelectedRemainingChannel = null;
|
||||
RemainingChannels.Remove(channel);
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
if (index < RemainingChannels.Count)
|
||||
{
|
||||
SelectedRemainingChannel = RemainingChannels[index];
|
||||
OnPropertyChanged("SelectedRemainingChannel");
|
||||
}
|
||||
else if (RemainingChannels.Count > 0)
|
||||
{
|
||||
SelectedRemainingChannel = RemainingChannels[index - 1];
|
||||
OnPropertyChanged("SelectedRemainingChannel");
|
||||
}
|
||||
index = DASChannels.IndexOf(SelectedDASChannel);
|
||||
for (var i = index; i < DASChannels.Count; i++)
|
||||
{
|
||||
var dasChannel = DASChannels[i];
|
||||
if (null != dasChannel.Channel) { continue; }
|
||||
SelectedDASChannel = dasChannel;
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//didn't find a match, start from the beginning?
|
||||
for (var i = 0; i < index; i++)
|
||||
{
|
||||
var dasChannel = DASChannels[i];
|
||||
if (null != dasChannel.Channel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SelectedDASChannel = dasChannel;
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//if we get here there's no new channel to go to, change remove/enable/disable button status
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
#endregion
|
||||
#region remove
|
||||
private DelegateCommand _removeCommand;
|
||||
public DelegateCommand RemoveCommand => _removeCommand ?? (_removeCommand = new DelegateCommand(Remove));
|
||||
/// <summary>
|
||||
/// remove a hardware channel assignment (does not remove the channel from the test setup though?)
|
||||
/// </summary>
|
||||
private void Remove()
|
||||
{
|
||||
if (null == SelectedDASChannel || null == SelectedDASChannel.Channel) { return; }
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
RemainingChannels.Add(SelectedDASChannel.Channel);
|
||||
SelectedDASChannel.SetITTSChannelRecord(null);
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
var index = DASChannels.IndexOf(SelectedDASChannel);
|
||||
for (var i = index; i < DASChannels.Count; i++)
|
||||
{
|
||||
if (null == DASChannels[i].Channel) { continue; }
|
||||
SelectedDASChannel = DASChannels[i];
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < index; i++)
|
||||
{
|
||||
if (null == DASChannels[i].Channel) { continue; }
|
||||
SelectedDASChannel = DASChannels[i];
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//if we get here there's no new channel to go to, but we need to set the remove/enable/disable button status
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
#endregion
|
||||
#region enableordisable
|
||||
private DelegateCommand _enableOrDisableCommand;
|
||||
public DelegateCommand EnableOrDisableCommand =>
|
||||
_enableOrDisableCommand ?? (_enableOrDisableCommand = new DelegateCommand(EnableOrDisable));
|
||||
/// <summary>
|
||||
/// enables or disables a channel in the test.
|
||||
/// </summary>
|
||||
private void EnableOrDisable()
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null) { return; }
|
||||
SelectedDASChannel.Channel.Disabled = !SelectedDASChannel.Channel.Disabled;
|
||||
SelectedDASChannel.Disabled = SelectedDASChannel.Channel.Disabled;
|
||||
if (SelectedDASChannel.Channel.Disabled)
|
||||
{
|
||||
RemoveFromLevelTriggers(SelectedDASChannel.Channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddToLevelTriggers(SelectedDASChannel.Channel);
|
||||
}
|
||||
OnPropertyChanged("EnableOrDisableText");
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
<base:BaseView x:Class="TTSImport.TOMChannelsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:TTSImport"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<Style TargetType="xctk:DoubleUpDown" BasedOn="{StaticResource PageContentXCDoubleUpDown}">
|
||||
<Setter Property="UpdateValueOnEnterKey" Value="True" />
|
||||
</Style>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<WrapPanel Orientation="Vertical" VerticalAlignment="Center" Grid.Column="1">
|
||||
<Button Content="{strings:TranslateExtension Analog_Assign}" IsEnabled="{Binding AssignEnabled}" Width="85" AutomationProperties.AutomationId="TOM_AssignButton">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding AssignCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{strings:TranslateExtension Analog_Remove}" IsEnabled="{Binding RemoveEnabled}" Width="85" AutomationProperties.AutomationId="TOM_RemoveButton">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding RemoveCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{Binding EnableOrDisableText,FallbackValue=Enable}" IsEnabled="{Binding EnableOrDisableEnabled}" Width="85" AutomationProperties.AutomationId="TOM_EnableDisableButton">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding EnableOrDisableCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
</WrapPanel>
|
||||
<GroupBox Header="{strings:TranslateExtension RemainingChannels}" AutomationProperties.AutomationId="RemainingChannelsGroupBox" Grid.Column="2">
|
||||
<ListView ItemsSource="{Binding RemainingChannels}" SelectedItem="{Binding SelectedRemainingChannel}" AutomationProperties.AutomationId="RemainingChannelsListView">
|
||||
<ListView.View>
|
||||
<GridView AutomationProperties.AutomationId="RemainingChannelsGridView">
|
||||
<GridViewColumn Header="{strings:TranslateExtension ToyotaCode}" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock MinWidth="130" Text="{Binding ChannelCode}" AutomationProperties.AutomationId="RemainingChannelsChannelCode"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{strings:TranslateExtension DASChannels}" AutomationProperties.AutomationId="DASChannelsGroupBox" Grid.Column="0">
|
||||
<ListView ItemsSource="{Binding DASChannels}" SelectedItem="{Binding SelectedDASChannel}" AutomationProperties.AutomationId="DASChannelsListView">
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="DASChannelsGridView">
|
||||
<GridViewColumn Header="{strings:TranslateExtension DASChannel}" AutomationProperties.AutomationId="DASChannel">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding DASChannelString}" MinWidth="230" AutomationProperties.AutomationId="DASChannelTextBlock"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Header="{strings:TranslateExtension Code}" AutomationProperties.AutomationId="ToyotaCode">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding ToyotaCode}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ToyotaCodeTextBox"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension JHyphenCode}" AutomationProperties.AutomationId="Name">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding Name}" MinWidth="140" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="NameTextBox"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Mode}" AutomationProperties.AutomationId="Mode">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<ComboBox MinWidth="270" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ModeComboBox"
|
||||
ItemsSource="{Binding SquibFireModes}" SelectedItem="{Binding SquibFireMode, UpdateSourceTrigger=PropertyChanged}" Padding="0" Height="28"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Current}" AutomationProperties.AutomationId="Current">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding SquibFireCurrent}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="CurrentUpDown"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Delay}" AutomationProperties.AutomationId="Delay">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding SquibFireDelayMs}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="DelayUpDown" Minimum="0" Maximum="99000"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension LimitDuration}" AutomationProperties.AutomationId="LimitDuration">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<CheckBox MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="LimitDurationCheckBox" IsChecked="{Binding LimitDuration}"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Duration}" AutomationProperties.AutomationId="Duration">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding SquibFireDurationMs}" MinWidth="70" Visibility="{Binding LimitDuration, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="DurationUpDown" Minimum=".20" Maximum="25.5"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension ResLowTolerance}" AutomationProperties.AutomationId="ResLowTolerance">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding SquibFireResistanceLowOhm}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ResLowToleranceUpDown" Maximum="8" Minimum="1"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension ResHighTolerance}" AutomationProperties.AutomationId="ResHighTolerance">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding SquibFireResistanceHighOhm}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ResHighToleranceUpDown" Maximum="8" Minimum="1"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
[MarkupExtensionReturnTypeAttribute(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
public const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return Resources.StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TTSImport.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="DefaultTestImportMethod" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="TTSImport.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<TTSImport.Properties.Settings>
|
||||
<setting name="DefaultTestImportMethod" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
</TTSImport.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,87 @@
|
||||
<base:BaseView x:Class="TTSImport.DigitalOutputChannelsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:strings="clr-namespace:TTSImport"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<GroupBox Header="{strings:TranslateExtension DASChannels}" AutomationProperties.AutomationId="DODASChannelsGroupBox">
|
||||
<ListView ItemsSource="{Binding DASChannels}" SelectedItem="{Binding SelectedDASChannel}" AutomationProperties.AutomationId="DASChannelsListView">
|
||||
<ListView.Resources>
|
||||
<Style TargetType="{x:Type ListViewItem}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Disabled}" Value="True">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="DASChannelsGridView">
|
||||
<GridViewColumn Header="{strings:TranslateExtension DASChannel}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding DASChannelString}" MinWidth="230" AutomationProperties.AutomationId="DASChannelTextBlock"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Mode}" AutomationProperties.AutomationId="Mode">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<ComboBox MinWidth="270" AutomationProperties.AutomationId="ModeComboBox" ItemsSource="{Binding OutputModes}" SelectedItem="{Binding DigitalOutputMode, UpdateSourceTrigger=PropertyChanged}" Padding="0" Height="28"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Delay}" AutomationProperties.AutomationId="Delay">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding DigitalOutputDelayMs}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="DelayUpDown" Minimum="0" Maximum="99000"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension LimitDuration}" AutomationProperties.AutomationId="LimitDuration">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<CheckBox MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="LimitDurationCheckBox" IsChecked="{Binding LimitDuration}"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension Duration}" AutomationProperties.AutomationId="Duration">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xctk:DoubleUpDown Value="{Binding DigitalOutputDurationMs}" MinWidth="70" Visibility="{Binding LimitDuration, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="DurationUpDown" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,93 @@
|
||||
<base:BaseView x:Class="TTSImport.LevelTriggerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:strings="clr-namespace:TTSImport"
|
||||
xmlns:xceed="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}" >
|
||||
|
||||
<ListView ItemsSource="{Binding LevelTriggers, UpdateSourceTrigger=PropertyChanged}" AutomationProperties.AutomationId="LevelTriggersListView">
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="LevelTriggersGridView">
|
||||
<GridViewColumn Header="{strings:TranslateExtension Code}" AutomationProperties.AutomationId="ChannelCode">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<ComboBox SelectedItem="{Binding Channel}" ItemsSource="{Binding AvailableChannels, UpdateSourceTrigger=PropertyChanged}"
|
||||
MinWidth="235" DisplayMemberPath="ChannelCode" AutomationProperties.AutomationId="ChannelCodeComboBox"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension JHyphenCode}" >
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock MinWidth="80" Text="{Binding JCode,FallbackValue='JCODE'}" AutomationProperties.AutomationId="JCode"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension ValuePercent}" AutomationProperties.AutomationId="ValuePercent">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xceed:DoubleUpDown Value="{Binding ValuePercent}" MinWidth="70" DefaultValue="0"
|
||||
Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ValuePercentUpDown"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension ValueEU}" AutomationProperties.AutomationId="ValueEU">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<xceed:DoubleUpDown Value="{Binding ValueEU}" MinWidth="70" DefaultValue="0"
|
||||
Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ValueEUUpDown"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension EULabel}" AutomationProperties.AutomationId="EU">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock MinWidth="100" Text="{Binding EULabel}" AutomationProperties.AutomationId="EUTextBlock" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension HWSerialNumber}" AutomationProperties.AutomationId="HWChannelInfo">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock MinWidth="250" Text="{Binding HWSerialNumber}" AutomationProperties.AutomationId="HWChannelInfoTextBlock" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension CHAN}" AutomationProperties.AutomationId="ChannelNumber">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding ChannelNumber,FallbackValue='001',StringFormat={}{0:000}}" AutomationProperties.AutomationId="ChannelNumberTextBlock" MinWidth="85" TextAlignment="Right"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,17 @@
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HardwareScanView.xaml
|
||||
/// </summary>
|
||||
public partial class TOMChannelsView : ITOMChannelsView
|
||||
{
|
||||
public TOMChannelsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TTSImport.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public int DefaultTestImportMethod {
|
||||
get {
|
||||
return ((int)(this["DefaultTestImportMethod"]));
|
||||
}
|
||||
set {
|
||||
this["DefaultTestImportMethod"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<base:BaseView x:Class="TTSImport.DigitalInputChannelsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:strings="clr-namespace:TTSImport"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Header="{strings:TranslateExtension DASChannels}" AutomationProperties.AutomationId="DASChannelsGroupBox" Grid.Column="0">
|
||||
<ListView ItemsSource="{Binding DASChannels}" SelectedItem="{Binding SelectedDASChannel}" AutomationProperties.AutomationId="DASChannelsListView">
|
||||
<ListView.Resources>
|
||||
<Style TargetType="{x:Type ListViewItem}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Disabled}" Value="True">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="DASChannelsGridView">
|
||||
<GridViewColumn Header="{strings:TranslateExtension DASChannel}" AutomationProperties.AutomationId="DASChannel">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding DASChannelString}" MinWidth="230" AutomationProperties.AutomationId="DASChannelTextBlock"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Header="{strings:TranslateExtension Code}" AutomationProperties.AutomationId="ToyotaCode">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding ToyotaCode}" MinWidth="70" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="ToyotaCodeTextBox"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{strings:TranslateExtension JHyphenCode}" AutomationProperties.AutomationId="Name">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Text="{Binding Name}" MinWidth="140" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}, ConverterParameter=HIDE}" AutomationProperties.AutomationId="NameTextBox"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</GroupBox>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Grid.Column="1">
|
||||
<Button Content="{strings:TranslateExtension Analog_Assign}" IsEnabled="{Binding AssignEnabled}" Width="85" AutomationProperties.AutomationId="DI_AssignButton">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding AssignCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{strings:TranslateExtension Analog_Remove}" IsEnabled="{Binding RemoveEnabled}" Width="85" AutomationProperties.AutomationId="DI_RemoveButton">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding RemoveCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Content="{Binding EnableOrDisableText,FallbackValue=Enable}" IsEnabled="{Binding EnableOrDisableEnabled}" Width="85" AutomationProperties.AutomationId="DI_EnableDisableButton">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding EnableOrDisableCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<GroupBox Header="{strings:TranslateExtension RemainingChannels}" AutomationProperties.AutomationId="RemainingChannelsGroupBox" Grid.Column="2">
|
||||
<ListView ItemsSource="{Binding RemainingChannels}" SelectedItem="{Binding SelectedRemainingChannel}" AutomationProperties.AutomationId="RemainingChannelsListView">
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="RemainingChannelsGridView">
|
||||
<GridViewColumn Header="{strings:TranslateExtension ToyotaCode}" AutomationProperties.AutomationId="ToyotaCode">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBlock Text="{Binding ChannelCode}" MinWidth="130" AutomationProperties.AutomationId="ToyotaCodeTextBlock"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,613 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Classes;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Events.TTSImport;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.HardwareScan;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
using TTSImport.Model;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Hardware Scan functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class HardwareScanViewModel : IHardwareScanViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Status and Progress bars
|
||||
/// </summary>
|
||||
public IStatusAndProgressBarView StatusAndProgressBarView { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public IHardwareScanView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; set; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; set; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; private set; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="hardwareScanView">The Hardware Scan View.</param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public HardwareScanViewModel(IHardwareScanView hardwareScanView, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = hardwareScanView;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>().Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportReadFileStatusEvent>().Subscribe(OnReadFileFinished, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanFinishedEvent>().Subscribe(OnHardwareScanFinished, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<AssignedChannelsChangedEvent>().Subscribe(OnAssignedChannelsChangedEvent, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
StatusAndProgressBarView = GetStatusAndProgressBarView(this);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
private readonly StatusAndProgressBarEventArgs statusAndProgressBarEventArgs = new StatusAndProgressBarEventArgs();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the text, background color, progress value, and/or progress visibility
|
||||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
public void SetStatus(string status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case "Waiting": //change this to string resources but use the same one in DataPRO and here???
|
||||
statusAndProgressBarEventArgs.StatusColor =
|
||||
DTS.Common.BrushesAndColors.Brush_ApplicationStatus_Waiting.Color;
|
||||
statusAndProgressBarEventArgs.ProgressBarVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
case "Working":
|
||||
statusAndProgressBarEventArgs.StatusColor =
|
||||
DTS.Common.BrushesAndColors.Brush_ApplicationStatus_Busy.Color;
|
||||
statusAndProgressBarEventArgs.ProgressValue = 0;
|
||||
statusAndProgressBarEventArgs.ProgressBarVisibility = Visibility.Visible;
|
||||
break;
|
||||
case "Failed":
|
||||
statusAndProgressBarEventArgs.StatusColor =
|
||||
DTS.Common.BrushesAndColors.Brush_ApplicationStatus_Failed.Color;
|
||||
statusAndProgressBarEventArgs.ProgressBarVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
case "Done":
|
||||
statusAndProgressBarEventArgs.StatusColor =
|
||||
DTS.Common.BrushesAndColors.Brush_ApplicationStatus_Complete.Color;
|
||||
statusAndProgressBarEventArgs.ProgressBarVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
statusAndProgressBarEventArgs.StatusText = status;
|
||||
|
||||
statusAndProgressBarEventArgs.Requester = this;
|
||||
_eventAggregator.GetEvent<StatusAndProgressBarEvent>().Publish(statusAndProgressBarEventArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the progress value on the Status and Progress bar
|
||||
/// </summary>
|
||||
/// <param name="progress"></param>
|
||||
public void SetProgress(double progress)
|
||||
{
|
||||
statusAndProgressBarEventArgs.ProgressValue = (int)progress;
|
||||
statusAndProgressBarEventArgs.Requester = this;
|
||||
_eventAggregator.GetEvent<StatusAndProgressBarEvent>().Publish(statusAndProgressBarEventArgs);
|
||||
}
|
||||
|
||||
private IStatusAndProgressBarView GetStatusAndProgressBarView(IBaseViewModel parent)
|
||||
{
|
||||
var view = UnityContainer.Resolve<IStatusAndProgressBarView>();
|
||||
var viewModel = UnityContainer.Resolve<IStatusAndProgressBarViewModel>();
|
||||
view.DataContext = viewModel;
|
||||
viewModel.Initialize(parent);
|
||||
return view;
|
||||
}
|
||||
|
||||
private void OnReadFileFinished(ReadFileStatusArg statusArg)
|
||||
{
|
||||
if (statusArg.Status)
|
||||
{
|
||||
_setup = statusArg.TTSSetup;
|
||||
}
|
||||
}
|
||||
|
||||
public void HardwareScan()
|
||||
{
|
||||
SetStatus(Resources.StringResources
|
||||
.ImportTestSetup_PossibleStatus_Working); //use string resource (same both here and where passed)
|
||||
var data = new WorkFunctionThreadData();
|
||||
ThreadPool.QueueUserWorkItem(HardwareScanWorkThread, data);
|
||||
}
|
||||
|
||||
void HardwareScanWorkThread(object obj)
|
||||
{
|
||||
ITTSSetup temp = null;
|
||||
//Blank out the tables before re-scanning
|
||||
HardwareRecords[0].Update(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
DasSummaryList = new List<IDASHardware>();
|
||||
ChannelSummaryList = new List<ChannelSummary>();
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanRunEvent>().Publish(temp); //temp not needed?
|
||||
}
|
||||
|
||||
private void UpdateUnitCount(IDASHardware hardwareRecord, ref uint sps, ref uint spd, ref uint spt, ref uint ecm,
|
||||
ref uint g5, ref uint rack)
|
||||
{
|
||||
if (hardwareRecord.SerialNumber.Length < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var firstThree = hardwareRecord.SerialNumber.Substring(0, 3).ToLower();
|
||||
switch (firstThree)
|
||||
{
|
||||
case "spt": spt++; break;
|
||||
case "spd": spd++; break;
|
||||
case "sps": sps++; break;
|
||||
case "spe": ecm++; break;
|
||||
case "slt": spt++; break;
|
||||
case "sld": spd++; break;
|
||||
case "sle": ecm++; break;
|
||||
case "sls": sps++; break;
|
||||
case "sg5": g5++; break;
|
||||
}
|
||||
var firstTwo = hardwareRecord.SerialNumber.Substring(0, 2).ToLower();
|
||||
switch (firstTwo)
|
||||
{
|
||||
case "dr": rack++; break;
|
||||
case "lr": rack++; break;
|
||||
case "5m": g5++; break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns IP addresses for which SLICE2 modules have been found without a corresponding ECM/SLE
|
||||
/// </summary>
|
||||
/// <param name="hardwareRecords"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<string> GetMissingECMIPAddresses(List<IDASHardware> hardwareRecords)
|
||||
{
|
||||
var foundECMIPAddresses = new HashSet<string>();
|
||||
var missingECMIPAddresses = new List<string>();
|
||||
foreach (var hardwareRecord in hardwareRecords)
|
||||
{
|
||||
if (!hardwareRecord.IsSLICEEthernetController) continue;
|
||||
var ipAddress = hardwareRecord.Connection;
|
||||
var index = ipAddress.IndexOf(':');
|
||||
if (index > 0)
|
||||
{
|
||||
ipAddress = ipAddress.Substring(0, index);
|
||||
}
|
||||
foundECMIPAddresses.Add(ipAddress);
|
||||
}
|
||||
foreach (var hardwareRecord in hardwareRecords)
|
||||
{
|
||||
if (hardwareRecord.SerialNumber.Length < 3) { continue; }
|
||||
var ipAddress = hardwareRecord.Connection.ToLower();
|
||||
var index = ipAddress.IndexOf(':');
|
||||
if (index > 0)
|
||||
{
|
||||
ipAddress = ipAddress.Substring(0, index);
|
||||
}
|
||||
if (foundECMIPAddresses.Contains(ipAddress)) { continue; }
|
||||
if (missingECMIPAddresses.Contains(ipAddress)) { continue; }
|
||||
var firstThree = hardwareRecord.SerialNumber.Substring(0, 3).ToLower();
|
||||
switch (firstThree)
|
||||
{
|
||||
case "spt":
|
||||
case "spd":
|
||||
case "sps":
|
||||
case "slt":
|
||||
case "sld":
|
||||
case "sls":
|
||||
if (ipAddress.Contains("usb") || ipAddress.Length < 6) { continue; }
|
||||
missingECMIPAddresses.Add(ipAddress);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return missingECMIPAddresses;
|
||||
}
|
||||
/// <summary>
|
||||
/// Fill in the table of DAS that are in the database and connected
|
||||
/// </summary>
|
||||
/// <param name="hardwareRecords"></param>
|
||||
private void OnHardwareScanFinished(List<IDASHardware> hardwareRecords)
|
||||
{
|
||||
//Create mapping from IP address to ECM/SDB/Rack
|
||||
var connectionToParent =
|
||||
hardwareRecords.Where(hardwareRecord => hardwareRecord.IsSLICEEthernetController ||
|
||||
hardwareRecord.IsTDASRack()).ToDictionary(hardwareRecord => hardwareRecord.Connection, hardwareRecord => hardwareRecord.SerialNumber);
|
||||
|
||||
var moduleRecords = new List<IDASHardware>();
|
||||
uint analog = 0;
|
||||
uint din = 0;
|
||||
uint dout = 0;
|
||||
uint squib = 0;
|
||||
uint sps = 0;
|
||||
uint spd = 0;
|
||||
uint spt = 0;
|
||||
uint ecm = 0;
|
||||
uint g5 = 0;
|
||||
uint rack = 0;
|
||||
|
||||
var missingECMIPS = GetMissingECMIPAddresses(hardwareRecords);
|
||||
if (missingECMIPS.Any())
|
||||
{
|
||||
var prompt = $"{Resources.StringResources.MissingECMSWarning}\r\n";
|
||||
prompt += string.Join("\r\n", missingECMIPS.ToArray());
|
||||
var mreLocal = new ManualResetEvent(false);
|
||||
APILogger.Log("MessageBox", prompt);
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
var window = Application.Current.MainWindow;
|
||||
if (null == window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MessageBox.Show(window, prompt, Resources.StringResources.Warning,
|
||||
MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
mreLocal.Set();
|
||||
}));
|
||||
mreLocal.WaitOne();
|
||||
}
|
||||
|
||||
foreach (var hardwareRecord in hardwareRecords)
|
||||
{
|
||||
//We don't want to list bridges, but we do want to list modules in a TDAS Rack, and DAS connected via ECM, SDB, and USB.
|
||||
//Modules in a TDAS Rack have IsModule() == false.
|
||||
//DAS connected via ECM or SDB have a hardwareRecord.Connection that's in the connectionToParent dictionary above.
|
||||
//DAS connected via USB have a hardwareRecord.Connection == "USB".
|
||||
if (hardwareRecord.IsModule() &&
|
||||
!connectionToParent.ContainsKey(hardwareRecord.Connection) &&
|
||||
hardwareRecord.Connection != "USB") continue;
|
||||
|
||||
UpdateUnitCount(hardwareRecord, ref sps, ref spd, ref spt, ref ecm, ref g5, ref rack);
|
||||
|
||||
//We want to display TDAS Racks, ECM, and SDBs in a separate row for their battery and
|
||||
//voltage status but also as a parent of their connected DAS.
|
||||
if (!hardwareRecord.IsSLICEEthernetController && !hardwareRecord.IsTDASRack())
|
||||
{
|
||||
//Display the DAS with its associated parent (TDAS Rack/ECM/SDB)
|
||||
var parentDAS = connectionToParent.ContainsKey(hardwareRecord.Connection)
|
||||
? connectionToParent[hardwareRecord.Connection]
|
||||
: hardwareRecord.ParentDAS;
|
||||
if (!string.IsNullOrWhiteSpace(parentDAS))
|
||||
{
|
||||
//DAS connected via USB have a blank ParentDAS
|
||||
//When the hardwareRecord.ToString() override is implemented for all DAS types, the following
|
||||
//can be modified to use it. Currently, only Slice DAS connected via ECM return "<parent>:<das>".
|
||||
hardwareRecord.SerialNumberFamily = "[" + parentDAS + ":" + hardwareRecord.SerialNumber + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
hardwareRecord.SerialNumberFamily = hardwareRecord.SerialNumber;
|
||||
}
|
||||
UpdateChannelCount(hardwareRecord, ref analog, ref squib, ref din, ref dout);
|
||||
}
|
||||
else
|
||||
{
|
||||
hardwareRecord.SerialNumberFamily = hardwareRecord.SerialNumber;
|
||||
if (hardwareRecord.IsTDASRack())
|
||||
{
|
||||
UpdateChannelCount(hardwareRecord, ref analog, ref squib, ref din, ref dout);
|
||||
}
|
||||
}
|
||||
moduleRecords.Add(hardwareRecord);
|
||||
}
|
||||
HardwareRecords[0].Update(analog, squib, din, dout, ecm, sps, spt, spd, g5, rack);
|
||||
|
||||
DasSummaryList = moduleRecords;
|
||||
|
||||
SetStatus(hardwareRecords.Any()
|
||||
? Resources.StringResources.ImportTestSetup_PossibleStatus_Done
|
||||
: Resources.StringResources.ImportTestSetup_PossibleStatus_Failed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// counts the number of analog/squib/digitalin/digitalout on given hardware and updates count
|
||||
/// </summary>
|
||||
/// <param name="hardwareRecord"></param>
|
||||
/// <param name="analog"></param>
|
||||
/// <param name="squib"></param>
|
||||
/// <param name="din"></param>
|
||||
/// <param name="dout"></param>
|
||||
private static void UpdateChannelCount(IDASHardware hardwareRecord, ref uint analog, ref uint squib, ref uint din,
|
||||
ref uint dout)
|
||||
{
|
||||
var channels = hardwareRecord.GetIHardwareChannels();
|
||||
for (var i = 0; i < channels.Length; i++)
|
||||
{
|
||||
var ch = channels[i];
|
||||
if (ch.IsAnalog)
|
||||
{
|
||||
analog++;
|
||||
}
|
||||
else if (ch.IsDigitalIn)
|
||||
{
|
||||
din++;
|
||||
}
|
||||
else if (ch.IsDigitalOut)
|
||||
{
|
||||
dout++;
|
||||
}
|
||||
else if (ch.IsSquib)
|
||||
{
|
||||
squib++;
|
||||
i++;//skip the next squib
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets a global dictionary to be used by SetChannelSummaryList
|
||||
/// </summary>
|
||||
private void OnAssignedChannelsChangedEvent(ITTSSetup setup)
|
||||
{
|
||||
SetChannelSummaryList(_setup.Channels);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill in the table of channels that were found in the Read File step
|
||||
/// </summary>
|
||||
/// <param name="channelRecords"></param>
|
||||
public void SetChannelSummaryList(ITTSChannelRecord[] channelRecords)
|
||||
{
|
||||
const int Requested = 0;
|
||||
const int Assigned = 1;
|
||||
const int Unassigned = 2;
|
||||
|
||||
var tomChannels = new[] { 0, 0, 0 };
|
||||
var digitalInChannels = new[] { 0, 0, 0 };
|
||||
var analogChannels = new[] { 0, 0, 0 };
|
||||
|
||||
foreach (var channelRecord in channelRecords)
|
||||
{
|
||||
if (string.Equals(channelRecord.ChannelCode, TTSChannelRecord.NONE, StringComparison.CurrentCultureIgnoreCase)) continue;
|
||||
if (channelRecord.IsSquib)
|
||||
{
|
||||
tomChannels[Requested] += 1;
|
||||
if (channelRecord.HardwareChannel != null && channelRecord.HardwareChannel.IsSquib)
|
||||
{
|
||||
tomChannels[Assigned] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tomChannels[Unassigned] += 1;
|
||||
}
|
||||
}
|
||||
else if (channelRecord.IsDigitalInput)
|
||||
{
|
||||
digitalInChannels[Requested] += 1;
|
||||
if (channelRecord.HardwareChannel != null && channelRecord.HardwareChannel.IsDigitalIn)
|
||||
{
|
||||
digitalInChannels[Assigned] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalInChannels[Unassigned] += 1;
|
||||
}
|
||||
}
|
||||
else if (!channelRecord.IsDigitalOutput)
|
||||
{
|
||||
//Must be analog
|
||||
analogChannels[Requested] += 1;
|
||||
if (channelRecord.HardwareChannel != null && channelRecord.HardwareChannel.IsAnalog)
|
||||
{
|
||||
analogChannels[Assigned] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
analogChannels[Unassigned] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
var temp = new List<ChannelSummary>();
|
||||
var channel = new ChannelSummary
|
||||
{
|
||||
ChannelType = Resources.StringResources.Analog,
|
||||
Requested = analogChannels[Requested],
|
||||
Assigned = analogChannels[Assigned],
|
||||
Unassigned = analogChannels[Unassigned],
|
||||
};
|
||||
temp.Add(channel);
|
||||
|
||||
channel = new ChannelSummary
|
||||
{
|
||||
ChannelType = Resources.StringResources.TOM,
|
||||
Requested = tomChannels[Requested],
|
||||
Assigned = tomChannels[Assigned],
|
||||
Unassigned = tomChannels[Unassigned],
|
||||
};
|
||||
temp.Add(channel);
|
||||
|
||||
channel = new ChannelSummary
|
||||
{
|
||||
ChannelType = Resources.StringResources.DigitalIn,
|
||||
Requested = digitalInChannels[Requested],
|
||||
Assigned = digitalInChannels[Assigned],
|
||||
Unassigned = digitalInChannels[Unassigned],
|
||||
};
|
||||
temp.Add(channel);
|
||||
|
||||
ChannelSummaryList = temp;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
private ITTSSetup _setup;
|
||||
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy = false;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded = false;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded = false;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private List<IDASHardware> _dasSummaryList = new List<IDASHardware>();
|
||||
|
||||
public List<IDASHardware> DasSummaryList
|
||||
{
|
||||
get => _dasSummaryList;
|
||||
set
|
||||
{
|
||||
_dasSummaryList = value;
|
||||
OnPropertyChanged("DasSummaryList");
|
||||
}
|
||||
}
|
||||
|
||||
private readonly IHardwareSummaryRecord[] _hardwareRecords = { new HardwareSummaryRecord() };
|
||||
public IHardwareSummaryRecord[] HardwareRecords => _hardwareRecords;
|
||||
|
||||
private List<ChannelSummary> _channelSummaryList = new List<ChannelSummary>();
|
||||
|
||||
public List<ChannelSummary> ChannelSummaryList
|
||||
{
|
||||
get => _channelSummaryList;
|
||||
set
|
||||
{
|
||||
_channelSummaryList = value;
|
||||
OnPropertyChanged("ChannelSummaryList");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
///Occurs when a property value changes.
|
||||
///</summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,481 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Events.TTSImport;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.DIChannels;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
using TTSImport.Model;
|
||||
using TTSImport.Resources;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Level Trigger edit/create functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class DigitalInputChannelsViewModel : IDigitalInputChannelsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public IDigitalInputChannelsView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="view">The IDigitalInputChannelsView.</param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public DigitalInputChannelsViewModel(IDigitalInputChannelsView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = view;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>()
|
||||
.Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<AssignedChannelsChangedEvent>().Subscribe(OnAssignedChannelsChangedEvent,
|
||||
ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanFinishedEvent>()
|
||||
.Subscribe(OnHardwareScanComplete, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
private void OnHardwareScanComplete(List<IDASHardware> hardware)
|
||||
{
|
||||
_hardware = hardware;
|
||||
}
|
||||
|
||||
private void OnAssignedChannelsChangedEvent(ITTSSetup setup)
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
OnAssignedChannelsChangedEvent(setup);
|
||||
}));
|
||||
return;
|
||||
}
|
||||
_setup = setup;
|
||||
if (null == _hardware || null == _setup) { return; }
|
||||
var channels = new ObservableCollection<DASChannel>();
|
||||
var remainingChannels = new ObservableCollection<ITTSChannelRecord>();
|
||||
var channelIdToChannelRecord = new Dictionary<string, DASChannel>();
|
||||
foreach (var das in _hardware)
|
||||
{
|
||||
var ichannels = das.GetIHardwareChannels();
|
||||
foreach (var ch in ichannels)
|
||||
{
|
||||
if (!ch.IsDigitalIn) { continue; }
|
||||
var newChannel = new DASChannel(ch);
|
||||
channels.Add(newChannel);
|
||||
channelIdToChannelRecord[ch.GetId()] = newChannel;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var channelRecord in _setup.Channels)
|
||||
{
|
||||
if (channelRecord.IsEmptyRecord)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!channelRecord.IsDigitalInput)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!channelRecord.IsChannelCodeValid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (channelRecord.ChannelCode == TTSChannelRecord.NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (null != channelRecord.HardwareChannel &&
|
||||
channelIdToChannelRecord.ContainsKey(channelRecord.HardwareChannel.GetId()))
|
||||
{
|
||||
channelIdToChannelRecord[channelRecord.HardwareChannel.GetId()].SetITTSChannelRecord(channelRecord);
|
||||
}
|
||||
else
|
||||
{
|
||||
remainingChannels.Add(channelRecord);
|
||||
}
|
||||
}
|
||||
|
||||
DASChannels = channels;
|
||||
RemainingChannels = remainingChannels;
|
||||
OnPropertyChanged("DASChannels");
|
||||
OnPropertyChanged("RemainingChannels");
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private ITTSSetup _setup;
|
||||
private IList<IDASHardware> _hardware;
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
public bool AssignEnabled { get; set; }
|
||||
public bool RemoveEnabled { get; set; }
|
||||
public bool EnableOrDisableEnabled { get; set; }
|
||||
public ObservableCollection<DASChannel> DASChannels { get; set; } = new ObservableCollection<DASChannel>();
|
||||
public ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; } =
|
||||
new ObservableCollection<ITTSChannelRecord>();
|
||||
|
||||
private ITTSChannelRecord _selectedRemainingChannel;
|
||||
public ITTSChannelRecord SelectedRemainingChannel
|
||||
{
|
||||
get => _selectedRemainingChannel;
|
||||
set
|
||||
{
|
||||
_selectedRemainingChannel = value;
|
||||
if (null == _selectedRemainingChannel || null == SelectedDASChannel) return;
|
||||
AssignEnabled = true;
|
||||
OnPropertyChanged("AssignEnabled");
|
||||
}
|
||||
}
|
||||
private DASChannel _selectedDASChannel;
|
||||
public DASChannel SelectedDASChannel
|
||||
{
|
||||
get => _selectedDASChannel;
|
||||
set
|
||||
{
|
||||
_selectedDASChannel = value;
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
}
|
||||
private void DetermineRemoveEnableStatus()
|
||||
{
|
||||
if (_selectedDASChannel?.Channel != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_selectedDASChannel.EID) &&
|
||||
_selectedDASChannel.EID == _selectedDASChannel.Channel.SensorEID)
|
||||
{
|
||||
//can only be replaced, can't be removed
|
||||
RemoveEnabled = false;
|
||||
}
|
||||
RemoveEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveEnabled = false;
|
||||
}
|
||||
OnPropertyChanged("RemoveEnabled");
|
||||
AssignEnabled = null != _selectedDASChannel && null != _selectedRemainingChannel;
|
||||
OnPropertyChanged("AssignEnabled");
|
||||
EnableOrDisableEnabled = _selectedDASChannel?.Channel != null;
|
||||
OnPropertyChanged("EnableOrDisableEnabled");
|
||||
OnPropertyChanged("EnableOrDisableText");
|
||||
}
|
||||
public string EnableOrDisableText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null)
|
||||
{
|
||||
return StringResources.Analog_Enable;
|
||||
}
|
||||
return SelectedDASChannel.Channel.Disabled
|
||||
? StringResources.Analog_Enable
|
||||
: StringResources.Analog_Disable;
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
#region assign
|
||||
/// <summary>
|
||||
/// Assign a channel code to a channel
|
||||
/// </summary>
|
||||
private DelegateCommand _assignCommand;
|
||||
public DelegateCommand AssignCommand => _assignCommand ?? (_assignCommand = new DelegateCommand(Assign));
|
||||
private void Assign()
|
||||
{
|
||||
if (SelectedRemainingChannel == null) { return; }
|
||||
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
//BEFORE we go any further, check the state of sensor ids
|
||||
//if the channel has a sensor id AND there's a sensor on the channel with the same id
|
||||
//then prompt on replacing the id
|
||||
//IF the channel has a sensor id and there's no sensor on the channel BUT the new sensor has a different id
|
||||
//then prompt on replacing the id
|
||||
var bReplacingID = false;
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
if (null != SelectedRemainingChannel && SelectedRemainingChannel.SensorEID != SelectedDASChannel.EID)
|
||||
{
|
||||
bReplacingID = true;
|
||||
}
|
||||
//if existing channel has this ID, we will need to clear out the old id and assign a new one...
|
||||
if (null != SelectedDASChannel.Channel && SelectedDASChannel.Channel.SensorEID == SelectedDASChannel.EID)
|
||||
{
|
||||
bReplacingID = true;
|
||||
}
|
||||
}
|
||||
if (bReplacingID)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var dialogResult = MessageBox.Show(StringResources.AssignSensorPrompt, StringResources.UserFeedbackRequired, MessageBoxButton.YesNo);
|
||||
if (dialogResult == MessageBoxResult.Yes)
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(AssignWork));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
AssignWork();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// assigns a channel record to a physical channel
|
||||
/// </summary>
|
||||
private void AssignWork()
|
||||
{
|
||||
if (null != SelectedDASChannel.Channel)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
SelectedDASChannel.Channel.SensorEID = "";
|
||||
}
|
||||
RemainingChannels.Add(SelectedDASChannel.Channel);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(SelectedDASChannel.EID))
|
||||
{
|
||||
SelectedRemainingChannel.SensorEID = SelectedDASChannel.EID;
|
||||
}
|
||||
|
||||
SelectedRemainingChannel.DigitalInputMode = DTS.Common.Enums.DigitalInputModes.CCNO;
|
||||
SelectedDASChannel.SetITTSChannelRecord(SelectedRemainingChannel);
|
||||
|
||||
var channel = SelectedRemainingChannel;
|
||||
var index = RemainingChannels.IndexOf(channel);
|
||||
SelectedRemainingChannel = null;
|
||||
RemainingChannels.Remove(channel);
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
if (index < RemainingChannels.Count)
|
||||
{
|
||||
SelectedRemainingChannel = RemainingChannels[index];
|
||||
OnPropertyChanged("SelectedRemainingChannel");
|
||||
}
|
||||
else if (RemainingChannels.Count > 0)
|
||||
{
|
||||
SelectedRemainingChannel = RemainingChannels[index - 1];
|
||||
OnPropertyChanged("SelectedRemainingChannel");
|
||||
}
|
||||
index = DASChannels.IndexOf(SelectedDASChannel);
|
||||
for (var i = index; i < DASChannels.Count; i++)
|
||||
{
|
||||
var dasChannel = DASChannels[i];
|
||||
if (null != dasChannel.Channel) { continue; }
|
||||
SelectedDASChannel = dasChannel;
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//didn't find a match, start from the beginning?
|
||||
for (var i = 0; i < index; i++)
|
||||
{
|
||||
var dasChannel = DASChannels[i];
|
||||
if (null != dasChannel.Channel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SelectedDASChannel = dasChannel;
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//if we get here there's no new channel to go to, but we need to set the remove/enable/disable button status
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
#endregion
|
||||
#region remove
|
||||
private DelegateCommand _removeCommand;
|
||||
public DelegateCommand RemoveCommand => _removeCommand ?? (_removeCommand = new DelegateCommand(Remove));
|
||||
/// <summary>
|
||||
/// remove a hardware channel assignment (does not remove the channel from the test setup though?)
|
||||
/// </summary>
|
||||
private void Remove()
|
||||
{
|
||||
if (null == SelectedDASChannel || null == SelectedDASChannel.Channel) { return; }
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
RemainingChannels.Add(SelectedDASChannel.Channel);
|
||||
SelectedDASChannel.SetITTSChannelRecord(null);
|
||||
CollectionViewSource.GetDefaultView(DASChannels)?.Refresh();
|
||||
var index = DASChannels.IndexOf(SelectedDASChannel);
|
||||
for (var i = index; i < DASChannels.Count; i++)
|
||||
{
|
||||
if (null == DASChannels[i].Channel) { continue; }
|
||||
SelectedDASChannel = DASChannels[i];
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < index; i++)
|
||||
{
|
||||
if (null == DASChannels[i].Channel) { continue; }
|
||||
SelectedDASChannel = DASChannels[i];
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
return;
|
||||
}
|
||||
//if we get here there's no new channel to go to, but we need to set the remove/enable/disable button status
|
||||
OnPropertyChanged("SelectedDASChannel");
|
||||
DetermineRemoveEnableStatus();
|
||||
}
|
||||
#endregion
|
||||
#region enableordisable
|
||||
private DelegateCommand _enableOrDisableCommand;
|
||||
public DelegateCommand EnableOrDisableCommand =>
|
||||
_enableOrDisableCommand ?? (_enableOrDisableCommand = new DelegateCommand(EnableOrDisable));
|
||||
/// <summary>
|
||||
/// enables or disables a channel in the test.
|
||||
/// </summary>
|
||||
private void EnableOrDisable()
|
||||
{
|
||||
if (SelectedDASChannel?.Channel == null) { return; }
|
||||
SelectedDASChannel.Channel.Disabled = !SelectedDASChannel.Channel.Disabled;
|
||||
SelectedDASChannel.Disabled = SelectedDASChannel.Channel.Disabled;
|
||||
|
||||
OnPropertyChanged("EnableOrDisableText");
|
||||
_eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Publish(_setup);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.LevelTrigger;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using System.Security.Cryptography;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
|
||||
namespace TTSImport.Model
|
||||
{
|
||||
public class TTSTestSetup : ITTSSetup
|
||||
{
|
||||
public double SampleRate { get; set; }
|
||||
public RecordingModes Mode { get; set; }
|
||||
public double TestLength => PreTrigger + PostTrigger;
|
||||
public double PreTrigger { get; set; }
|
||||
public double PostTrigger { get; set; }
|
||||
public double ROIStart { get; set; }
|
||||
public double ROIEnd { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public string TestId { get; set; }
|
||||
/// <summary>
|
||||
/// The first 4 lines of the .csv file are needed if a new .csv is to be created
|
||||
/// </summary>
|
||||
public string Line1 { get; set; }
|
||||
public string Line2 { get; set; }
|
||||
public string Line3 { get; set; }
|
||||
public string Line4 { get; set; }
|
||||
public string[] DummyList { get; set; }
|
||||
public ITTSChannelRecord[] Channels { get; set; }
|
||||
public ILevelTrigger[] LevelTriggers { get; set; }
|
||||
public string OriginalImportFile { get; set; }
|
||||
/// <summary>
|
||||
/// If True, HybridRecorder is added to CircularBuffer and Recorder as choices.
|
||||
/// </summary>
|
||||
public bool AllowAdvancedRecordingModes { get; set; }
|
||||
/// <summary>
|
||||
/// if True, Active Ram and Active Ram Multiple events are valid modes
|
||||
/// http://manuscript.dts.local/f/cases/31841/Add-support-for-Active-RAM-mode
|
||||
/// </summary>
|
||||
public bool AllowActiveRecordingModes { get; set; }
|
||||
public bool AllowTSRAIRRecordingModes { get; set; }
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// allows consumers to specify whether EIDs must be found for sensors to be used
|
||||
/// </summary>
|
||||
public bool RequireEIDFound { get; set; }
|
||||
/// <summary>
|
||||
/// The value from DataPRO.config.exe
|
||||
/// </summary>
|
||||
public string DefaultDigitalInputMode { get; set; }
|
||||
public ISquibSettingDefaults SquibDefaults { get; set; }
|
||||
/// <summary>
|
||||
/// The value from DataPRO.config.exe
|
||||
/// </summary>
|
||||
public double DefaultSquibFireDurationMs { get; set; }
|
||||
/// <summary>
|
||||
/// this holds sensor to hardware assignments that are pre-existing before the user even scans hardware
|
||||
/// this can only happen through the XML import
|
||||
/// the assignments are removed once they are made, but persist across hardware scans until they are made (for instance if the hardware
|
||||
/// is not present in the first hardwarescan the assignments will remain till the hardware is found).
|
||||
/// this is not true if the user has already manually assigned the channel
|
||||
/// </summary>
|
||||
public Tuple<string, string>[] PreAssignedSensorIdAndHwId { get; set; }
|
||||
|
||||
private const int NUM_LEVEL_TRIGGERS = 6;
|
||||
public TTSTestSetup()
|
||||
{
|
||||
DummyList = new string[8];
|
||||
Channels = new ITTSChannelRecord[0];
|
||||
LevelTriggers = new ILevelTrigger[NUM_LEVEL_TRIGGERS];
|
||||
for (var i = 0; i < NUM_LEVEL_TRIGGERS; i++)
|
||||
{
|
||||
LevelTriggers[i] = new TTSLevelTriggerRecord(this);
|
||||
}
|
||||
}
|
||||
|
||||
public new string GetHashCode()
|
||||
{
|
||||
var bytes = new List<byte>();
|
||||
bytes.AddRange(BitConverter.GetBytes(SampleRate));
|
||||
bytes.AddRange(BitConverter.GetBytes((int)Mode));
|
||||
bytes.AddRange(BitConverter.GetBytes(PreTrigger));
|
||||
bytes.AddRange(BitConverter.GetBytes(PostTrigger));
|
||||
bytes.AddRange(BitConverter.GetBytes(ROIStart));
|
||||
bytes.AddRange(BitConverter.GetBytes(ROIEnd));
|
||||
bytes.AddRange(Encoding.UTF8.GetBytes(TestId ?? ""));
|
||||
|
||||
foreach (var ch in Channels)
|
||||
{
|
||||
bytes.AddRange(ch.GetBytes());
|
||||
}
|
||||
|
||||
foreach (var lt in LevelTriggers)
|
||||
{
|
||||
bytes.AddRange(lt.GetBytes());
|
||||
}
|
||||
var sha = new SHA256Managed();
|
||||
var hash = sha.ComputeHash(bytes.ToArray());
|
||||
var hashString = BitConverter.ToString(hash).Replace("-", string.Empty);
|
||||
return hashString;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using DTS.Common.Interface;
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ReadFileView.xaml
|
||||
/// </summary>
|
||||
public partial class ReadFileView : IReadFileView
|
||||
{
|
||||
public ReadFileView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Connect(int connectionId, object target)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.DAS.Concepts;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Events.TTSImport;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.LevelTrigger;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
|
||||
using Prism.Events;
|
||||
using Unity;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Regions;
|
||||
using Prism.Commands;
|
||||
using TTSImport.Model;
|
||||
using TTSImport.Resources;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class handles Level Trigger edit/create functionality
|
||||
/// </summary>
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class LevelTriggerViewModel : ILevelTriggerViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The Hardware Scan view
|
||||
/// </summary>
|
||||
public ILevelTriggerView View { get; set; }
|
||||
|
||||
private IEventAggregator _eventAggregator { get; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="levelTriggerView">The Level Trigger View.</param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public LevelTriggerViewModel(ILevelTriggerView levelTriggerView, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
View = levelTriggerView;
|
||||
View.DataContext = this;
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
UnityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>().Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportReadFileStatusEvent>().Subscribe(OnReadFileFinished, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<EIDMappingEvent>().Subscribe(OnEIDMapping, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportHardwareScanFinishedEvent>().Subscribe(OnHardwareScanFinished, ThreadOption.PublisherThread, true);
|
||||
_eventAggregator.GetEvent<TTSImportSavedChangesStatusEvent>().Subscribe(OnImportSavedChanges, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
|
||||
private void OnImportSavedChanges(bool bSaved)
|
||||
{
|
||||
if (bSaved)
|
||||
{
|
||||
UpdateLevelTriggers();
|
||||
}
|
||||
}
|
||||
private void OnHardwareScanFinished(List<IDASHardware> hardware)
|
||||
{
|
||||
_hardware = hardware;
|
||||
}
|
||||
|
||||
private void OnReadFileFinished(ReadFileStatusArg statusArg)
|
||||
{
|
||||
if (statusArg.Status)
|
||||
{
|
||||
_setup = statusArg.TTSSetup;
|
||||
}
|
||||
}
|
||||
|
||||
private IDictionary<string, string> _sensorIdToChannelId = new Dictionary<string, string>();
|
||||
private void OnEIDMapping(IDictionary<string, string> sensorIdToChannelId)
|
||||
{
|
||||
_sensorIdToChannelId = sensorIdToChannelId;
|
||||
UpdateLevelTriggers();
|
||||
}
|
||||
|
||||
private void UpdateLevelTriggers()
|
||||
{
|
||||
if (null == _setup)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (null == _hardware || !_hardware.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
var channelIdToDASChannel = new Dictionary<string, DASChannel>();
|
||||
var channelIdToIChannel = new Dictionary<string, IHardwareChannel>();
|
||||
var availableSquibChannels = new Queue<IHardwareChannel>();
|
||||
var availableDigitalInputChannels = new Queue<IHardwareChannel>();
|
||||
foreach (var h in _hardware)
|
||||
{
|
||||
var channels = h.GetIHardwareChannels();
|
||||
foreach (var ch in channels)
|
||||
{
|
||||
//Create a DASChannel so that voltage can be validated below
|
||||
channelIdToDASChannel[ch.GetId()] = new DASChannel(ch);
|
||||
channelIdToIChannel[ch.GetId()] = ch;
|
||||
if (ch.IsDigitalIn)
|
||||
{
|
||||
availableDigitalInputChannels.Enqueue(ch);
|
||||
}
|
||||
else if (ch.IsSquib)
|
||||
{
|
||||
availableSquibChannels.Enqueue(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
//handle pre-assigned channels if any
|
||||
//these are channels which we know the sensor should be assigned to a given hardware channel ahead of time
|
||||
//we do this before the EID check so that EID will override it
|
||||
if (_setup.PreAssignedSensorIdAndHwId.Any())
|
||||
{
|
||||
var remainingPreassigned = new List<Tuple<string, string>>();
|
||||
foreach (var tuple in _setup.PreAssignedSensorIdAndHwId)
|
||||
{
|
||||
var sensorId = tuple.Item1;
|
||||
var hwId = tuple.Item2;
|
||||
if (!channelIdToIChannel.ContainsKey(hwId))
|
||||
{
|
||||
remainingPreassigned.Add(tuple);
|
||||
continue;
|
||||
}
|
||||
var matches = from ch in _setup.Channels where ch.SensorSerialNumber == sensorId select ch;
|
||||
if (matches.Any())
|
||||
{
|
||||
var ittsChannel = matches.First();
|
||||
//do not make the assignment if the user has already assigned the channel to a different hardware channel
|
||||
//this would happen if the user scanned, didn't find the hardware, went to analog channels, assigned the sensor
|
||||
//then finally went to hardware scan and then DID find the hardware. in this case just ignore the preassignment
|
||||
if (null == ittsChannel.HardwareChannel)
|
||||
{
|
||||
var hardwareChannel = channelIdToIChannel[hwId];
|
||||
var excitation = Test.Module.Channel.Sensor.GetExcitationVoltageEnumFromMagnitude(ittsChannel.SensorExcitationVolts);
|
||||
//if we have a hardware assignment, but the excitation is no longer valid, then don't make the assignment
|
||||
if (hardwareChannel.IsAnalog && !hardwareChannel.IsSupportedExcitation(excitation))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ittsChannel.HardwareChannel = hardwareChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if there are any remaining channels, these are hardware assignments that we didn't find hardware for, and we still need
|
||||
//to look for assignment
|
||||
_setup.PreAssignedSensorIdAndHwId = remainingPreassigned.ToArray();
|
||||
}
|
||||
|
||||
foreach (var channel in _setup.Channels)
|
||||
{
|
||||
if (null != channel.HardwareChannel &&
|
||||
!channelIdToIChannel.ContainsKey(channel.HardwareChannel.GetId()))
|
||||
{
|
||||
//hardware no longer present, unassign
|
||||
channel.HardwareChannel = null;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(channel.SensorEID))
|
||||
{
|
||||
//11245 TOM and DI channels in TTS imports without IDs should have sensors assigned automatically
|
||||
if (channel.IsSquib)
|
||||
{
|
||||
if (availableSquibChannels.Any())
|
||||
{
|
||||
var first = availableSquibChannels.Dequeue();
|
||||
channel.HardwareChannel = first;
|
||||
//first channel voltage/initiation, second current, etc
|
||||
var second = availableSquibChannels.Dequeue();
|
||||
}
|
||||
}
|
||||
else if (channel.IsDigitalInput)
|
||||
{
|
||||
if (availableDigitalInputChannels.Any())
|
||||
{
|
||||
var first = availableDigitalInputChannels.Dequeue();
|
||||
channel.HardwareChannel = first;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_sensorIdToChannelId.ContainsKey(channel.SensorEID) ||
|
||||
!channelIdToDASChannel.ContainsKey(_sensorIdToChannelId[channel.SensorEID]) ||
|
||||
!VoltageIsValid(channel, channelIdToDASChannel[_sensorIdToChannelId[channel.SensorEID]])
|
||||
//the below condition I think was missing a not, it appears to be looking for channels that don't have a valid channel code
|
||||
//but DO have a valid match for sensor id ... this is probably a reserve channel where the sensor was still found that it's looking for
|
||||
//15643 Sensors with EID do not remain assigned after import of XML produced from TTS import
|
||||
//changed it again ... this is inhibiting sensors from being assigned, additionally tested it with a sensor without a valid channel code but
|
||||
//a valid eid, and it worked fine
|
||||
|| (_sensorIdToChannelId.ContainsKey(channel.SensorEID) && !channel.IsChannelCodeValid)
|
||||
)
|
||||
{
|
||||
//unassign hardware if one is assigned, sensor id wasn't found or the sensor has an invalid excitation voltage for this hardware
|
||||
//or the channel does have a jcode
|
||||
channel.HardwareChannel = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
var channelId = _sensorIdToChannelId[channel.SensorEID];
|
||||
if (!channelIdToIChannel.ContainsKey(channelId)) continue;
|
||||
channel.HardwareChannel = channelIdToIChannel[channelId];
|
||||
}
|
||||
|
||||
|
||||
foreach (var lt in _setup.LevelTriggers)
|
||||
{
|
||||
lt.Refresh();
|
||||
}
|
||||
OnPropertyChanged("LevelTriggers");
|
||||
_eventAggregator.GetEvent<AssignedChannelsChangedEvent>().Publish(_setup);
|
||||
CollectionViewSource.GetDefaultView(LevelTriggers)?.Refresh();
|
||||
}
|
||||
/// <summary>
|
||||
/// returns True if the sensor's voltage is supported by the hardware channel, False if not
|
||||
/// </summary>
|
||||
/// <param name="selectedRemainingChannel"></param>
|
||||
/// <param name="selectedDASChannel"></param>
|
||||
/// <returns></returns>
|
||||
private bool VoltageIsValid(ITTSChannelRecord selectedRemainingChannel, DASChannel selectedDASChannel)
|
||||
{
|
||||
var voltageEnum = ExcitationVoltageOptions.ExcitationVoltageOption.Undefined;
|
||||
try
|
||||
{
|
||||
voltageEnum = Test.Module.Channel.Sensor.GetExcitationVoltageEnumFromMagnitude(selectedRemainingChannel.SensorExcitationVolts);
|
||||
}
|
||||
catch { } //GetExcitationVoltageEnumFromMagnitude will throw an exception if an invalid voltage is passed to it
|
||||
|
||||
return selectedDASChannel.HardwareChannel.IsSupportedExcitation(voltageEnum);
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
}
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InitializeAsync(object parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the PopupWindowAction object to show the NotificationWindow window
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "",
|
||||
eventArgsWithTitle.Image, string.Empty);
|
||||
|
||||
NotificationRequest.Raise(new Notification
|
||||
{
|
||||
Content = eventArgsWithoutTitle,
|
||||
Title = eventArgsWithTitle.Title
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
private IList<IDASHardware> _hardware;
|
||||
private ITTSSetup _setup;
|
||||
public ILevelTrigger[] LevelTriggers => _setup?.LevelTriggers;
|
||||
public bool IsDirty { get; private set; }
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged("IsBusy");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded;
|
||||
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get => _isMenuIncluded;
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isNavigationIncluded;
|
||||
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get => _isNavigationIncluded;
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Commands
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
///Occurs when a property value changes.
|
||||
///</summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <inheritdoc cref="IDigitalOutputChannelsView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for HardwareScanView.xaml
|
||||
/// </summary>
|
||||
public partial class DigitalOutputChannelsView : IDigitalOutputChannelsView
|
||||
{
|
||||
public DigitalOutputChannelsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Interface;
|
||||
|
||||
namespace TTSImport.Model
|
||||
{
|
||||
public class ChannelSummary : IChannelSummary
|
||||
{
|
||||
private string _channelType = String.Empty;
|
||||
public string ChannelType { get => _channelType; set { _channelType = value; OnPropertyChanged("ChannelType"); } }
|
||||
|
||||
private int _requested = 0;
|
||||
public int Requested { get => _requested; set { _requested = value; OnPropertyChanged("Requested"); } }
|
||||
|
||||
private int _assigned = 0;
|
||||
public int Assigned { get => _assigned; set { _assigned = value; OnPropertyChanged("Assigned"); } }
|
||||
|
||||
private int _unassigned = 0;
|
||||
public int Unassigned { get => _unassigned; set { _unassigned = value; OnPropertyChanged("Unassigned"); } }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Interface;
|
||||
|
||||
namespace TTSImport.Model
|
||||
{
|
||||
public class DasSummary : IDasSummary
|
||||
{
|
||||
private string _dasSerial;
|
||||
public string DASSerial { get => _dasSerial; set { _dasSerial = value; OnPropertyChanged("DASSerial"); } }
|
||||
|
||||
private string _eidFound;
|
||||
public string EIDFound { get => _eidFound; set { _eidFound = value; OnPropertyChanged("EIDFound"); } }
|
||||
|
||||
private string _batteryVoltageStatus;
|
||||
public string BatteryVoltageStatus { get => _batteryVoltageStatus; set { _batteryVoltageStatus = value; OnPropertyChanged("BatteryVoltageStatus"); } }
|
||||
|
||||
private System.Windows.Media.SolidColorBrush _batteryVoltageColor;
|
||||
public System.Windows.Media.SolidColorBrush BatteryVoltageColor { get => _batteryVoltageColor; set { _batteryVoltageColor = value; OnPropertyChanged("BatteryVoltageColor"); } }
|
||||
|
||||
private string _inputVoltageStatus;
|
||||
public string InputVoltageStatus { get => _inputVoltageStatus; set { _inputVoltageStatus = value; OnPropertyChanged("InputVoltageStatus"); } }
|
||||
|
||||
private System.Windows.Media.SolidColorBrush _inputVoltageColor;
|
||||
public System.Windows.Media.SolidColorBrush InputVoltageColor { get => _inputVoltageColor; set { _inputVoltageColor = value; OnPropertyChanged("InputVoltageColor"); } }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace TTSImport
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HardwareScanView.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogChannelsView : IAnalogChannelsView
|
||||
{
|
||||
public AnalogChannelsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Interface.TestSetups.Imports.TTS.HardwareScan;
|
||||
|
||||
namespace TTSImport.Model
|
||||
{
|
||||
public class HardwareSummaryRecord : BasePropertyChanged, IHardwareSummaryRecord
|
||||
{
|
||||
private uint _dout;
|
||||
public uint DOut
|
||||
{
|
||||
get => _dout;
|
||||
set
|
||||
{
|
||||
_dout = value;
|
||||
OnPropertyChanged("DOut");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _din;
|
||||
|
||||
public uint DIn
|
||||
{
|
||||
get => _din;
|
||||
set
|
||||
{
|
||||
_din = value;
|
||||
OnPropertyChanged("DIn");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _squib;
|
||||
|
||||
public uint Squib
|
||||
{
|
||||
get => _squib;
|
||||
set
|
||||
{
|
||||
_squib = value;
|
||||
OnPropertyChanged("Squib");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _analog;
|
||||
|
||||
public uint Analog
|
||||
{
|
||||
get => _analog;
|
||||
set
|
||||
{
|
||||
_analog = value;
|
||||
OnPropertyChanged("Analog");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _sps;
|
||||
|
||||
public uint SPS
|
||||
{
|
||||
get => _sps;
|
||||
set
|
||||
{
|
||||
_sps = value;
|
||||
OnPropertyChanged("SPS");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _spd;
|
||||
|
||||
public uint SPD
|
||||
{
|
||||
get => _spd;
|
||||
set
|
||||
{
|
||||
_spd = value;
|
||||
OnPropertyChanged("SPD");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _spt;
|
||||
|
||||
public uint SPT
|
||||
{
|
||||
get => _spt;
|
||||
set
|
||||
{
|
||||
_spt = value;
|
||||
OnPropertyChanged("SPT");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _ecm;
|
||||
|
||||
public uint ECM
|
||||
{
|
||||
get => _ecm;
|
||||
set
|
||||
{
|
||||
_ecm = value;
|
||||
OnPropertyChanged("ECM");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _rack;
|
||||
|
||||
public uint Rack
|
||||
{
|
||||
get => _rack;
|
||||
set
|
||||
{
|
||||
_rack = value;
|
||||
OnPropertyChanged("Rack");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _g5;
|
||||
|
||||
public uint G5
|
||||
{
|
||||
get => _g5;
|
||||
set
|
||||
{
|
||||
_g5 = value;
|
||||
OnPropertyChanged("G5");
|
||||
}
|
||||
}
|
||||
|
||||
private uint _total;
|
||||
|
||||
public uint Total
|
||||
{
|
||||
get => _total;
|
||||
private set
|
||||
{
|
||||
_total = value;
|
||||
OnPropertyChanged("Total");
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTotal()
|
||||
{
|
||||
Total = Analog + Squib + DIn + DOut;
|
||||
}
|
||||
|
||||
public void Update(uint analog, uint squib, uint din, uint dout, uint ecm, uint sps, uint spt, uint spd,
|
||||
uint g5,
|
||||
uint rack)
|
||||
{
|
||||
Analog = analog;
|
||||
Squib = squib;
|
||||
DIn = din;
|
||||
DOut = dout;
|
||||
ECM = ecm;
|
||||
SPS = sps;
|
||||
SPT = spt;
|
||||
SPD = spd;
|
||||
G5 = g5;
|
||||
Rack = rack;
|
||||
UpdateTotal();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Threading;
|
||||
|
||||
namespace TTSImport.Model
|
||||
{
|
||||
public class WorkFunctionThreadData
|
||||
{
|
||||
public ManualResetEvent CancelEvent { get; }
|
||||
public ManualResetEvent DoneEvent { get; }
|
||||
|
||||
public WorkFunctionThreadData()
|
||||
{
|
||||
CancelEvent = new ManualResetEvent(false);
|
||||
DoneEvent = new ManualResetEvent(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user