private void ExportAllButton_Click() { DialogBox.SaveFileDialog dialog = new DialogBox.SaveFileDialog(); string filePath; List <int> indexs = new List <int>(); foreach (DeviceShortMessageLine line in DeviceSMesageContainer.Children) { indexs.Add(line.GetID()); } dialog.Title = "选择导出文件保存路径"; dialog.Filter = "xml File(*.xml)|*.xml"; dialog.DefaultExt = "xml"; //如果用户没有添加则自动添加扩展 dialog.AddExtension = true; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //文件路径 filePath = dialog.FileName; List <StandardDeviceDesModel> list = new List <StandardDeviceDesModel>(); for (int counter = 0; counter < indexs.Count; counter++) { list.Add(DBControler.UnityIns.GetSSDesTotalRecord(indexs[counter])); } SDDAndXml.SaveToXml(filePath, list); BottomPart.Log("导出所有器件信息成功", LogMessage.LevelEnum.Important); } }
private void ETXButton_Click() { DialogBox.SaveFileDialog dialog = new DialogBox.SaveFileDialog(); string filePath; dialog.Title = "选择导出文件保存路径"; dialog.Filter = "xml File(*.xml)|*.xml"; dialog.DefaultExt = "xml"; //如果用户没有添加则自动添加扩展 dialog.AddExtension = true; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //文件路径 filePath = dialog.FileName; StandardDeviceDesModel model = DBControler.UnityIns.GetSSDesTotalRecord(_ID); List <StandardDeviceDesModel> list = new List <StandardDeviceDesModel>(); list.Add(model); SDDAndXml.SaveToXml(filePath, list); BottomPart.Log("导出成功", LogMessage.LevelEnum.Important); } }