Пример #1
0
        public void AddSwitch(string dataPropertyName, string text, bool value, bool enabled = true)
        {
            if (Dictionary.ContainsKey(dataPropertyName))
            {
                throw new DuplicateNameException(dataPropertyName + ": 已经存在");
            }

            EditInfo info = new EditInfo()
            {
                DataPropertyName = dataPropertyName,
                EditType         = EditType.Switch,
                Text             = text,
                Value            = value,
                Enabled          = enabled
            };

            Infos.Add(info);
            Dictionary.TryAdd(info.DataPropertyName, info);
        }
Пример #2
0
        public void AddDateTime(string dataPropertyName, string text, DateTime value, bool enabled = true, bool halfWidth = false)
        {
            if (Dictionary.ContainsKey(dataPropertyName))
            {
                throw new DuplicateNameException(dataPropertyName + ": 已经存在");
            }

            EditInfo info = new EditInfo()
            {
                DataPropertyName = dataPropertyName,
                EditType         = EditType.DateTime,
                Text             = text,
                Value            = value,
                Enabled          = enabled,
                HalfWidth        = halfWidth
            };

            Infos.Add(info);
            Dictionary.TryAdd(info.DataPropertyName, info);
        }
Пример #3
0
        public void AddComboCheckedListBox(string dataPropertyName, string text, ComboCheckedListBoxItem[] nodes, string value, bool enabled = true, bool halfWidth = false)
        {
            if (Dictionary.ContainsKey(dataPropertyName))
            {
                throw new DuplicateNameException(dataPropertyName + ": 已经存在");
            }

            EditInfo info = new EditInfo()
            {
                DataPropertyName = dataPropertyName,
                EditType         = EditType.ComboCheckedListBox,
                Text             = text,
                Value            = value,
                Enabled          = enabled,
                HalfWidth        = halfWidth,
                DataSource       = nodes
            };

            Infos.Add(info);
            Dictionary.TryAdd(info.DataPropertyName, info);
        }
Пример #4
0
        public void AddCombobox(string dataPropertyName, string text, string[] items, int selectedIndex = -1, bool enabled = true, bool halfWidth = false)
        {
            if (Dictionary.ContainsKey(dataPropertyName))
            {
                throw new DuplicateNameException(dataPropertyName + ": 已经存在");
            }

            EditInfo info = new EditInfo()
            {
                DataPropertyName = dataPropertyName,
                EditType         = EditType.Combobox,
                Text             = text,
                Value            = selectedIndex,
                Enabled          = enabled,
                HalfWidth        = halfWidth,
                DataSource       = items
            };

            Infos.Add(info);
            Dictionary.TryAdd(info.DataPropertyName, info);
        }
Пример #5
0
        public void AddCombobox(string dataPropertyName, string text, IList dataSource, string displayMember,
                                string valueMember, object value, bool enabled = true, bool halfWidth = false)
        {
            if (Dictionary.ContainsKey(dataPropertyName))
            {
                throw new DuplicateNameException(dataPropertyName + ": 已经存在");
            }

            EditInfo info = new EditInfo()
            {
                DataPropertyName = dataPropertyName,
                EditType         = EditType.Combobox,
                Text             = text,
                Value            = value,
                Enabled          = enabled,
                HalfWidth        = halfWidth,
                DataSource       = dataSource,
                DisplayMember    = displayMember,
                ValueMember      = valueMember
            };

            Infos.Add(info);
            Dictionary.TryAdd(info.DataPropertyName, info);
        }