private void btnFromAdd_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(cmbJobType.Text)) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "Select JobType", this.Text); return; } //if (String.IsNullOrEmpty(cmbFromPort.Text) || String.IsNullOrEmpty(cmbFromCST.Text)) if (String.IsNullOrEmpty(cmbFromPort.Text)) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "Select Port", this.Text); return; } if( String.IsNullOrEmpty(txtFromCST.Text)) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "Check Carrier", this.Text); return; } if (this.duplicateCheckCST(txtFromCST.Text)) { return; } //Split or Scrap or SlotChange ,only select one CST if ( (string.Equals(cmbJobType.Text,SortJobType.Split) || string.Equals(cmbJobType.Text,SortJobType.Scrap)|| string.Equals(cmbJobType.Text,SortJobType.SlotChange)) && tabControl1.TabCount >= 1) { ExceptionMsgBox.This.ShowMessageBox(MessageType.Warning, "SortJobType is " + cmbJobType.Text + ", Source CST only choice One!", this.Text); return; } //string grdtitle = "grdFrom" + cmbFromCST.Text; string grdtitle = "grdFrom" + txtFromCST.Text; TabPage tab = new TabPage(); //tab.Text = this.cmbFromPort.Text + "_" + this.cmbFromCST.Text; tab.Text = cmbFromPort.Text; //tab.Name = "tp" + cmbFromCST.Text; tab.Name = "tp" + txtFromCST.Text; //this.createDesignInstance(tab, grdtitle, cmbFromCST.Text); this.createDesignInstance(tab, grdtitle, txtFromCST.Text); this.tabControl1.TabPages.Add(tab); try { UGrid grdFrom = new UGrid(); Control[] ctrl = this.tabControl1.TabPages[tabControl1.TabCount - 1].Controls.Find(grdtitle, true); if (ctrl.Length > 0) { grdFrom = ctrl[0] as UGrid; } this.tabControl1.SelectTab(tabControl1.TabCount - 1); // zendao 490 setDummyGlassRowHighLight 20210830 foreach (TabPage page in tabControl1.TabPages) { foreach (Control tabPanel in page.Controls) { foreach (Control grid in tabPanel.Controls) { if (grid is UGrid) { UGrid grdProductList = new UGrid(); grdProductList = (UGrid)grid; setDummyGlassRowHighLight(grdProductList); setEmptyGlassActivation(grdProductList); grdProductList.SetPerformAutoResize(); } } } } } catch (Exception err) { UILogger.This.Trace(err); } }
时间: 2024-04-07 07:31:53 浏览: 126
这段代码是用来处理一个按钮的点击事件,当点击这个按钮时,会执行一系列的判断和操作,最终会创建一个新的选项卡,并在其中添加一个名为“grdFrom”的控件。其中,代码中包含了一些条件判断,例如如果“cmbJobType”控件中的文本为空,则会弹出一个警告框提示用户选择“JobType”;如果“cmbFromPort”控件中的文本为空,则会弹出一个警告框提示用户选择“Port”等。此外,代码中还包含了一些异常处理的代码,例如当查找所需的控件失败时,会输出异常信息。
阅读全文