init
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DatabaseImport.ISO
|
||||
{
|
||||
public class HardwareChannel : INotifyPropertyChanged
|
||||
{
|
||||
#region IPropertyNotified
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)
|
||||
{
|
||||
if (Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
protected void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
private Hardware _parentHardware;
|
||||
public Hardware ParentDAS
|
||||
{
|
||||
get => _parentHardware;
|
||||
set => SetProperty(ref _parentHardware, value, "ParentDAS");
|
||||
}
|
||||
|
||||
private int _supportedBridges = 12;
|
||||
public int SupportedBridges
|
||||
{
|
||||
get => _supportedBridges;
|
||||
set => SetProperty(ref _supportedBridges, value, "SupportedBridges");
|
||||
}
|
||||
|
||||
private int _supportedSquibFireModes = 16;
|
||||
public int SupportedSquibFireModes
|
||||
{
|
||||
get => _supportedSquibFireModes;
|
||||
set => SetProperty(ref _supportedSquibFireModes, value, "SupportedSquibFireModes");
|
||||
}
|
||||
|
||||
private int _supporedExcitations = 16;
|
||||
public int SupportedExcitations
|
||||
{
|
||||
get => _supporedExcitations;
|
||||
set => SetProperty(ref _supporedExcitations, value, "SupportedExcitations");
|
||||
}
|
||||
|
||||
private int _supportedDigitalInputModes = 16;
|
||||
public int SupportedDigitalInputModes
|
||||
{
|
||||
get => _supportedDigitalInputModes;
|
||||
set => SetProperty(ref _supportedDigitalInputModes, value, "SupportedDigitalInputModes");
|
||||
}
|
||||
|
||||
private int _supportedDigitalOutputModes = 16;
|
||||
public int SupportedDigitalOutputModes
|
||||
{
|
||||
get => _supportedDigitalOutputModes;
|
||||
set => SetProperty(ref _supportedDigitalOutputModes, value, "SupportedDigitalOutputModes");
|
||||
}
|
||||
|
||||
private int _channelIdx;
|
||||
public int ChannelIdx
|
||||
{
|
||||
get => _channelIdx;
|
||||
set => SetProperty(ref _channelIdx, value, "ChannelIdx");
|
||||
}
|
||||
|
||||
private int _dasDisplayOrder;
|
||||
public int DASDisplayOrder
|
||||
{
|
||||
get => _dasDisplayOrder;
|
||||
set => _dasDisplayOrder = value;
|
||||
}
|
||||
|
||||
private string _moduleSerialNumber = "";
|
||||
public string ModuleSerialNumber
|
||||
{
|
||||
get => _moduleSerialNumber;
|
||||
set => SetProperty(ref _moduleSerialNumber, value, "ModuleSerialNumber");
|
||||
}
|
||||
|
||||
private int _moduleArrayIndex;
|
||||
public int ModuleArrayIndex
|
||||
{
|
||||
get => _moduleArrayIndex;
|
||||
set => _moduleArrayIndex = value;
|
||||
}
|
||||
|
||||
// public HardwareChannel() { }
|
||||
public HardwareChannel(HardwareChannel copy, Hardware h)
|
||||
{
|
||||
SupportedSquibFireModes = copy.SupportedSquibFireModes;
|
||||
SupportedExcitations = copy.SupportedExcitations;
|
||||
SupportedDigitalOutputModes = copy.SupportedDigitalOutputModes;
|
||||
SupportedDigitalInputModes = copy.SupportedDigitalInputModes;
|
||||
SupportedBridges = copy.SupportedBridges;
|
||||
ParentDAS = h;
|
||||
LocalOnly = copy.LocalOnly;
|
||||
DASDisplayOrder = copy.DASDisplayOrder;
|
||||
ChannelIdx = copy.ChannelIdx;
|
||||
ModuleArrayIndex = copy.ModuleArrayIndex;
|
||||
_moduleSerialNumber = copy.ModuleSerialNumber;
|
||||
}
|
||||
public HardwareChannel(IDataRecord reader, Hardware hardware)
|
||||
{
|
||||
ParentDAS = hardware;
|
||||
|
||||
ChannelIdx = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.ChannelIdx.ToString()]);
|
||||
SupportedBridges = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.SupportedBridges.ToString()]);
|
||||
SupportedExcitations = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.SupportedExcitations.ToString()]);
|
||||
SupportedDigitalInputModes = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.SupportedDigitalInputModes.ToString()]);
|
||||
SupportedDigitalOutputModes = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.SupportedDigitalOutputModes.ToString()]);
|
||||
SupportedSquibFireModes = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.SupportedSquibFireModes.ToString()]);
|
||||
DASDisplayOrder = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.DASDisplayOrder.ToString()]);
|
||||
ModuleSerialNumber = reader[DbOperations.DAS.DASChannelFields.ModuleSerialNumber.ToString()] as string;
|
||||
LocalOnly = Convert.ToBoolean(reader[DbOperations.DAS.DASChannelFields.LocalOnly.ToString()]);
|
||||
ModuleArrayIndex = Convert.ToInt32(reader[DbOperations.DAS.DASChannelFields.ModuleArrayIndex.ToString()]);
|
||||
|
||||
}
|
||||
private bool _bLocalOnly;
|
||||
public bool LocalOnly
|
||||
{
|
||||
get => _bLocalOnly;
|
||||
set => SetProperty(ref _bLocalOnly, value, "LocalOnly");
|
||||
}
|
||||
|
||||
public static int PhysicalCompare(HardwareChannel left, HardwareChannel right)
|
||||
{
|
||||
if (left == right) { return 0; }
|
||||
if (null == left) { return -1; }
|
||||
return null == right ? 1 : left.ChannelIdx.CompareTo(right.ChannelIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user