|
@@ -15,6 +15,7 @@ using System.Windows.Media.Imaging;
|
|
|
using InABox.Configuration;
|
|
|
using System.Reactive.Linq;
|
|
|
using InABox.Wpf;
|
|
|
+using InABox.Dxf;
|
|
|
|
|
|
namespace PRSDesktop;
|
|
|
|
|
@@ -471,6 +472,7 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
"PDF Files (*.pdf)|*.pdf|" +
|
|
|
"Component Files (*.xls;*.xlsx;*.csv;*.txt)|*.xls;*.xlsx;*.csv;*.txt|" +
|
|
|
"Image Files (*.bmp;*.png;*.jpg;*.jpeg)|*.bmp;*.png;*.jpg;*.jpeg|" +
|
|
|
+ "DXF Files (*.dxf)|*.dxf|" +
|
|
|
"All Files (*.*)|*.*"
|
|
|
};
|
|
|
if (dlg.ShowDialog() == true)
|
|
@@ -478,6 +480,7 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
var pdfs = new List<string>();
|
|
|
var images = new List<string>();
|
|
|
var components = new List<string>();
|
|
|
+ var dxfs = new List<string>();
|
|
|
foreach(var filename in dlg.FileNames)
|
|
|
{
|
|
|
var ext = Path.GetExtension(filename).ToLower();
|
|
@@ -489,6 +492,10 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
{
|
|
|
images.Add(filename);
|
|
|
}
|
|
|
+ else if(ext == ".dxf")
|
|
|
+ {
|
|
|
+ dxfs.Add(filename);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
components.Add(filename);
|
|
@@ -497,6 +504,7 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
|
|
|
AddPDFFiles(pdfs, doRefresh: false);
|
|
|
AddImageFiles(images, doRefresh: false);
|
|
|
+ AddDXFFiles(dxfs, doRefresh: false);
|
|
|
AddComponentFiles(components, Guid.Empty);
|
|
|
|
|
|
Refresh(false, true);
|
|
@@ -592,6 +600,25 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void AddDXFFiles(IEnumerable<string> fileNames, bool doRefresh = true)
|
|
|
+ {
|
|
|
+ AddDocuments(fileNames.Select(x =>
|
|
|
+ {
|
|
|
+ var dxf = DxfUtils.LoadDxf(x);
|
|
|
+ var pdf = DxfUtils.ProcessPdf(dxf);
|
|
|
+ var data = pdf.SaveToBytes();
|
|
|
+ return new Tuple<string, Document>(
|
|
|
+ x,
|
|
|
+ new Document
|
|
|
+ {
|
|
|
+ Data = data,
|
|
|
+ FileName = Path.GetFileName(x) + ".pdf",
|
|
|
+ CRC = CoreUtils.CalculateCRC(data),
|
|
|
+ TimeStamp = new FileInfo(x).LastWriteTime
|
|
|
+ });
|
|
|
+ }), doRefresh: doRefresh);
|
|
|
+ }
|
|
|
+
|
|
|
public void AddPDFFiles(IEnumerable<string> fileNames, bool doRefresh = true)
|
|
|
{
|
|
|
var cancel = new CancelEventArgs();
|