init
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using DTS.Common.Converters;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Common.Enums.Sensors
|
||||
{
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum SensitivityInspectionType
|
||||
{
|
||||
[Description("SensitivityInspection_NotSet")]
|
||||
NotSet = 0,
|
||||
[Description("SensitivityInspection_Required")]
|
||||
Required = 1,
|
||||
[Description("SensitivityInspection_Cleared")]
|
||||
Cleared = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DTS.Common.Classes.DSP
|
||||
{
|
||||
/// <summary>
|
||||
/// this converter is used for displaying StreamingFilterCollection/array in property grids
|
||||
/// </summary>
|
||||
public class StreamingFilterConverter : ArrayConverter
|
||||
{
|
||||
private StreamingFilterProfileCollection _collection = null;
|
||||
private static readonly object MyLock = new object();
|
||||
private StreamingFilterProfile[] _values = null;
|
||||
private StreamingFilterProfileCollection GetCollection()
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
if (null == _collection)
|
||||
{
|
||||
_collection = StreamingFilterProfileCollection.GetCollection();
|
||||
}
|
||||
return _collection;
|
||||
}
|
||||
}
|
||||
public StreamingFilterProfile[] Values
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (MyLock)
|
||||
{
|
||||
if (null == _values)
|
||||
{
|
||||
var collection = GetCollection();
|
||||
|
||||
var array = new StreamingFilterProfile[collection.Count];
|
||||
collection.CopyTo(array, 0);
|
||||
_values = array;
|
||||
}
|
||||
}
|
||||
return _values;
|
||||
}
|
||||
}
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
if (sourceType == typeof(string)) { return true; }
|
||||
return base.CanConvertFrom(context, sourceType);
|
||||
}
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
var result = Array.Find(Values, x => x.DisplayString == (string)value);
|
||||
if (result != null) { return result; }
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
var collection = GetCollection();
|
||||
return new StandardValuesCollection(collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user