Messagebox wird angezeigt wenn export fertiggestellt wurde
This commit is contained in:
@@ -18,66 +18,63 @@ namespace SanSystem
|
|||||||
return Content.Count() + 1;
|
return Content.Count() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task ExportAsync(Projekt projekt, string destinationPath = "./")
|
public static bool Export(Projekt projekt, string destinationPath = "./")
|
||||||
{
|
{
|
||||||
return Task.Factory.StartNew(() =>
|
destinationPath = Path.Combine(destinationPath, "EXPORT");
|
||||||
|
foreach (Inspektionsobjekt d in projekt.Objekte)
|
||||||
{
|
{
|
||||||
destinationPath = Path.Combine(destinationPath, "EXPORT");
|
KlassenBIB.Collections.Sanierung sanierungsliste = d.Sanierung;
|
||||||
foreach (Inspektionsobjekt d in projekt.Objekte)
|
|
||||||
|
if (sanierungsliste.Count < 1) continue;
|
||||||
|
|
||||||
|
string tempPath = Path.Combine(destinationPath, "ID" + d.Sanierungsnummer);
|
||||||
|
if (Directory.Exists(tempPath))
|
||||||
{
|
{
|
||||||
KlassenBIB.Collections.Sanierung sanierungsliste = d.Sanierung;
|
try
|
||||||
|
|
||||||
if (sanierungsliste.Count < 1) continue;
|
|
||||||
|
|
||||||
string tempPath = Path.Combine(destinationPath, "ID" + d.Sanierungsnummer);
|
|
||||||
if (Directory.Exists(tempPath))
|
|
||||||
{
|
{
|
||||||
try
|
Directory.Delete(tempPath, true);
|
||||||
{
|
|
||||||
Directory.Delete(tempPath, true);
|
|
||||||
}
|
|
||||||
catch (UnauthorizedAccessException)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Directory.CreateDirectory(tempPath);
|
catch (UnauthorizedAccessException)
|
||||||
|
|
||||||
foreach (Sanierung san in sanierungsliste)
|
|
||||||
{
|
{
|
||||||
if (san is KlassenBIB.InlinerSanierung)
|
|
||||||
{
|
|
||||||
// PDF
|
|
||||||
string sourceDirectory = Path.Combine(Global.Instance.Projektpfad, "Einbauprotokolle", d.Objektbezeichnung + ".pdf");
|
|
||||||
if (!File.Exists(sourceDirectory))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Bitte Bericht erzeugen", "Haltung " + d.Objektbezeichnung + " noch nicht erstellt");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
File.Copy(sourceDirectory, tempPath + "/" + d.Objektbezeichnung + ".pdf");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (san is KlassenBIB.SchachtAnbindung)
|
|
||||||
{
|
|
||||||
string sourceDirectory = san.CheckVerzeichnisse(Global.Instance.Projektpfad);
|
|
||||||
SchachtAnbindung fotoDokumentation = (san as SchachtAnbindung);
|
|
||||||
KlassenBIB.Collections.Bilder fotos = fotoDokumentation.SavedBilders;
|
|
||||||
foreach (SavedBilder foto in fotos)
|
|
||||||
{
|
|
||||||
// Prüfen welche der nächste Freie nummer ist
|
|
||||||
// Bildname_X, wobei X eine zahl der erhöht wird, angefangen bei 1
|
|
||||||
int freeFotoNumber = getNextFotoNumber(tempPath, d.Objektbezeichnung + "*.jpg");
|
|
||||||
string destinationName = string.Format("{0}_{1:d3}.jpg", d.Objektbezeichnung, freeFotoNumber); // 0 ist der Index, d3 => 3 Decimalstellen
|
|
||||||
|
|
||||||
File.Copy(foto.Speicherpfad, Path.Combine(tempPath, destinationName));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
Directory.CreateDirectory(tempPath);
|
||||||
|
|
||||||
|
foreach (Sanierung san in sanierungsliste)
|
||||||
|
{
|
||||||
|
if (san is KlassenBIB.InlinerSanierung)
|
||||||
|
{
|
||||||
|
// PDF
|
||||||
|
string sourceDirectory = Path.Combine(Global.Instance.Projektpfad, "Einbauprotokolle", d.Objektbezeichnung + ".pdf");
|
||||||
|
if (!File.Exists(sourceDirectory))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Bitte Bericht erzeugen", "Haltung " + d.Objektbezeichnung + " noch nicht erstellt");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
File.Copy(sourceDirectory, tempPath + "/" + d.Objektbezeichnung + ".pdf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (san is KlassenBIB.SchachtAnbindung)
|
||||||
|
{
|
||||||
|
string sourceDirectory = san.CheckVerzeichnisse(Global.Instance.Projektpfad);
|
||||||
|
SchachtAnbindung fotoDokumentation = (san as SchachtAnbindung);
|
||||||
|
KlassenBIB.Collections.Bilder fotos = fotoDokumentation.SavedBilders;
|
||||||
|
foreach (SavedBilder foto in fotos)
|
||||||
|
{
|
||||||
|
// Prüfen welche der nächste Freie nummer ist
|
||||||
|
// Bildname_X, wobei X eine zahl der erhöht wird, angefangen bei 1
|
||||||
|
int freeFotoNumber = getNextFotoNumber(tempPath, d.Objektbezeichnung + "*.jpg");
|
||||||
|
string destinationName = string.Format("{0}_{1:d3}.jpg", d.Objektbezeichnung, freeFotoNumber); // 0 ist der Index, d3 => 3 Decimalstellen
|
||||||
|
|
||||||
|
File.Copy(foto.Speicherpfad, Path.Combine(tempPath, destinationName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\ILMerge.3.0.41\build\ILMerge.props" Condition="Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" />
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -515,10 +514,4 @@
|
|||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
</Project>
|
||||||
<PropertyGroup>
|
|
||||||
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Error Condition="!Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.41\build\ILMerge.props'))" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
|
||||||
@@ -376,7 +376,9 @@ namespace SanSystem
|
|||||||
|
|
||||||
private async void OnExportedExecuted(string destinationPath)
|
private async void OnExportedExecuted(string destinationPath)
|
||||||
{
|
{
|
||||||
await BüroExporter.ExportAsync(Datenbank.Instance.loadedProjekt,destinationPath);
|
Task<bool> export = Task.Factory.StartNew(() => BüroExporter.Export(Datenbank.Instance.loadedProjekt, destinationPath));
|
||||||
|
export.ContinueWith(task => MessageBox.Show("Büro export abgeschlossen"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user