Shuxia Ning
2024-10-08 cf4967a0aebab18c5a37137f3e4c61b2d73a54bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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("导入成功");
            }
 
        }
    }
}