using DevExpress.XtraEditors;
|
using System.IO;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace IStation.WinFrmUI.Basic
|
{
|
/// <summary>
|
/// 导入项目辅助类
|
/// </summary>
|
public class ImportProjectHelper
|
{
|
/// <summary>
|
/// 测试系统
|
/// </summary>
|
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<IStation.OpenDto.FullPacking>(json);
|
var result = ConvertHelper.ConvertTProduct(dataPacking);
|
WaitFrmHelper.HideWaitForm();
|
if (!result)
|
{
|
XtraMessageBox.Show("导入失败!");
|
}
|
else
|
{
|
XtraMessageBox.Show("导入成功");
|
}
|
|
}
|
}
|
}
|