init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Interface.Pagination;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace DTS.Common.Interface.Sensors.SoftwareFilters
|
||||
{
|
||||
public interface ISoftwareFiltersViewModel : IBaseViewModel, IFilterableListView
|
||||
{
|
||||
ISoftwareFiltersView View { get; set; }
|
||||
void Sort(object sortBy, bool bColumnClick);
|
||||
void Unset();
|
||||
void Filter(string currentFilter);
|
||||
ObservableCollection<ISoftwareFilter> SoftwareFilters { get; set; }
|
||||
ISoftwareFilter[] GetSoftwareFilters();
|
||||
void PopulateView();
|
||||
string CurrentUser { get; set; }
|
||||
bool ValidateAndSave();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace DTS.Common.Enums.DBExport
|
||||
{
|
||||
/// <summary>
|
||||
/// different tags for an ISODll.FineLocation1
|
||||
/// </summary>
|
||||
public enum CustomFinLoc1Fields
|
||||
{
|
||||
Date,
|
||||
Expired,
|
||||
Fine_Loc_1,
|
||||
History,
|
||||
Last_Change,
|
||||
Last_Change_Text,
|
||||
Remarks,
|
||||
S_GUID,
|
||||
SortKey,
|
||||
Text_L1,
|
||||
Text_L2,
|
||||
Version,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
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
|
||||
{
|
||||
public class StreamingFilterProfileCollection : Collection<StreamingFilterProfile>
|
||||
{
|
||||
private static readonly object MyLock = new object();
|
||||
private static StreamingFilterProfileCollection _instance = null;
|
||||
public static StreamingFilterProfileCollection GetCollection()
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
if (null != _instance) { return _instance; }
|
||||
WriteDefaultFileIfMissing(FILTER_PROFILES_XML_FILE);
|
||||
_instance = ReadFile(FILTER_PROFILES_XML_FILE);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
private const string FILTER_PROFILES_XML_FILE = "StreamingFilterProfiles.xml";
|
||||
|
||||
private StreamingFilterProfileCollection(StreamingFilterProfile[] filters)
|
||||
{
|
||||
foreach (var filter in filters) { Add(filter); }
|
||||
}
|
||||
public StreamingFilterProfileCollection() { }
|
||||
|
||||
public enum DefaultProfiles
|
||||
{
|
||||
[Display(Name ="Default (Mixed)", Description = "6 pole butterworth legacy or default", Order = DEFAULT_VALUE)]
|
||||
[Scaler(double.NaN)]
|
||||
Default = DEFAULT_VALUE,
|
||||
|
||||
[Display(Name ="Sample rate / 4", Description = "based on sample rate")]
|
||||
[Scaler(4)]
|
||||
Profile7 = 7,
|
||||
|
||||
[Display(Name = "Sample rate / 6.4", Description = "based on sample rate")]
|
||||
[Scaler(6.4)]
|
||||
Profile8 = 8,
|
||||
|
||||
[Display(Name = "Sample rate / 8", Description = "based on sample rate")]
|
||||
[Scaler(8)]
|
||||
Profile9 = 9,
|
||||
|
||||
[Display(Name = "Sample rate / 10", Description = "based on sample rate")]
|
||||
[Scaler(10)]
|
||||
Profile10 = 10
|
||||
}
|
||||
|
||||
private static StreamingFilterProfileCollection CreateDefaultCollection()
|
||||
{
|
||||
var list = new List<StreamingFilterProfile>
|
||||
{
|
||||
new StreamingFilterProfile(DefaultProfiles.Default, new[] { new DASRestriction(string.Empty, -1) }),
|
||||
new StreamingFilterProfile(DefaultProfiles.Profile7, new[]
|
||||
{
|
||||
new DASRestriction(HardwareTypes.SLICE6_AIR_BR.ToString(), 50), new DASRestriction(HardwareTypes.SLICE6_AIR.ToString(), 51), new DASRestriction(HardwareTypes.SLICE6_AIR_TC.ToString(), 0)
|
||||
}),
|
||||
new StreamingFilterProfile(DefaultProfiles.Profile8, new[]
|
||||
{
|
||||
new DASRestriction(HardwareTypes.SLICE6_AIR_BR.ToString(), 50), new DASRestriction(HardwareTypes.SLICE6_AIR.ToString(), 51), new DASRestriction(HardwareTypes.SLICE6_AIR_TC.ToString(), 0)
|
||||
}),
|
||||
new StreamingFilterProfile(DefaultProfiles.Profile9, new[]
|
||||
{
|
||||
new DASRestriction(HardwareTypes.SLICE6_AIR_BR.ToString(), 50), new DASRestriction(HardwareTypes.SLICE6_AIR.ToString(), 51), new DASRestriction(HardwareTypes.SLICE6_AIR_TC.ToString(), 0)
|
||||
}),
|
||||
new StreamingFilterProfile(DefaultProfiles.Profile10, new[]
|
||||
{
|
||||
new DASRestriction(HardwareTypes.SLICE6_AIR_BR.ToString(), 50), new DASRestriction(HardwareTypes.SLICE6_AIR.ToString(), 51), new DASRestriction(HardwareTypes.SLICE6_AIR_TC.ToString(), 0)
|
||||
})
|
||||
};
|
||||
var collection = new StreamingFilterProfileCollection(list.ToArray());
|
||||
return collection;
|
||||
}
|
||||
|
||||
private static void WriteDefaultFileIfMissing(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath)) { return; }
|
||||
var collection = CreateDefaultCollection();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(StreamingFilterProfileCollection));
|
||||
var settings = new XmlWriterSettings() { Indent = true };
|
||||
|
||||
using (var writer = XmlWriter.Create(filePath, settings))
|
||||
{
|
||||
serializer.Serialize(writer, collection);
|
||||
}
|
||||
}
|
||||
|
||||
private static StreamingFilterProfileCollection ReadFile(string filePath)
|
||||
{
|
||||
var deserializer = new XmlSerializer(typeof(StreamingFilterProfileCollection));
|
||||
using (var fs = new FileStream(filePath, FileMode.Open))
|
||||
{
|
||||
var cs = (StreamingFilterProfileCollection)deserializer.Deserialize(fs);
|
||||
return cs;
|
||||
}
|
||||
}
|
||||
public const int DEFAULT_VALUE = 13;
|
||||
public StreamingFilterProfile GetStreamingFilterProfile(string s)
|
||||
{
|
||||
var match = Items.FirstOrDefault(x => x.DisplayString == s);
|
||||
if (null != match) { return match; }
|
||||
match = Items.FirstOrDefault(x => x.EnumValue == DEFAULT_VALUE);
|
||||
if (null != match) { return match; }
|
||||
return Items[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DTS.Common.Converters;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Common.Enums.Hardware
|
||||
{
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum SLICETCConfigurations
|
||||
{
|
||||
[Description("SLICETC_CONFIGURATION_24")]
|
||||
TWENTYFOUR,
|
||||
[Description("SLICETC_CONFIGURATION_16")]
|
||||
SIXTEEN,
|
||||
[Description("SLICETC_CONFIGURATION_8")]
|
||||
EIGHT
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user