| | |
| | | using Bro.Common.Factory; |
| | | using Autofac; |
| | | using Bro.Common.Factory; |
| | | using Bro.Common.Interface; |
| | | using Bro.Common.Model; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | // set => hash = value; |
| | | //} |
| | | |
| | | public abstract Hashtable GetConvertHash(); |
| | | public abstract Hashtable GetConvertHash(ITypeDescriptorContext context); |
| | | |
| | | public override bool GetStandardValuesSupported(ITypeDescriptorContext context) |
| | | { |
| | |
| | | |
| | | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) |
| | | { |
| | | Hash = GetConvertHash(); |
| | | Hash = GetConvertHash(context); |
| | | |
| | | string[] ids = new string[Hash.Values.Count]; |
| | | int i = 0; |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | //foreach (DictionaryEntry myDE in Hash) |
| | | //{ |
| | | // if (myDE.Key.Equals(v)) |
| | | // return myDE.Value; |
| | | //} |
| | | return null; |
| | | } |
| | | } |
| | | catch (Exception) |
| | |
| | | { |
| | | return (value as IComplexDisplay).GetDisplayText(); |
| | | } |
| | | else |
| | | else if (value is IEnumerable enumList) |
| | | { |
| | | string display = ""; |
| | | bool iComplexDisplayMatch = false; |
| | | var enumrator = enumList.GetEnumerator(); |
| | | while (enumrator.MoveNext()) |
| | | { |
| | | if (enumrator.Current is IComplexDisplay d) |
| | | { |
| | | iComplexDisplayMatch = true; |
| | | display += $"{d.GetDisplayText()} "; |
| | | } |
| | | } |
| | | |
| | | if (iComplexDisplayMatch) |
| | | { |
| | | return display.Trim(); |
| | | } |
| | | } |
| | | |
| | | { |
| | | return JsonConvert.SerializeObject(value); |
| | | } |
| | |
| | | } |
| | | |
| | | form.ShowDialog(); |
| | | List<string> returnStrs = tbox.Text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | List<string> returnStrs = tbox.Text.Split(new char[] { '\r', '\n', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | |
| | | switch (typeof(T).Name) |
| | | { |
| | |
| | | return form; |
| | | } |
| | | |
| | | //protected override object CreateInstance(Type itemType) |
| | | //{ |
| | | // return base.CreateInstance(itemType); |
| | | //} |
| | | protected override object CreateInstance(Type itemType) |
| | | { |
| | | return base.CreateInstance(itemType); |
| | | } |
| | | |
| | | //protected override object[] GetItems(object editValue) |
| | | //{ |
| | |
| | | } |
| | | } |
| | | |
| | | public class DeviceTypeConverter : StringConverter |
| | | public class DeviceTypeConverter : StringConverter |
| | | { |
| | | public override bool GetStandardValuesSupported(ITypeDescriptorContext context) |
| | | { |
| | |
| | | return new StandardValuesCollection(devices); |
| | | } |
| | | } |
| | | |
| | | |
| | | public class DeviceInitialConfigEditor<T> : UITypeEditor where T : class, IInitialConfig |
| | | { |
| | | public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) |
| | |
| | | |
| | | return base.EditValue(context, provider, value); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |