init
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DTS.Common.Converters
|
||||
{
|
||||
public class IsLessThanConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var left = value != null && decimal.TryParse(value.ToString(), out _) ? decimal.Parse(value.ToString(), culture.NumberFormat) : 0;
|
||||
var right = parameter != null && decimal.TryParse(parameter.ToString(), out _) ? decimal.Parse(parameter.ToString(), culture.NumberFormat) : 0;
|
||||
|
||||
return left < right;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface.ISO.ExtraProperties
|
||||
{
|
||||
public interface IExtraPropertiesListViewModel : IBaseViewModel
|
||||
{
|
||||
void SetPage(IDataPROPage page);
|
||||
void SetParent(object parent);
|
||||
IExtraPropertiesListView View { get; set; }
|
||||
|
||||
void CopySelected();
|
||||
void DeleteSelected();
|
||||
ObservableCollection<IExtraProperty> ExtraProperties { get; set; }
|
||||
void SetExtraProperties(IList<IExtraProperty> properties);
|
||||
void Filter(object tag, string term);
|
||||
|
||||
void Sort(object o, bool columnClick);
|
||||
bool Validate(ref List<string> errors);
|
||||
|
||||
bool IsReadOnly { get; set; }
|
||||
IExtraProperty[] SelectedProperties { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Base.Classes;
|
||||
using DTS.Common.Converters;
|
||||
|
||||
namespace DTS.Common.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// these are the different input modes for the data
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum DigitalInputModes
|
||||
{
|
||||
NONE = 1 << 0, //DI's input mode not set
|
||||
[DescriptionResource("DigitalInputMode_TLH")]
|
||||
TLH = 1 << 1, //Transition Low to High
|
||||
[DescriptionResource("DigitalInputMode_THL")]
|
||||
THL = 1 << 2, //Transition High to Low
|
||||
[DescriptionResource("DigitalInputMode_CCNO")]
|
||||
CCNO = 1 << 3, //set to contact closure normally open
|
||||
[DescriptionResource("DigitalInputMode_CCNC")]
|
||||
CCNC = 1 << 4 //set to contact closure normally closed
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace DTS.Common.Classes.DSP
|
||||
{
|
||||
/// <summary>
|
||||
/// collection for all dsp filters
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Acronym")]
|
||||
public class DSPFilterCollection : Collection<DSPFilterType>
|
||||
{
|
||||
private static readonly object MyLock = new object();
|
||||
private static DSPFilterCollection _instance = null;
|
||||
public static DSPFilterCollection GetDSPFilterCollection()
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
if (null != _instance) { return _instance; }
|
||||
WriteDefaultFileIfMissing(DSP_FILTER_XML_FILE);
|
||||
_instance = ReadFile(DSP_FILTER_XML_FILE);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
private const string DSP_FILTER_XML_FILE = "DSPFilters.xml";
|
||||
|
||||
private DSPFilterCollection(DSPFilterType[] filters)
|
||||
{
|
||||
foreach (var filter in filters) { Add(filter); }
|
||||
}
|
||||
public DSPFilterCollection() { }
|
||||
|
||||
public const int BUTTERWORTH = 13;
|
||||
public const int FIR45TAP = 14;
|
||||
public const int NONE = 0;
|
||||
|
||||
public enum DSPFilterDefaults
|
||||
{
|
||||
[Display(Name ="None", Description = "Default and legacy setting for streaming")]
|
||||
[Scaler(double.NaN)]
|
||||
None = NONE,
|
||||
[Display(Name = "6th IIR Butterworth", Description = "6 - pole IIR Butterworth Low Pass")]
|
||||
[Scaler(double.NaN)]
|
||||
Butterworth = BUTTERWORTH,
|
||||
[Display(Name = "45-Tap FIR", Description = "finite impulse response filter with 45 taps")]
|
||||
[Scaler(double.NaN)]
|
||||
FIR = FIR45TAP
|
||||
}
|
||||
|
||||
private static DSPFilterCollection CreateDefaultCollection()
|
||||
{
|
||||
var list = new List<DSPFilterType>
|
||||
{
|
||||
new DSPFilterType(DSPFilterDefaults.None, new DASRestriction[] { new DASRestriction() }),
|
||||
new DSPFilterType(DSPFilterDefaults.Butterworth, new DASRestriction[] { new DASRestriction(HardwareTypes.SLICE6_AIR.ToString(), 28), new DASRestriction(HardwareTypes.SLICE6_AIR_BR.ToString(), -1) }),
|
||||
new DSPFilterType(DSPFilterDefaults.FIR, new DASRestriction[] { new DASRestriction(HardwareTypes.SLICE6_AIR.ToString(), 28), new DASRestriction(HardwareTypes.SLICE6_AIR_BR.ToString(), -1) })
|
||||
};
|
||||
|
||||
var collection = new DSPFilterCollection(list.ToArray());
|
||||
return collection;
|
||||
}
|
||||
|
||||
private static void WriteDefaultFileIfMissing(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath)) { return; }
|
||||
var collection = CreateDefaultCollection();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(DSPFilterCollection));
|
||||
var settings = new XmlWriterSettings() { Indent = true };
|
||||
|
||||
using (var writer = XmlWriter.Create(filePath, settings))
|
||||
{
|
||||
serializer.Serialize(writer, collection);
|
||||
}
|
||||
}
|
||||
|
||||
private static DSPFilterCollection ReadFile(string filePath)
|
||||
{
|
||||
var deserializer = new XmlSerializer(typeof(DSPFilterCollection));
|
||||
using (var fs = new FileStream(filePath, FileMode.Open))
|
||||
{
|
||||
var cs = (DSPFilterCollection)deserializer.Deserialize(fs);
|
||||
return cs;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// returns the matching filter, or None if not found, or if none isn't found then the first entry
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public DSPFilterType GetFilter(string s)
|
||||
{
|
||||
var match = Items.FirstOrDefault(x => x.DisplayString == s);
|
||||
if (null != match) { return match; }
|
||||
match = Items.FirstOrDefault(x => x.EnumValue == 0);
|
||||
if (null != match) { return match; }
|
||||
return Items[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
namespace DTS.Common.RibbonControl
|
||||
{
|
||||
public class ButtonData : ControlData
|
||||
{
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user