init
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Common.RibbonControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum representing the TabControl operations type.
|
||||
/// </summary>
|
||||
public enum RibbonControlOperation
|
||||
{
|
||||
/// <summary>
|
||||
/// The item has been added to the TabControl.
|
||||
/// </summary>
|
||||
AddedItem,
|
||||
|
||||
/// <summary>
|
||||
/// The item has been removed from the TabControl.
|
||||
/// </summary>
|
||||
RemovedItem
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<title>Visual Studio Image Library</title>
|
||||
<style>
|
||||
BODY {font-family: tahoma, arial, sans-serif;color: black;font-size: .8em;}
|
||||
.style1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<p class="style1">Visual Studio Image Library: Common Elements (Actions)</p>
|
||||
|
||||
<p><b>Use Restrictions<br>
|
||||
</b>These common elements are to be used in the development and illustration of
|
||||
new custom imagery. As part of a visual language, these images (or any
|
||||
part of the images) must be used in a manner consistent with the name of the
|
||||
file, which is self-descriptive of the action, or verb, that the imagery
|
||||
represents.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,120 @@
|
||||
using DTS.Common.Classes.DSP;
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace DTS.Common.Classes.ClockSync
|
||||
{
|
||||
/// <summary>
|
||||
/// collection for all dsp filters
|
||||
/// </summary>
|
||||
public class ClockSyncProfileCollection : Collection<ClockSyncProfile>
|
||||
{
|
||||
private static readonly object MyLock = new object();
|
||||
private static ClockSyncProfileCollection _instance = null;
|
||||
public static ClockSyncProfileCollection GetCollection()
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
if (null != _instance) { return _instance; }
|
||||
WriteDefaultFileIfMissing(CLOCKSYNC_PROFILE_XML_FILE);
|
||||
_instance = ReadFile(CLOCKSYNC_PROFILE_XML_FILE);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
private const string CLOCKSYNC_PROFILE_XML_FILE = "ClockSyncProfiles.xml";
|
||||
|
||||
private ClockSyncProfileCollection(ClockSyncProfile[] profiles)
|
||||
{
|
||||
foreach (var profile in profiles) { Add(profile); }
|
||||
}
|
||||
public ClockSyncProfileCollection() { }
|
||||
|
||||
public const string NONE_NAME = "None";
|
||||
public const string PTPIEEE1588_NAME = "PTP IEEE 1588";
|
||||
public const string IRIGB1PPS_NAME = "IRIG B + 1PPS";
|
||||
public const string GPS1PPS_NAME = "GPS + 1PPS";
|
||||
public const string IRIGB_NAME = "IRIG B";
|
||||
public const string _1PPS_NAME = "1PPS";
|
||||
public enum ClockSyncProfileDefaults
|
||||
{
|
||||
[Display(Name = NONE_NAME, Description = "No master clock input type - RTC from PC only", Order = 0)]
|
||||
[Browsable(true)]
|
||||
None = 0,
|
||||
[Display(Name = PTPIEEE1588_NAME, Description = "Master clock set using Precision Time Protocol IEEE 1588", Order = 1)]
|
||||
[Browsable(true)]
|
||||
PTPIEEE1588 = 1 << 0,
|
||||
[Display(Name = IRIGB1PPS_NAME, Description = "Master clock set using IRIG B on 1 pulse per second", Order = 2)]
|
||||
[Browsable(true)]
|
||||
IRIGB1PPS = 1 << 1,
|
||||
[Display(Name = GPS1PPS_NAME, Description = "Master clock set using GPS on 1 pulse per second", Order = 3)]
|
||||
[Browsable(true)]
|
||||
GPS1PPS = 1 << 2,
|
||||
[Display(Name = IRIGB_NAME, Description ="Master clock set using IRIG B", Order =4)]
|
||||
[Browsable(true)]
|
||||
IRIGB = 1 << 3,
|
||||
[Display(Name = _1PPS_NAME, Description ="Master clock set using 1 pulse per second", Order = 5)]
|
||||
[Browsable(true)]
|
||||
_1PPS = 1 << 4
|
||||
};
|
||||
|
||||
private static ClockSyncProfileCollection CreateDefaultCollection()
|
||||
{
|
||||
var list = new List<ClockSyncProfile>
|
||||
{
|
||||
new ClockSyncProfile(ClockSyncProfileDefaults.None, new DASRestriction[] { new DASRestriction() }),
|
||||
new ClockSyncProfile(ClockSyncProfileDefaults.PTPIEEE1588, new DASRestriction []{new DASRestriction() }),
|
||||
new ClockSyncProfile(ClockSyncProfileDefaults.IRIGB1PPS, new DASRestriction[]{new DASRestriction() }),
|
||||
new ClockSyncProfile(ClockSyncProfileDefaults.GPS1PPS, new DASRestriction[]{new DASRestriction() }),
|
||||
new ClockSyncProfile(ClockSyncProfileDefaults.IRIGB, new DASRestriction[]{new DASRestriction() }),
|
||||
new ClockSyncProfile(ClockSyncProfileDefaults._1PPS, new DASRestriction[]{new DASRestriction() }),
|
||||
};
|
||||
|
||||
var collection = new ClockSyncProfileCollection(list.ToArray());
|
||||
return collection;
|
||||
}
|
||||
|
||||
private static void WriteDefaultFileIfMissing(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath)) { return; }
|
||||
var collection = CreateDefaultCollection();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(ClockSyncProfileCollection));
|
||||
var settings = new XmlWriterSettings() { Indent = true };
|
||||
|
||||
using (var writer = XmlWriter.Create(filePath, settings))
|
||||
{
|
||||
serializer.Serialize(writer, collection);
|
||||
}
|
||||
}
|
||||
|
||||
private static ClockSyncProfileCollection ReadFile(string filePath)
|
||||
{
|
||||
var deserializer = new XmlSerializer(typeof(ClockSyncProfileCollection));
|
||||
using (var fs = new FileStream(filePath, FileMode.Open))
|
||||
{
|
||||
var cs = (ClockSyncProfileCollection)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 ClockSyncProfile GetClockSyncProfile(string s)
|
||||
{
|
||||
var match = Items.FirstOrDefault(x => x.ProfileName == s);
|
||||
if (null != match) { return match; }
|
||||
match = Items.FirstOrDefault(x => x.ProfileId == 0);
|
||||
if (null != match) { return match; }
|
||||
return Items[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user