using KGIS.Framework.Platform;
using Kingo.Plugin.MapView.Enum;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kingo.Plugin.MapView.Model
{
    public class PropertyGridDataStruct : IPropertyStruct, INotifyPropertyChanged
    {
        public string HeaderToolTip { get; set; }
        /// 
        /// 属性名(键)
        /// 
        public string Key { get; set; }
        public string FieldName { get; set; }
        public string Text { get; set; }
        private string _SelectText;
        public string SelectText
        {
            get
            {
                return _SelectText;
            }
            set
            {
                _SelectText = value;
                //if (PropertyChanged != null)
                //    PropertyChanged(this, new PropertyChangedEventArgs("SelectText"));
            }
        }
        /// 
        /// 显示字体颜色
        /// 
        private string _FontColor;
        public string FontColor
        {
            get
            {
                return _FontColor;
            }
            set
            {
                _FontColor = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("FontColor"));
            }
        }
        private string _Value;
        /// 
        /// 属性值
        /// 
        public string Value
        {
            get
            {
                return _Value;
            }
            set
            {
                _Value = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Value"));
            }
        }
        public int KeyIndex { get; set; }
        public int ValueIndex { get; set; }
        /// 
        /// 属性类型
        /// 
        public enumPropertyType PropertyType { get; set; }
        /// 
        /// 字典Code;当PropertyType=ComboBox时必填
        /// 
        public string DicCode { get; set; }
        private List _DicData;
        public List DicData
        {
            //get
            //{
            //    return _DicData;
            //}
            //set
            //{
            //    _DicData = value;
            //    //if (PropertyChanged != null)
            //    //{
            //    //    PropertyChanged(this, new PropertyChangedEventArgs("DicData"));
            //    //}
            //}
            get
            {
                return _DicData;
            }
            set
            {
                _DicData = value;
                if (BaseDicData == null || BaseDicData.Count <= 0)
                {
                    BaseDicData = value;
                }
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("DicData"));
                }
            }
        }
        private string _DisplayPath;
        /// 
        /// 显示字段(初始化字典绑定)
        /// 
        public string DisplayMemberPath
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_DisplayPath))
                    return "NAME";
                return _DisplayPath;
            }
            set
            {
                _DisplayPath = value;
                //if (PropertyChanged != null)
                //{
                //    PropertyChanged(this, new PropertyChangedEventArgs("DisplayMemberPath"));
                //}
            }
        }
        private string _ValuePath;
        /// 
        /// 值字段(初始化字典绑定)
        /// 
        public string ValuePath
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_ValuePath))
                    return "CODE";
                return _ValuePath;
            }
            set
            {
                _ValuePath = value;
                //if (PropertyChanged != null)
                //{
                //    PropertyChanged(this, new PropertyChangedEventArgs("ValuePath"));
                //}
            }
        }
        private bool _IsReadOnly;
        /// 
        /// 是否只读
        /// 
        public bool IsReadOnly
        {
            get
            {
                return _IsReadOnly;
            }
            set
            {
                _IsReadOnly = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("IsReadOnly"));
                }
            }
        }
        /// 
        /// 允许空值
        /// 
        public bool AllowNull { get; set; }
        /// 
        /// 表示下拉框是否需要分组(树形)显示
        /// 
        public bool IsGroup { get; set; }
        public bool CheckBoxValue { get; set; }
        public bool Visible { get; set; }
        public int Order { get; set; }
        private List _MultiSelectDicData;
        public List MultiSelectDicData
        {
            get
            {
                return _MultiSelectDicData;
            }
            set
            {
                _MultiSelectDicData = value;
                //if (PropertyChanged != null)
                //{
                //    PropertyChanged(this, new PropertyChangedEventArgs("MultiSelectDicData"));
                //}
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;// = delegate { };
        public List BaseDicData
        {
            get;
            set;
        }
        private List