This commit is contained in:
SchreiberM
2016-06-02 12:19:02 +02:00
4 changed files with 56 additions and 23 deletions

View File

@@ -1,22 +1,7 @@
Imports DevExpress.XtraEditors.Controls
Imports System.Runtime.InteropServices
Public Class ClassControlValues
<DllImport("user32.dll")> _
Public Shared Function SendMessage(hWnd As IntPtr, msg As Int32, wParam As Boolean, lParam As Int32) As Integer
End Function
Private Const WM_SETREDRAW As Int32 = 11
Private Sub SuspendDraw(c As Control)
SendMessage(c.Handle, WM_SETREDRAW, False, 0)
End Sub
Private Sub ResumeDraw(c As Control)
SendMessage(c.Handle, WM_SETREDRAW, True, 0)
c.Refresh()
End Sub
Public Shared Function ControlHasValue(control As Control) As Boolean
Select Case control.GetType()
@@ -194,6 +179,8 @@ Public Class ClassControlValues
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> LoadControlHints took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
sw.Start()
For Each control As Control In controls
PerfomanceHelper.SuspendDraw(control)
Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
' Wert per LINQ aus DT_ControlValues suchen der zur aktuellen controlId passt
Dim values As List(Of Object) = (From row In DT_ControlValues.AsEnumerable()
@@ -205,6 +192,8 @@ Public Class ClassControlValues
Else
LoadControlValue(RecordId, ParentRecordId, ControlId, control, values, Entity_ID)
End If
PerfomanceHelper.ResumeDraw(control)
Next
elapsed = sw.Elapsed.TotalSeconds
@@ -348,7 +337,7 @@ Public Class ClassControlValues
For Each Ctrl As Control In controls
Dim controlTagId = DirectCast(Ctrl.Tag, ClassControlMetadata).Id
PerfomanceHelper.SuspendDraw(Ctrl)
'If controlTagId = 474 Then
' MsgBox("Thats it")
@@ -376,10 +365,9 @@ Public Class ClassControlValues
Case GetType(DevExpress.XtraGrid.GridControl)
Dim grid = DirectCast(Ctrl, DevExpress.XtraGrid.GridControl)
ControlLoader.DataGridViewCheckable.LoadList(grid, FormID, ConnID, sqlcommand)
End Select
PerfomanceHelper.ResumeDraw(Ctrl)
Next
sw.Stop()
@@ -426,6 +414,8 @@ Public Class ClassControlValues
sqlcommand = ReplaceSqlCommandPlaceholders(sqlcommand, RecordId, ParentRecordId, entity_ID)
PerfomanceHelper.SuspendDraw(Ctrl)
Select Case Ctrl.GetType()
Case GetType(CustomComboBox)
Dim combobox = DirectCast(Ctrl, CustomComboBox)
@@ -440,6 +430,8 @@ Public Class ClassControlValues
ControlLoader.CheckedListBox.LoadList(chlistbox, FormId, connID, sqlcommand)
End Select
PerfomanceHelper.ResumeDraw(Ctrl)
Next
Dim elapsed As Double
elapsed = SW.Elapsed.TotalSeconds