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(); }
private void buttonLoadConfig_Click(object sender, EventArgs e) { FindAllConfigFileName(configPath);//获取所有的文件名 ConfigFileLoadForm configFileLoadForm = new ConfigFileLoadForm(configPathNames); configFileLoadForm.ShowDialog(); if (configFileLoadForm.DialogResult == DialogResult.Cancel) { try { AllChannelsSet.SaveParamToXml(configPath + "configInfo");//配置清空,重建默认配置 } catch (Exception ex) { MessageBox.Show(ex.Message); } } if (configFileLoadForm.DialogResult == DialogResult.Yes) { try { UpdateAllFormFromXml(configPath + configFileLoadForm.fileName); } catch (Exception ex) { MessageBox.Show(ex.Message); } AllChannelsSet.UpDateSysAllParam(); } }
private void buttonLoadDefaultCnfig_Click(object sender, EventArgs e) { try { UpdateAllFormFromXml(configPath + "configInfo"); } catch (Exception ex) { MessageBox.Show(ex.Message); } AllChannelsSet.UpDateSysAllParam(); }