first pass of price calculation, making document loader async
This commit is contained in:
@@ -183,17 +183,17 @@ Public Class frmImportMain
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnLoadFiles.ItemClick
|
||||
LoadFiles()
|
||||
End Sub
|
||||
Private Async Function btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Task Handles btnLoadFiles.ItemClick
|
||||
Await LoadFiles()
|
||||
End Function
|
||||
|
||||
Private Sub frmImportMain_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
|
||||
Private Async Function frmImportMain_KeyDown(sender As Object, e As KeyEventArgs) As Task Handles MyBase.KeyDown
|
||||
If e.KeyCode = Keys.F5 Then
|
||||
LoadFiles()
|
||||
Await LoadFiles()
|
||||
End If
|
||||
End Sub
|
||||
End Function
|
||||
|
||||
Private Sub btnReloadFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnReloadFile.ItemClick
|
||||
Private Async Sub btnReloadFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnReloadFile.ItemClick
|
||||
Dim oCurrentMandator As Mandator = TryCast(lookupMandator.EditValue, Mandator)
|
||||
If oCurrentMandator Is Nothing Then
|
||||
MsgBox(My.Resources.frmImportMainExtra.Bitte_wählen_Sie_einen_Mandanten_aus__bevor_Sie_fortfahren, MsgBoxStyle.Exclamation, Text)
|
||||
@@ -206,7 +206,7 @@ Public Class frmImportMain
|
||||
Try
|
||||
If oResult = DialogResult.Yes Then
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
|
||||
Dim oNewDocument = DocumentLoader.LoadFile(oDocument.File, CurrentTemplate, lookupMandator.EditValue)
|
||||
Dim oNewDocument = Await DocumentLoader.LoadFile(oDocument.File, CurrentTemplate, lookupMandator.EditValue)
|
||||
Dim oIndex = DocumentLoader.Files.IndexOf(oDocument)
|
||||
DocumentLoader.Files.Item(oIndex) = oNewDocument
|
||||
|
||||
@@ -598,7 +598,7 @@ Public Class frmImportMain
|
||||
GridViewFiles.RefreshData()
|
||||
End Sub
|
||||
|
||||
Private Sub LoadFiles()
|
||||
Private Async Function LoadFiles() As Task
|
||||
Try
|
||||
BeginLoadingUI()
|
||||
|
||||
@@ -607,7 +607,7 @@ Public Class frmImportMain
|
||||
SplashScreenManager.SetWaitFormDescription(oMessage)
|
||||
End Sub
|
||||
|
||||
If DocumentLoader.LoadFiles(CurrentTemplate, lookupMandator.EditValue) Then
|
||||
If Await DocumentLoader.LoadFiles(CurrentTemplate, lookupMandator.EditValue) Then
|
||||
GridControlFiles.DataSource = Nothing
|
||||
GridControlFiles.DataSource = DocumentLoader.Files
|
||||
|
||||
@@ -622,7 +622,7 @@ Public Class frmImportMain
|
||||
Finally
|
||||
EndLoadingUI()
|
||||
End Try
|
||||
End Sub
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
@@ -733,13 +733,21 @@ Public Class frmImportMain
|
||||
SplashScreenManager.ShowWaitForm()
|
||||
SetDocumentButtonsEnabled(False)
|
||||
GridControlFiles.Enabled = False
|
||||
btnLoadFiles.Enabled = False
|
||||
SplitContainerGrids.Enabled = False
|
||||
|
||||
RibbonPageGroupLoad.Enabled = False
|
||||
RibbonPageGroupEdit.Enabled = False
|
||||
RibbonPageGroupReport.Enabled = False
|
||||
RibbonPageGroupTransfer.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub EndLoadingUI()
|
||||
RibbonPageGroupLoad.Enabled = True
|
||||
RibbonPageGroupEdit.Enabled = True
|
||||
RibbonPageGroupReport.Enabled = True
|
||||
RibbonPageGroupTransfer.Enabled = True
|
||||
|
||||
SplitContainerGrids.Enabled = True
|
||||
btnLoadFiles.Enabled = True
|
||||
GridControlFiles.Enabled = True
|
||||
SetDocumentButtonsEnabled(True)
|
||||
SplashScreenManager.CloseWaitForm()
|
||||
@@ -755,17 +763,30 @@ Public Class frmImportMain
|
||||
btnEditRow.Enabled = pEnabled
|
||||
End Sub
|
||||
|
||||
Private Sub btnCalculatePrices_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCalculatePrices.ItemClick
|
||||
Private Async Sub btnCalculatePrices_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCalculatePrices.ItemClick
|
||||
Dim oCurrentMandator As Mandator = TryCast(lookupMandator.EditValue, Mandator)
|
||||
If oCurrentMandator Is Nothing Then
|
||||
MsgBox(My.Resources.frmImportMainExtra.Bitte_wählen_Sie_einen_Mandanten_aus__bevor_Sie_fortfahren, MsgBoxStyle.Exclamation, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oNewDocument = DocumentLoader.MaybeApplyPriceFunctions(CurrentDocument, oCurrentMandator, CurrentTemplate)
|
||||
BeginLoadingUI()
|
||||
SplashScreenManager.SetWaitFormDescription("Lade Preisinformationen..")
|
||||
|
||||
DocumentLoader.ReplaceDocument(oNewDocument)
|
||||
LoadDocument(oNewDocument)
|
||||
Dim oStopWatch As New Stopwatch()
|
||||
Try
|
||||
oStopWatch.Start()
|
||||
Dim oNewDocument = Await DocumentLoader.MaybeApplyPriceFunctions(CurrentDocument, oCurrentMandator, CurrentTemplate)
|
||||
oStopWatch.Stop()
|
||||
|
||||
DocumentLoader.ReplaceDocument(oNewDocument)
|
||||
LoadDocument(oNewDocument)
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowError(ex, "Laden der Preisinformationen")
|
||||
Finally
|
||||
EndLoadingUI()
|
||||
Logger.Debug("Loading Priceinfo took [{0}] ms", oStopWatch.ElapsedMilliseconds)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Reference in New Issue
Block a user