private void ParamSetForm_Load(object sender, EventArgs e) { if (!File.Exists(configPath))//创建配置文件夹 { Directory.CreateDirectory(configPath); } if (!File.Exists(configPath + "configInfo"))//如果没有配置文件,创建一个初始的配置文件 { for (int i = 0; i < HSD_EMAT.totalChannelNum; i++) { UpdateParamFromForm(i); AllForms.m_GageForm.UpdateGageInfoFormForm(i); } try { AllChannelsSet.SaveParamToXml(configPath + "configInfo"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } AllChannelsSet.UpdateParamFromXml(configPath + "configInfo"); //从配置中读取参数 UpdateTrackBarFromParam(currChanNum); //初始化参数显示 UpdateLableFromParam(currChanNum); for (int i = 0; i < HSD_EMAT.totalGageNum; i++) { AllForms.m_GageForm.UpdateGageForm(i); } AllForms.m_GageForm.UpdateGageForm(currChanNum); AllChannelsSet.UpDateSysAllParam(); }
//从xml文件中读取更新参数窗体与闸门窗体 private void UpdateAllFormFromXml(string filePath) { AllChannelsSet.UpdateParamFromXml(filePath);//从配置中读取参数 UpdateTrackBarFromParam(currChanNum); UpdateLableFromParam(currChanNum); AllForms.m_GageForm.UpdateGageForm(currChanNum); }