Show last modified date for templates

This commit is contained in:
Jonathan Jenne 2022-10-10 11:45:08 +02:00
parent 8a1bb6911f
commit 16ace2c242
3 changed files with 33 additions and 1 deletions

View File

@ -22,6 +22,11 @@ Namespace Templates
Public Property OutputDirectory As String
Public Property ArchiveDirectory As String
''' <summary>
''' Last modified date of the template file
''' </summary>
Public Property LastModified As Date
Public ReadOnly Property DocType As DocumentType
Get
Dim oDocType As String = GetParameter("DOCTYPE")

View File

@ -45,6 +45,7 @@ Partial Class frmMain
Me.colName = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colDescription = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colFileName = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colChangedWhen = New DevExpress.XtraGrid.Columns.GridColumn()
Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.MultiTool.Form.frmWaitForm), True, True)
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SvgImageCollection1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -204,7 +205,7 @@ Partial Class frmMain
'
'GridViewTemplates
'
Me.GridViewTemplates.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colName, Me.colDescription, Me.colFileName})
Me.GridViewTemplates.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colName, Me.colDescription, Me.colFileName, Me.colChangedWhen})
Me.GridViewTemplates.GridControl = Me.GridControlTemplates
Me.GridViewTemplates.Name = "GridViewTemplates"
'
@ -232,6 +233,14 @@ Partial Class frmMain
Me.colFileName.Visible = True
Me.colFileName.VisibleIndex = 2
'
'colChangedWhen
'
Me.colChangedWhen.Caption = "Letzte Änderung"
Me.colChangedWhen.FieldName = "LastModified"
Me.colChangedWhen.Name = "colChangedWhen"
Me.colChangedWhen.Visible = True
Me.colChangedWhen.VisibleIndex = 3
'
'SplashScreenManager
'
Me.SplashScreenManager.ClosingDelay = 500
@ -283,4 +292,5 @@ Partial Class frmMain
Friend WithEvents btnOpenSchemaDirectory As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents btnReloadWinlineData As DevExpress.XtraBars.BarButtonItem
Friend WithEvents colChangedWhen As DevExpress.XtraGrid.Columns.GridColumn
End Class

View File

@ -124,6 +124,19 @@ Public Class frmMain
Dim oBindingSource = New BindingList(Of Template)
For Each oTemplate As Template In TemplateLoader.TemplateList
' Check template files and update modified date
Try
Dim oFilePath = IO.Path.Combine(My.GeneralConfiguration.TemplateDirectory, oTemplate.FileName)
Dim oFileInfo = New FileInfo(oFilePath)
If oFileInfo.Exists Then
oTemplate.LastModified = oFileInfo.LastWriteTime
End If
Catch ex As Exception
Logger.Error(ex)
End Try
oBindingSource.Add(oTemplate)
Next
Return oBindingSource
@ -287,4 +300,8 @@ Public Class frmMain
RibbonPageGroupStart.Enabled = True
SplashScreenManager.CloseWaitForm()
End Sub
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
End Sub
End Class