xml文件的读写

//读取本地的配置文件到界面
private void InitControlStatus() { MaterialModel<Station> materialModel = new MaterialModel<Station>(); string filePath = ConfigurationModel.Instance.ConfigPath + "MaterialConfig.xml"; materialModel = XMLSetting.XMLRead<MaterialModel<Station>>(filePath); if (materialModel != null && materialModel.CategoryConfig.Count > 0) { foreach (var item in materialModel.CategoryConfig) { switch (item.MaterialType) { case "001": txt_CathodeSN.Text = item.MaterialSN; txt_CathodeSN.Enabled = item.TBoxEnable; btn_CathodeUP.Enabled = item.BtnUPEnable; btn_CathodeDown.Enabled = item.BtnDWNEnable; SessionModel.CathodeStatus = item.IsUpdate; break; case "002": txt_AnodeSN.Text = item.MaterialSN; txt_AnodeSN.Enabled = item.TBoxEnable; btn_AnodeUp.Enabled = item.BtnUPEnable; btn_AnodeDown.Enabled = item.BtnDWNEnable; SessionModel.AnodeStatus = item.IsUpdate; break; case "003": txt_UpDiaphragmSN.Text = item.MaterialSN; txt_UpDiaphragmSN.Enabled = item.TBoxEnable; btn_TopUp.Enabled = item.BtnUPEnable; btn_TopDown.Enabled = item.BtnDWNEnable; SessionModel.TopStatus = item.IsUpdate; break; case "004": txt_DownDiaphragmSN.Text = item.MaterialSN; txt_DownDiaphragmSN.Enabled = item.TBoxEnable; btn_BottomUp.Enabled = item.BtnUPEnable; btn_BottomDown.Enabled = item.BtnDWNEnable; SessionModel.BottomStatus = item.IsUpdate; break; case "005": txt_TapeSN.Text = item.MaterialSN; txt_TapeSN.Enabled = item.TBoxEnable; btn_TapeUP.Enabled = item.BtnUPEnable; btn_TapeDown.Enabled = item.BtnDWNEnable; SessionModel.TapeStatus = item.IsUpdate; break; case "006": txt_HightTempSN.Text = item.MaterialSN; txt_HightTempSN.Enabled = item.TBoxEnable; btn_HighTempUp.Enabled = item.BtnUPEnable; btn_HighTempDown.Enabled = item.BtnDWNEnable; SessionModel.HighTempStatus = item.IsUpdate; break; } } } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zggydy.html