directories per template, export tweaks
This commit is contained in:
@@ -23,9 +23,7 @@ Public Class frmMain
|
||||
Try
|
||||
Text = String.Format(My.Resources.frmShared._0____WebService_Multitool_für_WinLine, My.Resources.frmShared.Auswahl_der_Vorlage)
|
||||
|
||||
LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, Application.CompanyName, Application.ProductName) With {
|
||||
.Debug = True
|
||||
}
|
||||
LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, Application.CompanyName, Application.ProductName)
|
||||
Logger = LogConfig.GetLogger()
|
||||
Logger.Info("Starting {0}, Version [{1}]", Application.ProductName, Application.ProductVersion)
|
||||
|
||||
@@ -41,12 +39,13 @@ Public Class frmMain
|
||||
Try
|
||||
SplashScreenManager.SetWaitFormDescription("Initialisierung der Grundfunktionen")
|
||||
|
||||
FormHelper = New FormHelper(LogConfig)
|
||||
FormHelper = New FormHelper(LogConfig, Me)
|
||||
ConfigManager = New ConfigManager(Of [Shared].Config)(LogConfig,
|
||||
Application.UserAppDataPath,
|
||||
Application.CommonAppDataPath,
|
||||
Application.StartupPath
|
||||
)
|
||||
LogConfig.Debug = ConfigManager.Config.Debug
|
||||
|
||||
GridBuilder = New GridBuilder(GridViewTemplates)
|
||||
GridBuilder.WithDefaults.WithReadOnlyOptions.WithClipboardHandler()
|
||||
@@ -137,14 +136,30 @@ Public Class frmMain
|
||||
|
||||
' Fill tables
|
||||
oTemplate = TemplateLoader.UpdateTemplateFromFile(oTemplate, My.GeneralConfiguration.TemplateDirectory)
|
||||
oTemplate = TemplateLoader.UpdateTemplateFromDatabase(oTemplate, TemplateLoader.TemplateConfiguration)
|
||||
oTemplate = TemplateLoader.UpdateTemplateFromDatabase(oTemplate)
|
||||
oTemplate = TemplateLoader.UpdateTemplateTablesFromDatabase(oTemplate, TemplateLoader.TemplateConfiguration)
|
||||
|
||||
If oTemplate.IsImport Then
|
||||
Dim oForm As New frmImportMain(LogConfig, ConfigManager, oTemplate)
|
||||
oForm.ShowDialog()
|
||||
Else
|
||||
Dim oForm As New frmExportMain(LogConfig, ConfigManager, oTemplate)
|
||||
oForm.ShowDialog()
|
||||
Dim oBaseDirectories As New List(Of String) From {
|
||||
oTemplate.InputDirectory,
|
||||
oTemplate.OutputDirectory,
|
||||
oTemplate.ArchiveDirectory
|
||||
}
|
||||
Dim oOutputDirectories As New List(Of String) From {
|
||||
oTemplate.OutputReportDirectory,
|
||||
oTemplate.OutputWebserviceDirectory,
|
||||
oTemplate.OutputXmlFileDirectory
|
||||
}
|
||||
|
||||
If TryCreateTemplateDirectories(oBaseDirectories) Then
|
||||
If TryCreateTemplateDirectories(oOutputDirectories) Then
|
||||
If oTemplate.IsImport Then
|
||||
Dim oForm As New frmImportMain(LogConfig, ConfigManager, oTemplate)
|
||||
oForm.ShowDialog()
|
||||
Else
|
||||
Dim oForm As New frmExportMain(LogConfig, ConfigManager, oTemplate)
|
||||
oForm.ShowDialog()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -153,23 +168,27 @@ Public Class frmMain
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub TryOpenDirectory(pPath As String, pDisplayName As String)
|
||||
If Directory.Exists(pPath) Then
|
||||
Process.Start(pPath)
|
||||
Else
|
||||
Dim oMessage = String.Format(My.Resources.frmImportMainExtra._0__nicht_konfiguriert_oder_nicht_gefunden, pDisplayName)
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
End Sub
|
||||
Private Function TryCreateTemplateDirectories(pDirectories As List(Of String)) As Boolean
|
||||
For Each oDirectory In pDirectories
|
||||
If Directory.Exists(oDirectory) = False Then
|
||||
Dim oResult As MsgBoxResult = MsgBox($"Das Verzeichnis [{oDirectory}] existiert noch nicht, wird aber zum Benutzen des Programms benötigt. Wollen Sie es jetzt anlegen?", vbQuestion Or vbYesNo, Text)
|
||||
If oResult = MsgBoxResult.Yes Then
|
||||
Try
|
||||
Directory.CreateDirectory(oDirectory)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox($"Das Verzeichnis [{oDirectory}] konnte nicht angelegt werden. Grund: [{ex.Message}]")
|
||||
|
||||
Private Sub TryOpenFile(pPath As String, pDisplayName As String)
|
||||
If File.Exists(pPath) Then
|
||||
Process.Start(pPath)
|
||||
Else
|
||||
Dim oMessage = String.Format(My.Resources.frmImportMainExtra._0__nicht_konfiguriert_oder_nicht_gefunden, pDisplayName)
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
End Sub
|
||||
Return False
|
||||
End Try
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
||||
Dim oForm As New frmConfig(LogConfig, ConfigManager)
|
||||
@@ -178,14 +197,14 @@ Public Class frmMain
|
||||
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
Dim oUserConfigDirectory = New FileInfo(ConfigManager.UserConfigPath).Directory
|
||||
TryOpenDirectory(oUserConfigDirectory.FullName, My.Resources.frmImportMainExtra.Konfigurationsverzeichnis)
|
||||
FormHelper.TryOpenDirectory(oUserConfigDirectory.FullName, My.Resources.frmImportMainExtra.Konfigurationsverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
|
||||
TryOpenDirectory(LogConfig.LogDirectory, My.Resources.frmImportMainExtra.Logverzeichnis)
|
||||
FormHelper.TryOpenDirectory(LogConfig.LogDirectory, My.Resources.frmImportMainExtra.Logverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
|
||||
|
||||
Private Sub btnOpenSchemaDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenSchemaDirectory.ItemClick
|
||||
FormHelper.TryOpenDirectory(My.GeneralConfiguration.TemplateDirectory, My.Resources.frmImportMainExtra.Vorlagenverzeichnis)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user