예제 #1
0
        public void BindingProperty(string pro, string vassal)
        {
            this.ProValue  = pro;
            this.ProVassal = vassal;
            System.Type  type     = this.Source.GetType();
            PropertyInfo property = type.GetProperty(pro);

            if (property == null)
            {
                throw new Exception("未找到:" + pro);
            }
            object obj2 = property.GetValue(this.Source, null);

            if (obj2 != null)
            {
                this.SetTheMeans(obj2.ToString());
            }
            if (!string.IsNullOrEmpty(vassal) && (type.GetProperty(vassal) != null))
            {
                LoneCheckbox checkbox = this.AllCheckboxes.Single <LoneCheckbox>(a => a.Vassal != null);
                if (checkbox != null)
                {
                    if (this.maxCount.HasValue)
                    {
                        checkbox.Vassal.MaxLength    = this.maxCount.Value;
                        checkbox.Vassal.TextChanged += new EventHandler(this.Vassal_TextChanged);
                    }
                    checkbox.Vassal.DataBindings.Add("Text", this.Source, vassal, false, DataSourceUpdateMode.OnPropertyChanged);
                }
            }
        }
예제 #2
0
 public void AddCk(LoneCheckbox it)
 {
     if (string.IsNullOrEmpty(it.Mean))
     {
         it.Mean = Convert.ToString((int)(this.AllCheckboxes.Count + 1));
     }
     if (it.OneVeto)
     {
         it.useOneVeto = (Action <LoneCheckbox, bool>)Delegate.Combine(it.useOneVeto, new Action <LoneCheckbox, bool>(this.RunOneVeto));
     }
     it.UpdateSource = (Action)Delegate.Combine(it.UpdateSource, new Action(this.UpdateSrcModel));
     this.AllCheckboxes.Add(it);
 }
예제 #3
0
 private void RunOneVeto(LoneCheckbox sender, bool p_value)
 {
     for (int i = 0; i < this.AllCheckboxes.Count; i++)
     {
         if (sender != this.AllCheckboxes[i])
         {
             this.AllCheckboxes[i].SetInvalid(p_value);
         }
     }
     if (this.oneVetoChecked != null)
     {
         this.oneVetoChecked(p_value);
     }
 }
예제 #4
0
        private void Vassal_TextChanged(object sender, EventArgs e)
        {
            LoneCheckbox checkbox = this.AllCheckboxes.Single <LoneCheckbox>(a => a.Vassal != null);

            if (checkbox != null)
            {
                int byteCount = Encoding.GetEncoding("GB2312").GetByteCount(checkbox.Vassal.Text);
                int?maxCount  = this.maxCount;
                if (((byteCount <= maxCount.GetValueOrDefault()) ? 0 : (maxCount.HasValue ? 1 : 0)) != 0)
                {
                    this.ErrorInput           = true;
                    checkbox.Vassal.BackColor = Color.Salmon;
                }
                else
                {
                    this.ErrorInput           = false;
                    checkbox.Vassal.BackColor = Color.WhiteSmoke;
                }
            }
        }
예제 #5
0
 public void AddEnemy(LoneCheckbox ck)
 {
     this.Enemy.Add(ck);
 }