init
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
using DTS.Common.Enums.DASFactory;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
|
||||
namespace DTS.Common.Interface.DASFactory.Config
|
||||
{
|
||||
public interface IDASChannel
|
||||
{
|
||||
DFConstantsAndEnums.ConfigMode ConfigurationMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// whether the channel should be put in Diagnostics mode or not
|
||||
/// </summary>
|
||||
bool DiagnosticsMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Channel number with respect to it's containing module <see cref="OwningModule"/>
|
||||
/// </summary>
|
||||
int ModuleChannelNumber { get; set; }
|
||||
|
||||
int AbsoluteDisplayOrder { get; set; }
|
||||
|
||||
double UnitConverision { get; set; }
|
||||
|
||||
bool AtCapacity { get; set; }
|
||||
|
||||
double CapacityOutputIsBasedOn { get; set; }
|
||||
|
||||
SensorConstants.SensUnits SensitivityUnits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A link back to the Module that contains this channel.
|
||||
/// </summary>
|
||||
//public DASModule OwningModule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The "stack channel number" of this channel with respect to the owning
|
||||
/// DAS (0 based).
|
||||
/// </summary>
|
||||
byte Number { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Array of (string, byte[]) for EID
|
||||
/// </summary>
|
||||
IEID[] IDs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// time stamp of this event
|
||||
/// </summary>
|
||||
DateTime EventStartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="bool"/> value indicating whether or not this channel has registered a level trigger.
|
||||
/// </summary>
|
||||
bool LevelTriggerSeen { get; set; }
|
||||
|
||||
string IsoChannelName { get; set; }
|
||||
string ChannelGroupName { get; set; }
|
||||
string UserCode { get; set; }
|
||||
string UserChannelName { get; set; }
|
||||
string LinearSensorCalibration { get; set; }
|
||||
/// <summary>
|
||||
/// the number of samples to qualify over
|
||||
/// </summary>
|
||||
int QualificationSamples { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Number of samples that T0 on DASes that did not directly experience the level trigger must be shifted
|
||||
///// to time align with this channel's directly level triggered T0. A null value indicates that this channel
|
||||
///// did not directly receive a level trigger.
|
||||
///// </summary>
|
||||
int? LevelTriggerT0AdjustmentSamples { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Is this channel configured? 'Configured' means a sensor is connected and/or there is
|
||||
/// information in the containg device's ConfigData object, put there with a call to
|
||||
/// ConfigureService.Configure(...) in the API.
|
||||
/// </summary>
|
||||
/// <returns>True if it is configured, False otherwise.</returns>
|
||||
bool IsConfigured();
|
||||
|
||||
void WriteElementStart(XmlWriter writer);
|
||||
|
||||
void WriteElementEnd(XmlWriter writer);
|
||||
|
||||
void WriteXmlCRC32(XmlWriter writer);
|
||||
|
||||
void WriteXml(XmlWriter writer);
|
||||
|
||||
void ReadXml(XmlReader reader);
|
||||
|
||||
XmlSchema GetSchema();
|
||||
|
||||
int IdType { get; set; }
|
||||
|
||||
string UserValue1 { get; set; }
|
||||
string UserValue2 { get; set; }
|
||||
string UserValue3 { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Controls;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Enums.Channels;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface.Channels.ChannelCodes;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
|
||||
namespace DTS.Common.Classes.ChannelCodes
|
||||
{
|
||||
public class ChannelCode : BasePropertyChanged, IChannelCode
|
||||
{
|
||||
//in case this object is held longer before cleanup, make sure code and name are emptied
|
||||
~ChannelCode()
|
||||
{
|
||||
_code = null;
|
||||
_name = null;
|
||||
}
|
||||
private int _id = -1;
|
||||
public int Id
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value, "Id");
|
||||
}
|
||||
private UIItemStatus _itemStatus = UIItemStatus.None;
|
||||
public UIItemStatus ItemStatus
|
||||
{
|
||||
get => _itemStatus;
|
||||
set => SetProperty(ref _itemStatus, value, "ItemStatus");
|
||||
}
|
||||
|
||||
protected string _code = string.Empty;
|
||||
public string Code
|
||||
{
|
||||
get => _code;
|
||||
set => SetProperty(ref _code, value, "Code");
|
||||
}
|
||||
|
||||
protected string _name = string.Empty;
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value, "Name");
|
||||
}
|
||||
|
||||
public ChannelEnumsAndConstants.ChannelCodeType CodeType { get; set; }
|
||||
public const string PASTE_ID = "ChannelCode";
|
||||
// putting a null here avoids wasteful exception that was being thrown during UI construction
|
||||
// DTM 2020-12-07
|
||||
public ICommand PasteCommand { get; set; } = null;
|
||||
|
||||
public ChannelCode(IDataReader reader, IReadOnlyDictionary<short, string> channelTypeLookup)
|
||||
{
|
||||
var codeType = ChannelEnumsAndConstants.ChannelCodeType.User;
|
||||
var iCodeType = Utility.GetShort(reader, "CodeTypeInt");
|
||||
if (channelTypeLookup.ContainsKey(iCodeType))
|
||||
{
|
||||
var key = channelTypeLookup[iCodeType];
|
||||
switch (key)
|
||||
{
|
||||
case ChannelEnumsAndConstants.UserCodeTypeString:
|
||||
codeType = ChannelEnumsAndConstants.ChannelCodeType.User;
|
||||
break;
|
||||
case ChannelEnumsAndConstants.IsoCodeTypeString:
|
||||
codeType = ChannelEnumsAndConstants.ChannelCodeType.ISO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Id = Utility.GetInt(reader, "Id");
|
||||
Code = Utility.GetString(reader, "Code");
|
||||
Name = Utility.GetString(reader, "Name");
|
||||
CodeType = codeType;
|
||||
}
|
||||
public ChannelCode()
|
||||
{
|
||||
CodeType = ChannelEnumsAndConstants.ChannelCodeType.ISO;
|
||||
}
|
||||
public ChannelCode(IChannelCode channelCode)
|
||||
{
|
||||
Id = channelCode.Id;
|
||||
Code = channelCode.Code;
|
||||
CodeType = channelCode.CodeType;
|
||||
Name = channelCode.Name;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is ChannelCode other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Code.Equals(other.Code)
|
||||
&& Name.Equals(other.Name)
|
||||
&& CodeType.Equals(other.CodeType);
|
||||
}
|
||||
}
|
||||
|
||||
public class PasteCommandClass : ICommand
|
||||
{
|
||||
public string Id { get; }
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
var eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
try
|
||||
{
|
||||
if (!(parameter is TextBox tb))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!(tb.DataContext is IChannelCode channelCode))
|
||||
{
|
||||
if (tb.DataContext is ChannelCodeBuilder ccb)
|
||||
{
|
||||
channelCode = ccb.DataContext as IChannelCode;
|
||||
}
|
||||
else if (tb.DataContext is ChannelNameBuilder cnb)
|
||||
{
|
||||
channelCode = cnb.DataContext as IChannelCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Clipboard.ContainsText())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var text = Clipboard.GetText();
|
||||
var lines = text.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (1 == lines.Length)
|
||||
{
|
||||
var line = lines[0];
|
||||
if (line.IndexOfAny(new[] { ',', ';', '\t' }) < 0)
|
||||
{
|
||||
//this is a single field paste, don't do any further processing, let textchanged take care of it
|
||||
|
||||
eventAggregator.GetEvent<PageModifiedEvent>().Publish(new PageModifiedArg(PageModifiedArg.Status.Modified, null));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//wipe out the built in effect of the paste
|
||||
channelCode.Code = channelCode.Code;
|
||||
channelCode.Name = channelCode.Name;
|
||||
|
||||
eventAggregator.GetEvent<TextPastedEvent>().Publish(new TextPastedArgs(text, channelCode, Id, tb.Tag));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
eventAggregator.GetEvent<PageErrorEvent>().Publish(new PageErrorArg(new[] { ex.Message }, null));
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public PasteCommandClass(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// this defines a function to control the behavior of setting an isocode
|
||||
/// it was done for
|
||||
/// 14033 finish/clean up from removing CFC filter from digital input on sensor db
|
||||
/// this allows channels to handle incoming isocodes from the UI and coerce them to a new value
|
||||
/// </summary>
|
||||
/// <param name="val"></param>
|
||||
/// <param name="uniqueISOCodesRequired"></param>
|
||||
/// <param name="useISOCodeFilterMapping"></param>
|
||||
/// <returns></returns>
|
||||
public delegate string CoerceISOCodeDelegate(string val, bool uniqueISOCodesRequired, bool useISOCodeFilterMapping);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace DTS.Common.Interface.Groups.GroupList
|
||||
{
|
||||
public class TestSetupParentHelper
|
||||
{
|
||||
public int Id;
|
||||
public string Name { get; set; }
|
||||
public bool Modified { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace DTS.Common.Classes.Hardware
|
||||
{
|
||||
public class DragAndDropPayload
|
||||
{
|
||||
public const string FORMAT = "RESOLVECHANNELS_HARDWARETABLE";
|
||||
public const string ALT_FORMAT = "ALT_RESOLVECHANNELS_HARDWARETABLE";
|
||||
public const string CTRL_FORMAT = "CTRL_RESOLVECHANNELS_HARDWARETABLE";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user