Büroexporter geschrieben

Bug behoben, falls der Ordner von K2000 nicht excistiert
This commit is contained in:
Husky
2021-07-04 18:40:30 +02:00
parent 5e1738d96e
commit cdde5f5004
6 changed files with 250 additions and 12 deletions

View File

@@ -63,15 +63,24 @@ namespace SanSystem
if (txt_schachtnummer.Text == "")
{
bool found = false;
foreach(string directory in Directory.EnumerateDirectories(@"C:\K2000w\BILDER"))
try
{
if(directory.Contains(Global.Instance.ProjektNummer))
IEnumerable<string> directories = Directory.EnumerateDirectories(@"C:\K2000w\BILDER");
foreach (string directory in directories)
{
found = true;
openFileDialog.InitialDirectory = directory;
break;
if(directory.Contains(Global.Instance.ProjektNummer))
{
found = true;
openFileDialog.InitialDirectory = directory;
break;
}
}
}
catch(DirectoryNotFoundException)
{
// Do Nothing
}
if(!found)
{
openFileDialog.InitialDirectory = @"C:\K2000w\BILDER";