/// <summary> /// 变量修改触发重新检查数据 /// </summary> /// <param name="prompt">那个被修改的变量,要把修改值写回表格中</param> public void ReloadValues(PromptItem prompt) { PromptCells[prompt.RowNumber, 1].Value = prompt.PromptValue; PromptsChangedControlType.Clear(); foreach (var p in Prompts) { if (p == prompt) { continue; } string name = PromptCells[p.RowNumber, 0].Text; string value = PromptCells[p.RowNumber, 1].Text; string controlType = PromptCells[p.RowNumber, 2].Text; string helpMessage = PromptCells[p.RowNumber, 3].Text; string verifyCode = PromptCells[p.RowNumber, 4].Text; string comboString = PromptCells[p.RowNumber, 5].Text; string color = PromptCells[p.RowNumber, 7].Text; string picture = PromptCells[p.RowNumber, 9].Text; string visible = PromptCells[p.RowNumber, 10].Text; string hideInReport = PromptCells[p.RowNumber, 11].Text; string tabIndex = PromptCells[p.RowNumber, 12].Text; string calculatorIndex = PromptCells[p.RowNumber, 16].Text; //TODO:这里和之前的逻辑貌似是重叠了? //标记一下,防止循环更新导致死循环 p.IsPassive = true; p.LoadProperty(name, value, controlType, helpMessage, verifyCode, comboString, color, picture, visible, hideInReport, tabIndex, calculatorIndex); p.IsPassive = false; } ControlTypeChangedAction(PromptsChangedControlType); //ControlTypeChanged(PromptsChangedControlType); }
private void loadCellPrompts() { //读取Tabs for (int i = 0; i < PromptCells.Rows.RowCount; i++) { string TabName = PromptCells[i, 13].Text; if (!string.IsNullOrEmpty(TabName)) { //logger.Debug("增加Tab:" + TabName); this.PromptTabs.Add(TabName); } else { break; } } //读取计算器 for (int i = 0; i < PromptCells.Rows.RowCount; i++) { string CalName = PromptCells[i, 17].Text; if (!string.IsNullOrEmpty(CalName)) { //logger.Debug("增加计算器:" + CalName); var strs = CalName.Split('|'); if (strs.Length < 3) { continue; } string name = strs[0]; double upperBound; if (!double.TryParse(strs[1], out upperBound)) { continue; } double gap; if (!double.TryParse(strs[2], out gap)) { continue; } Calcuators.Add(new CalculatorItem() { Name = name, UpperBound = upperBound, Gap = gap, Index = i }); } else { break; } } for (int i = 0; i < PromptCells.Rows.RowCount; i++) { var name = PromptCells[i, 0].Text; if (string.IsNullOrEmpty(name)) { //logger.Info("空行中断读取,行号:" + i.ToString()); break; } //忽略宽度、高度、深度三个变量 if (i == 0 || i == 1 || i == 2) { continue; } string value = PromptCells[i, 1].Text; string controlType = PromptCells[i, 2].Text; string helpMessage = PromptCells[i, 3].Text; string verifyCode = PromptCells[i, 4].Text; string comboString = PromptCells[i, 5].Text; string color = PromptCells[i, 7].Text; string picture = PromptCells[i, 9].Text; string visible = PromptCells[i, 10].Text; string hideInReport = PromptCells[i, 11].Text; string tabIndex = PromptCells[i, 12].Text; string calculatorIndex = PromptCells[i, 16].Text; //logger.Debug(string.Format("Prompt变量数据:{0}/{1}/{2}/{3}/{4}/{5}/{6}/{7}/{8}/{9}/{10}/{11}", // name, // value, // controlType, // helpMessage, // verifyCode, // comboString, // color, // picture, // visible, // hideInReport, // tabIndex, // calculatorIndex)); PromptItem prompt = new PromptItem(name, value, controlType, helpMessage, verifyCode, comboString, color, picture, visible, hideInReport, tabIndex, calculatorIndex, i, this); Prompts.Add(prompt); } }
public void RecordControlTypeChange(PromptItem prompt) { PromptsChangedControlType.Add(prompt); }