Esempio n. 1
0
        private void BindModifiers(ComboBox cmb)
        {
            List <EnumInfo> lstModifiers = EnumUnit.GetEnumInfos(typeof(KeyModifiers));

            cmb.Items.Clear();
            List <ComboBoxItem> lstValue = new List <ComboBoxItem>();

            foreach (EnumInfo info in lstModifiers)
            {
                string name = info.FieldName;
                if (name == "Control")
                {
                    name = "Ctrl";
                }
                else if (name == "Windows" || name == "All")
                {
                    continue;
                }
                ComboBoxItem item = new ComboBoxItem(name, (int)info.Value);
                lstValue.Add(item);
            }
            cmb.DisplayMember = "FieldName";
            cmb.ValueMember   = "Value";
            cmb.DataSource    = lstValue;
        }
Esempio n. 2
0
        private void BindKeys(ComboBox cmb)
        {
            List <EnumInfo> lstKeys = EnumUnit.GetEnumInfos(typeof(Keys));

            cmb.Items.Clear();
            List <ComboBoxItem> lstValue = new List <ComboBoxItem>();

            foreach (EnumInfo info in lstKeys)
            {
                int val = (int)info.Value;
                if (val >= 48 && val <= 120)
                {
                    string name = info.FieldName;
                    if (name.Length == 2 && name[0] == 'D')
                    {
                        name = name.Substring(1);
                    }
                    ComboBoxItem item = new ComboBoxItem(name, (int)info.Value);
                    lstValue.Add(item);
                }
            }
            cmb.DisplayMember = "FieldName";
            cmb.ValueMember   = "Value";
            cmb.DataSource    = lstValue;
        }
Esempio n. 3
0
        /// <summary>
        /// 获取皮肤信息
        /// </summary>
        /// <returns></returns>
        private static Dictionary <int, EnumInfo> GetSkin()
        {
            List <EnumInfo>            lstInfo = EnumUnit.GetEnumInfos(typeof(DialogSkin));
            Dictionary <int, EnumInfo> dic     = CommonMethods.ListToDictionary <int, EnumInfo>(lstInfo, "Value");

            return(dic);
        }
Esempio n. 4
0
        /// <summary>
        /// 初始化缓存类型
        /// </summary>
        private void InitLazyType()
        {
            cmbLazy.DisplayMember = "Description";
            cmbLazy.ValueMember   = "Value";
            List <EnumInfo> lst = EnumUnit.GetEnumInfos(typeof(LazyType));

            cmbLazy.DataSource = lst;
        }
Esempio n. 5
0
        /// <summary>
        /// 填充注释设置
        /// </summary>
        private void FillSummary()
        {
            List <EnumInfo> infos = EnumUnit.GetEnumInfos(typeof(SummaryShowItem));

            foreach (EnumInfo info in infos)
            {
                if (info.FieldName != "All")
                {
                    ComboBoxItem item = new ComboBoxItem(info.Description, (int)info.Value);
                    clbSummary.Items.Add(item);
                }
            }
        }
Esempio n. 6
0
        private void BindKeys()
        {
            List <EnumInfo> lstModifiers = EnumUnit.GetEnumInfos(typeof(KeyModifiers));

            cmbModifiers.Items.Clear();
            List <ComboBoxItem> lstValue = new List <ComboBoxItem>();

            foreach (EnumInfo info in lstModifiers)
            {
                string name = info.FieldName;
                if (name == "Control")
                {
                    name = "Ctrl";
                }
                else if (name == "Windows" || name == "All")
                {
                    continue;
                }
                ComboBoxItem item = new ComboBoxItem(name, (int)info.Value);
                lstValue.Add(item);
            }
            cmbModifiers.DisplayMember = "FieldName";
            cmbModifiers.ValueMember   = "Value";
            cmbModifiers.DataSource    = lstValue;


            List <EnumInfo> lstKeys = EnumUnit.GetEnumInfos(typeof(Keys));

            cmbKeys.Items.Clear();
            lstValue = new List <ComboBoxItem>();
            foreach (EnumInfo info in lstKeys)
            {
                int val = (int)info.Value;
                if (val >= 48 && val <= 120)
                {
                    string name = info.FieldName;
                    if (name.Length == 2 && name[0] == 'D')
                    {
                        name = name.Substring(1);
                    }
                    ComboBoxItem item = new ComboBoxItem(name, (int)info.Value);
                    lstValue.Add(item);
                }
            }
            cmbKeys.DisplayMember = "FieldName";
            cmbKeys.ValueMember   = "Value";
            cmbKeys.DataSource    = lstValue;
        }