Add virtual property to field value, improve ui when loading files, improve initial loading

This commit is contained in:
Jonathan Jenne
2022-04-08 13:17:46 +02:00
parent 623f75d0e5
commit 51912b36c2
7 changed files with 202 additions and 64 deletions

View File

@@ -615,6 +615,13 @@ Public Class frmImportMain
SplashScreenManager.SetWaitFormDescription(oMessage)
End Sub
AddHandler DocumentLoader.FileLoadProgress, Sub(_sender As Object, _e As Documents.DocumentLoader.FileLoadProgressInfo)
Dim oMessage = String.Format("Lade Dateien ({0}/{1}): {2}", _e.FilesLoaded, _e.FilesTotal, _e.RunningFunction)
SplashScreenManager.SetWaitFormDescription(oMessage)
End Sub
SplashScreenManager.SetWaitFormDescription(String.Format("Lade Dateien ({0}/{1})", 0, DocumentLoader.Files.Count))
If Await DocumentLoader.LoadFiles(CurrentTemplate, lookupMandator.EditValue) Then
GridControlFiles.DataSource = Nothing
GridControlFiles.DataSource = DocumentLoader.Files

View File

@@ -32,15 +32,15 @@ Partial Class frmMain
Me.btnOpenSchemaDirectory = New DevExpress.XtraBars.BarButtonItem()
Me.btnReloadWinlineData = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroupStart = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroupData = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPage3 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.SvgImageCollection1 = New DevExpress.Utils.SvgImageCollection(Me.components)
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
Me.GridControlTemplates = New DevExpress.XtraGrid.GridControl()
Me.GridViewTemplates = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colName = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colDescription = New DevExpress.XtraGrid.Columns.GridColumn()
@@ -48,7 +48,7 @@ Partial Class frmMain
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()
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridControlTemplates, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridViewTemplates, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
@@ -133,23 +133,23 @@ Partial Class frmMain
'
'RibbonPage1
'
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup3})
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroupStart, Me.RibbonPageGroupData})
Me.RibbonPage1.Name = "RibbonPage1"
Me.RibbonPage1.Text = "Start"
'
'RibbonPageGroup1
'RibbonPageGroupStart
'
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnOpenImportExportForm)
Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
Me.RibbonPageGroup1.Text = "Start"
Me.RibbonPageGroupStart.ItemLinks.Add(Me.btnOpenImportExportForm)
Me.RibbonPageGroupStart.Name = "RibbonPageGroupStart"
Me.RibbonPageGroupStart.Text = "Start"
'
'RibbonPageGroup3
'RibbonPageGroupData
'
Me.RibbonPageGroup3.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
Me.RibbonPageGroup3.ItemLinks.Add(Me.btnReloadTemplates)
Me.RibbonPageGroup3.ItemLinks.Add(Me.btnReloadWinlineData)
Me.RibbonPageGroup3.Name = "RibbonPageGroup3"
Me.RibbonPageGroup3.Text = "Daten"
Me.RibbonPageGroupData.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
Me.RibbonPageGroupData.ItemLinks.Add(Me.btnReloadTemplates)
Me.RibbonPageGroupData.ItemLinks.Add(Me.btnReloadWinlineData)
Me.RibbonPageGroupData.Name = "RibbonPageGroupData"
Me.RibbonPageGroupData.Text = "Daten"
'
'RibbonPage3
'
@@ -191,21 +191,21 @@ Partial Class frmMain
Me.SvgImageCollection1.Add("import", "image://svgimages/scheduling/import.svg")
Me.SvgImageCollection1.Add("export", "image://svgimages/export/export.svg")
'
'GridControl1
'GridControlTemplates
'
Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GridControl1.Location = New System.Drawing.Point(0, 158)
Me.GridControl1.MainView = Me.GridViewTemplates
Me.GridControl1.MenuManager = Me.RibbonControl1
Me.GridControl1.Name = "GridControl1"
Me.GridControl1.Size = New System.Drawing.Size(757, 355)
Me.GridControl1.TabIndex = 9
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewTemplates})
Me.GridControlTemplates.Dock = System.Windows.Forms.DockStyle.Fill
Me.GridControlTemplates.Location = New System.Drawing.Point(0, 158)
Me.GridControlTemplates.MainView = Me.GridViewTemplates
Me.GridControlTemplates.MenuManager = Me.RibbonControl1
Me.GridControlTemplates.Name = "GridControlTemplates"
Me.GridControlTemplates.Size = New System.Drawing.Size(757, 355)
Me.GridControlTemplates.TabIndex = 9
Me.GridControlTemplates.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewTemplates})
'
'GridViewTemplates
'
Me.GridViewTemplates.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colName, Me.colDescription, Me.colFileName})
Me.GridViewTemplates.GridControl = Me.GridControl1
Me.GridViewTemplates.GridControl = Me.GridControlTemplates
Me.GridViewTemplates.Name = "GridViewTemplates"
'
'colName
@@ -241,7 +241,7 @@ Partial Class frmMain
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(757, 537)
Me.Controls.Add(Me.GridControl1)
Me.Controls.Add(Me.GridControlTemplates)
Me.Controls.Add(Me.RibbonStatusBar1)
Me.Controls.Add(Me.RibbonControl1)
Me.IconOptions.SvgImage = Global.MultiTool.Form.My.Resources.Resources.squarified
@@ -252,7 +252,7 @@ Partial Class frmMain
Me.Text = "frmMain"
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.SvgImageCollection1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridControlTemplates, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridViewTemplates, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -260,12 +260,12 @@ Partial Class frmMain
End Sub
Friend WithEvents RibbonControl1 As DevExpress.XtraBars.Ribbon.RibbonControl
Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage
Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents RibbonPageGroupStart As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar
Friend WithEvents RibbonPage2 As DevExpress.XtraBars.Ribbon.RibbonPage
Friend WithEvents btnOpenImportExportForm As DevExpress.XtraBars.BarButtonItem
Friend WithEvents SvgImageCollection1 As DevExpress.Utils.SvgImageCollection
Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
Friend WithEvents GridControlTemplates As DevExpress.XtraGrid.GridControl
Friend WithEvents GridViewTemplates As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents colName As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents colDescription As DevExpress.XtraGrid.Columns.GridColumn
@@ -276,7 +276,7 @@ Partial Class frmMain
Friend WithEvents BarButtonItem4 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents BarButtonItem3 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents RibbonPageGroupData As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager
Friend WithEvents txtVersion As DevExpress.XtraBars.BarStaticItem
Friend WithEvents txtCulture As DevExpress.XtraBars.BarStaticItem

