Exemplo n.º 1
0
        private void DoAddCtrlr(DataGridViewRow row)
        {
            Controller  ctrlr       = (Controller)row.Tag;
            CtrlWaiting ctrlWaiting = new CtrlWaiting("添加控制...", () =>
            {
                try
                {
                    Maticsoft.Model.SMT_CONTROLLER_INFO info = ControllerHelper.AddController(ctrlr);
                    if (info != null)
                    {
                        log.Info("添加控制器成功:" + ctrlr.sn + "," + ctrlr.ip);
                        WinInfoHelper.ShowInfoWindow(this, "添加/更新控制器成功,请编辑控制器参数.");
                        Changed = true;
                        this.Invoke(new Action(() =>
                        {
                            FrmAddOrModifyCtrlr modify = new FrmAddOrModifyCtrlr(info);
                            modify.ShowDialog(this);
                        }));
                    }
                    else
                    {
                        log.Warn("添加控制器失败:" + ctrlr.sn + "," + ctrlr.ip);
                        WinInfoHelper.ShowInfoWindow(this, "添加/更新控制器失败!");
                    }
                }
                catch (Exception ex)
                {
                    log.Error("添加控制器异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "添加/更新控制器失败:" + ex.Message);
                }
            });

            ctrlWaiting.Show(this);
        }
Exemplo n.º 2
0
        private void btnAddCtrlr_Click(object sender, EventArgs e)
        {
            FrmAddOrModifyCtrlr frmModify = new FrmAddOrModifyCtrlr();

            if (frmModify.ShowDialog(this) == DialogResult.OK)
            {
                AddRow(frmModify.Controller);
            }
        }
Exemplo n.º 3
0
        private void DoModify(DataGridViewRow row)
        {
            Maticsoft.Model.SMT_CONTROLLER_INFO ctrlr = (Maticsoft.Model.SMT_CONTROLLER_INFO)row.Tag;
            FrmAddOrModifyCtrlr frmModify             = new FrmAddOrModifyCtrlr(ctrlr);

            if (frmModify.ShowDialog(this) == DialogResult.OK)
            {
                UpdateRow(row, frmModify.Controller);
            }
        }