示例#1
0
文件: TestTray.cs 项目: licanwen/op
 private void btnSave_Click(object sender, EventArgs e)
 {
     SaveParameter();
     TrayFactory.SetTray(cmbId.Text, tray);
     if (TrayFactory.SaveTrayFactory(ConfigTrayName))
     {
         MessageBox.Show("保存托盘参数成功!");
     }
     else
     {
         MessageBox.Show("保存托盘参数失败!");
     }
     tray.IsCalibration = false;
 }
示例#2
0
文件: TestTray.cs 项目: licanwen/op
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("是否新建托盘型号?", "新建托盘型号", MessageBoxButtons.OKCancel);

            if (result == DialogResult.Cancel)
            {
                return;
            }
            var strType = txtNewPlateType.Text.Trim();

            if (strType == "")
            {
                MessageBox.Show("输入的字符为空!");
                return;
            }
            if (!IsDigitOrNumber(strType))
            {
                MessageBox.Show("输入的字符不是0-9,a-z,A-Z");
                return;
            }
            var Keys  = TrayFactory.GetTrayDict.Keys;
            var count = Keys.Count;

            foreach (var key in Keys)
            {
                if (strType == key)
                {
                    MessageBox.Show("输入的型号已存在!");
                    return;
                }
            }
            var m_tray = new Tray(strType, "", 5, 5);

            TrayFactory.SetTray(strType, m_tray);
            cmbId.Items.Add(strType);
            cmbId.SelectedIndex = cmbId.Items.Count - 1;
            tray = TrayFactory.GetTrayFactory(cmbId.Text);
            tp.SetTrayObj(tray, Color.Gray);
            initControls();
            chShow.Checked = true;
        }