View File

@@ -27,15 +27,16 @@ Public Class frmMain
Logger = LogConfig.GetLogger()
Logger.Info("Starting {0}, Version [{1}]", Application.ProductName, Application.ProductVersion)
ShowLoadingUI()
Catch ex As Exception
FormHelper.ShowError(ex, My.Resources.frmShared.Laden_des_Formulars)
HideLoadingUI()
End Try
End Sub
Private Async Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
SplashScreenManager.ShowWaitForm()
Try
SplashScreenManager.SetWaitFormDescription("Initialisierung der Grundfunktionen")
@@ -70,7 +71,7 @@ Public Class frmMain
Database = New MSSQLServer(LogConfig, oConnectionString)
SplashScreenManager.SetWaitFormDescription("Lade Vorlagen")
GridControl1.DataSource = Await LoadTemplateData()
GridControlTemplates.DataSource = Await LoadTemplateData()
SplashScreenManager.SetWaitFormDescription("Lade Winline Stammdaten")
My.Winline = New WinlineData(LogConfig, Database, My.GeneralConfiguration, My.MappingConfiguration, My.MandatorConfiguration)
@@ -82,7 +83,7 @@ Public Class frmMain
FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Winline_Daten)
Finally
SplashScreenManager.CloseWaitForm()
HideLoadingUI()
End Try
End Sub
@@ -238,17 +239,17 @@ Public Class frmMain
Exit Sub
End If
SplashScreenManager.ShowWaitForm()
ShowLoadingUI()
Try
SplashScreenManager.SetWaitFormDescription("Lade Vorlagen")
GridControl1.DataSource = Await LoadTemplateData()
GridControlTemplates.DataSource = Await LoadTemplateData()
Catch ex As Exception
FormHelper.ShowError(ex, "Laden der Vorlagen")
Finally
SplashScreenManager.CloseWaitForm()
HideLoadingUI()
End Try
End Sub
@@ -258,7 +259,7 @@ Public Class frmMain
Exit Sub
End If
SplashScreenManager.ShowWaitForm()
ShowLoadingUI()
Try
SplashScreenManager.SetWaitFormDescription("Lade Winline Stammdaten")
@@ -268,8 +269,22 @@ Public Class frmMain
FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Winline_Daten)
Finally
SplashScreenManager.CloseWaitForm()
HideLoadingUI()
End Try
End Sub
Private Sub ShowLoadingUI()
SplashScreenManager.ShowWaitForm()
GridControlTemplates.Enabled = False
RibbonPageGroupData.Enabled = False
RibbonPageGroupStart.Enabled = False
End Sub
Private Sub HideLoadingUI()
GridControlTemplates.Enabled = True
RibbonPageGroupData.Enabled = True
RibbonPageGroupStart.Enabled = True
SplashScreenManager.CloseWaitForm()
End Sub
End Class

View File

@@ -117,6 +117,8 @@ Public Class frmRowEditor
End If
If oField.Value Is Nothing Then
' TODO: Do we need to create a new field value here?
' aka. do we need to configure fieldvalue from column settings
oDict.Add(oColumnName, New FieldValue())
Else
oDict.Add(oColumnName, oField.Value)
@@ -154,6 +156,10 @@ Public Class frmRowEditor
Where(Function(f) f.Key = oRow.Item(COL_KEY)).
SingleOrDefault()
' TODO: Why do we need to create new fieldvalues here?
' aka. why would the be a value for which no fieldvalue exists yet?
' If there are (non-virtual) fields in the template which do not have a value yet,
' this might happen.
If oField.Key Is Nothing Then
oField = New KeyValuePair(Of String, FieldValue)(oRow.Item(COL_KEY), New FieldValue())
End If
@@ -173,10 +179,11 @@ Public Class frmRowEditor
If Not oFieldValue.Final.Equals(oValueFromGrid) Then
' If new value is not empty, any error will be removed.
' Could cause problems in the future because a value might not equal to 'no error'.
' 03.12.21: For now we always remove the error if ANYTHING changed about the field
'If oValueFromGrid <> String.Empty Then
' oFieldValue.Error = FieldError.None
'End If
' 03.12.21: For now we always remove the error if ANYTHING changed about the field
oFieldValue.Error = FieldError.None
' Save the grid value to the Field