/// <summary> /// Template配置文件选项发生改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox_ConfigFileList_SelectedIndexChanged(object sender, EventArgs e) { //保存修改参数 if (TemplatePropertyChanged)//属性发生改变 { TemplatePropertyChanged = false; //确认是否保存 if (DialogResult.Yes == MessageBox.Show("Save the Change", "Tip", MessageBoxButtons.YesNo)) { //传入保存函数 TemplateSaveProcess(ConfigFileListPreValue); } } ConfigFileListPreValue = comboBox_ConfigFileList.SelectedItem.ToString(); //置位初始化标志 TemplatePropertyIniFlag = true; //读取新的配置文件 ProgramData.SysPara.TemplateData = ProgramData.ResolveCsvFile(ProgramData.TemplatePath + comboBox_ConfigFileList.SelectedItem.ToString()); //刷新表格 SetDatagrid(); //刷新Template界面数据 numericUpDown_Row.Value = ProgramData.SysPara.TemplateData.Rows.Count > 0 ? ProgramData.SysPara.TemplateData.Rows.Count : 1; numericUpDown_Cols.Value = ProgramData.SysPara.TemplateData.Columns.Count > 0 ? ProgramData.SysPara.TemplateData.Columns.Count : 1; //延时 Thread.Sleep(30); //清除初始化标志 TemplatePropertyIniFlag = false; }
/// <summary> /// 初始化Template页面显示 /// </summary> private void IniTemplateDisplay() { //刷新数据 comboBox_ConfigFileList.Items.Clear(); comboBox_ConfigFileList.Items.AddRange(ProgramData.SysPara.TemplateFileList.ToArray()); if (comboBox_ConfigFileList.Items.Count > 0) { comboBox_ConfigFileList.SelectedIndex = 0; //读取新的配置文件 ProgramData.SysPara.TemplateData = ProgramData.ResolveCsvFile(ProgramData.TemplatePath + comboBox_ConfigFileList.SelectedItem.ToString()); //刷新表格 SetDatagrid(); } //设置上一次值 ConfigFileListPreValue = comboBox_ConfigFileList.SelectedItem.ToString(); }