private void btnConfiguration_Click(object sender, EventArgs e) { using (frmReworkRouterConfiguration formConfig = new frmReworkRouterConfiguration()) { OpenReworkPWO reworkPWO = pwos[grdvPWOs.FocusedRowHandle]; formConfig.ReworkPWO = reworkPWO; switch (btnConfiguration.Text) { case "新建返工路由": formConfig.Mode = EditStatus.New; break; case "修改返工路由": formConfig.Mode = EditStatus.Edit; break; case "查看返工路由": formConfig.Mode = EditStatus.Browse; break; } formConfig.ShowDialog(); btnRefresh.PerformClick(); } }
private void grdvPWOs_FocusedRowObjectChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventArgs e) { if (e.FocusedRowHandle < 0) { btnConfiguration.Visible = false; } else { OpenReworkPWO pwo = pwos[e.FocusedRowHandle]; switch (pwo.PWOStatus) { case 1: btnConfiguration.Visible = true; btnConfiguration.Text = "新建返工配置"; miConfiguration.Enabled = true; miConfiguration.Text = btnConfiguration.Text; break; case 2: case 3: case 4: btnConfiguration.Visible = true; btnConfiguration.Text = "修改返工配置"; miConfiguration.Enabled = true; miConfiguration.Text = btnConfiguration.Text; break; case 5: case 6: case 7: case 8: case 9: btnConfiguration.Visible = true; btnConfiguration.Text = "查看返工配置"; miConfiguration.Enabled = true; miConfiguration.Text = btnConfiguration.Text; break; default: btnConfiguration.Visible = false; miConfiguration.Enabled = false; break; } } }