首页 > 代码库 > 主项目

主项目

protected override void OnClosing(CancelEventArgs e)
{
// XmlParaHelper.Write(vm.ParaInfor);
var para = vm.ParaInfor;
if (para != null)
{
XmlSerializeHelper.XmlSerializeToFile(para, vm.Path, Encoding.UTF8);
}
base.OnClosing(e);
}

 

public string Path = "C:\\Users\\" + Environment.UserName + "\\AppData\\Roaming\\ParaInfor.xml";
public static List<int> BaudRateSetList = new List<int> { 9600, 19200, 115200 };
DataTable dt = ParaToDataTableHelper.GetDataTable();
public SerialPortViewModel()
{
PortNameList = PortData.SerialsIsConnected();

if (Path != null)
{
if (XmlSerializeHelper.Load(Path) == null)
{
XmlSerializeHelper.XmlSerializeToFile(ParaInfor, Path, Encoding.UTF8);
}
else
{
ParaInfor = XmlSerializeHelper.XmlDeserializeFromFile<ParaInfor>(Path, Encoding.UTF8);
}
}
else
{
throw new Exception("path null !");
}


// ParaInfor = XmlParaHelper.ParaRead<ParaInfor>();
}

 

  dt.Columns.Add("日期", typeof(DateTime));

 

主项目