using DevExpress.XtraEditors; using System.IO; using System.Text; using System.Windows.Forms; namespace IStation.WinFrmUI.Basic { /// /// 导入项目辅助类 /// public class ImportProjectHelper { /// /// 测试系统 /// public static void TProduct() { var dlg = new OpenFileDialog(); dlg.Title = "TProduct"; dlg.Filter = "bin文件 (*.bin)|*.bin"; if (dlg.ShowDialog() != DialogResult.OK) return; var enCode = Encoding.GetEncoding("GB2312"); if (enCode == null) return; WaitFrmHelper.ShowWaitForm(); var filePath = dlg.FileName; var json = File.ReadAllText(filePath, enCode); var dataPacking = JsonHelper.Json2Object(json); var result = ConvertHelper.ConvertTProduct(dataPacking); WaitFrmHelper.HideWaitForm(); if (!result) { XtraMessageBox.Show("导入失败!"); } else { XtraMessageBox.Show("导入成功"); } } } }