Files
CPXV2/CPXV2 TRA V2/JsonConvertTool/Form1.cs

47 lines
1.2 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemX.Common.Util;
using CPXV2Log = SystemX.Net.Platform.SystemX.Net.XEFCore.DBContext.CPXV2Log;
namespace JsonConvertTool
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnClear_Click(object sender, EventArgs e)
{
richInput.Clear();
textEdit1.Text = string.Empty;
dataGridView1.DataSource = null;
}
private void btnConvert_Click(object sender, EventArgs e)
{
try
{
string strDecomp = richInput.Text;
string json = strDecomp.GzipDecompress();
var list = JsonConvert.DeserializeObject<List<CPXV2Log.Tables.HIST_TestResult>>(json);
dataGridView1.DataSource = list.ToDataTable();
}
catch(Exception ex)
{
textEdit1.Text = ex.Message;
}
}
}
}