예제 #1
0
 public static void AddNotExists(this ComboBox.ObjectCollection items, object value)
 {
     if (items.Contains(value))
     {
         return;
     }
     items.Add(value);
 }
예제 #2
0
/*        protected override void WndProc(ref Message m)
 *      {
 *          if(m.Msg ==WM_DEVICECHANGE)
 *          {
 *              ;
 *              ;
 *          }
 *          base.WndProc(ref m);
 *      }*/
        /// <summary>
        /// 扫描枪下拉列表项添加处理函数
        /// </summary>
        /// <param name="obj"></param>
        public void ComBoBoxaddListItem(List <SerSystemDiscoverer.SystemInfo> obj)
        {
            ComboBox.ObjectCollection objectCollection = comboBox1.Items;

            obj.ForEach(o => {
                if (!objectCollection.Contains(o.PortName))
                {
                    comboBox1.Items.Add(o.PortName);
                }
                ;
            });
        }
예제 #3
0
 private void AddDateToFilterPanel(DateTime date)
 {
     if (!availableYears.Contains(date.Year))
     {
         availableYears.Add(date.Year);
     }
     if (!availableMonths.Contains(date.Month))
     {
         availableMonths.Add(date.Month);
     }
     if (!availableDays.Contains(date.Day))
     {
         availableDays.Add(date.Day);
     }
 }
예제 #4
0
 private void LayoutFormSaveButton_Click(object sender, EventArgs e)
 {
     if (NameTexbox.Text.Length < 1)
     {
         MessageBox.Show("Name requires a minimum of 1 character!", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (ExistingLayouts.Contains(NameTexbox.Text))
     {
         MessageBox.Show("That layout name is alredy in use. Layout names must be unique!", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         name         = NameTexbox.Text;
         DialogResult = DialogResult.OK;
         Close();
     }
 }