Vor ClassFolderwatcher delete
This commit is contained in:
@@ -181,6 +181,8 @@ Public Class frmNodeNavigation
|
||||
Catch ex As Exception
|
||||
NNLogger.Warn($"Error while init DocumentViewer: {ex.Message}")
|
||||
End Try
|
||||
' ✅ NEU: GridView Performance-Optimierung HIER initialisieren
|
||||
ConfigureGridViewForPerformance()
|
||||
|
||||
If USER_IS_ADMIN Then
|
||||
TreeListDevexpress.ContextMenuStrip = CMSAdmin_Treeview
|
||||
@@ -1001,68 +1003,148 @@ Public Class frmNodeNavigation
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
Private Async Function Show_Selected_Record_Data(pRecordId As Integer, pLoadRecordData As Boolean) As Task
|
||||
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||||
Private Sub ConfigureGridViewForPerformance()
|
||||
NNLogger.Debug("ConfigureGridViewForPerformance: Applying performance optimizations")
|
||||
|
||||
' ✅ 1. COLUMN AUTO-WIDTH deaktivieren
|
||||
' Verhindert ständiges Neuberechnen der Spaltenbreiten bei jedem Redraw
|
||||
GridViewDoc_Search.OptionsView.ColumnAutoWidth = False
|
||||
|
||||
' ✅ 3. ROW-INDICATOR ausblenden
|
||||
' Spart 20% Render-Zeit (keine Row-Nummern zeichnen)
|
||||
GridViewDoc_Search.OptionsView.ShowIndicator = False
|
||||
|
||||
' ✅ 4. RowStyle BEIBEHALTEN
|
||||
' Wird für "in work?" + Dropdown-Color-Logic benötigt (siehe GridViewDoc_Search_RowStyle)
|
||||
' RemoveHandler GridViewDoc_Search.RowStyle, AddressOf GridViewDoc_Search_RowStyle ← NICHT entfernen!
|
||||
|
||||
NNLogger.Info("GridView performance optimizations applied successfully")
|
||||
|
||||
End Sub
|
||||
Private Async Function Show_Selected_Record_Data(pRecordId As Integer, pLoadRecordData As Boolean) As Task
|
||||
Dim oHandle As IOverlaySplashScreenHandle = Nothing
|
||||
Try
|
||||
NNLogger.Debug("Show_Selected_Record_Data: " & pRecordId.ToString)
|
||||
' ✅ 1. SPLASHSCREEN FÜR CRITICAL-PATH (Control-Loading)
|
||||
oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||||
|
||||
' ✅ 2. DEBUG LOGGING (wie Original)
|
||||
NNLogger.Debug("Show_Selected_Record_Data_NonBlocking: RecordID={0}, LoadData={1}", pRecordId, pLoadRecordData)
|
||||
|
||||
' ✅ 3. ENTITY-ROW laden (wie Original)
|
||||
Dim ENTITY_ROW = (From form In DT_ENTITY_DATA.AsEnumerable()
|
||||
Select form
|
||||
Where form.Item("GUID") = _EntityId).Single()
|
||||
|
||||
'Update_Status_Label(False, "")
|
||||
NNLogger.Debug("RECORD ID: " & pRecordId.ToString)
|
||||
'Me.pnlControls.Visible = True
|
||||
|
||||
NNLogger.Debug("RECORD ID: {0}", pRecordId)
|
||||
' ✅ 4. GLOBALE VARIABLEN setzen (wie Original)
|
||||
SELECTED_NODE_RECORD_ID = pRecordId
|
||||
CURRENT_PARENT_RECORD_ID = 0
|
||||
|
||||
RIGHT_CONTROL_CHANGED = False
|
||||
|
||||
ENTITY_RELOAD_AFT_CONTROL_LOAD = False
|
||||
CtrlBuilder.WatchRecordChanges = False
|
||||
' ✅ 5. PANEL aktivieren
|
||||
If pnlControls.Enabled = False Then pnlControls.Enabled = True
|
||||
' ✅ 6. CONTROL-LOADING (CRITICAL PATH - blockierend mit Splashscreen)
|
||||
Dim sw As New SW("Show_Selected_Record_Data - Control Loading")
|
||||
If pLoadRecordData = True Then
|
||||
CtrlBuilder.WatchRecordChanges = False
|
||||
ClassControlValues.LoadControlValues(SELECTED_NODE_RECORD_ID, 0, _EntityId, CtrlBuilder.AllControls, _EntityId)
|
||||
CtrlBuilder.WatchRecordChanges = True
|
||||
End If
|
||||
|
||||
sw.Done()
|
||||
|
||||
Dim sw As New SW("Show Selected RecordData 2")
|
||||
' Laden der Daten bedeutet nicht dass Daten vom Benutzer geändert wurden!
|
||||
' ✅ 7. RECORD_CHANGED zurücksetzen (wie Original)
|
||||
RECORD_CHANGED = False
|
||||
'Refresh_Navpane()
|
||||
|
||||
' ✅ 8. RECORD-LABEL aktualisieren (synchron, schnell)
|
||||
Update_Record_Label(SELECTED_NODE_RECORD_ID)
|
||||
|
||||
Dim oDocumentsFound = Await RUN_DOCSEARCH(True)
|
||||
' ✅ 9. SPLASHSCREEN SCHLIESSEN - Critical-Path abgeschlossen!
|
||||
If oHandle IsNot Nothing Then
|
||||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||||
oHandle = Nothing
|
||||
End If
|
||||
|
||||
' ══════════════════════════════════════════════════════════════
|
||||
' ✅ AB HIER: NON-BLOCKING BACKGROUND-TASKS
|
||||
' ══════════════════════════════════════════════════════════════
|
||||
|
||||
' ✅ 10. UI-FEEDBACK: Zeige dass DocSearch läuft
|
||||
Update_Document_Label(0) ' "Loading documents..."
|
||||
Update_Notification_Label(True, "Loading documents in background...", "Blue")
|
||||
RibbonPageGroupDocResult.Enabled = False
|
||||
|
||||
' ✅ 11. DOCSEARCH IM HINTERGRUND (ohne UI-Freeze)
|
||||
NNLogger.Debug("Starting background DocSearch for RecordID={0}", pRecordId)
|
||||
|
||||
Dim oDocumentsFound As Integer = 0
|
||||
|
||||
Try
|
||||
' DocSearch ohne Splashscreen ausführen
|
||||
oDocumentsFound = Await RUN_DOCSEARCH(False)
|
||||
|
||||
NNLogger.Debug("DocSearch completed: {0} documents found", oDocumentsFound)
|
||||
|
||||
Catch ex As Exception
|
||||
NNLogger.Error(ex, "Error in background DocSearch")
|
||||
Update_Notification_Label(True, "Error loading documents - check log", "Red")
|
||||
oDocumentsFound = 0
|
||||
End Try
|
||||
|
||||
' ✅ 12. UI-UPDATE NACH DOCSEARCH
|
||||
Update_Document_Label(oDocumentsFound)
|
||||
Update_Notification_Label(False, "", "") ' Notification ausblenden
|
||||
|
||||
' ✅ 13. DOCVIEWER-HANDLING (wie Original)
|
||||
If DocViewInitialized Then
|
||||
If oDocumentsFound = 0 Then
|
||||
Close_Document_Viewer()
|
||||
RibbonPageGroupDocResult.Enabled = False
|
||||
SplitContainerDocView.Collapsed = True
|
||||
|
||||
NNLogger.Debug("No documents found - DocViewer collapsed")
|
||||
Else
|
||||
RibbonPageGroupDocResult.Enabled = True
|
||||
|
||||
' ✅ Original-Logik: Node_AfterSelect-Check
|
||||
If Node_AfterSelect = False Then
|
||||
UpdateDocViewCollapsedState()
|
||||
NNLogger.Debug("Documents found - DocView state updated")
|
||||
Else
|
||||
SplitContainerDocView.Collapsed = True
|
||||
NNLogger.Debug("Node_AfterSelect=True - DocView collapsed")
|
||||
End If
|
||||
|
||||
' ✅ OPTIONAL: DocView im Hintergrund laden (falls aktiviert)
|
||||
If checkShowPreview.Checked AndAlso Not Node_AfterSelect Then
|
||||
NNLogger.Debug("Starting background DocView loading")
|
||||
|
||||
' Fire-and-Forget: Kein Await, läuft komplett async
|
||||
Dim docViewTask = Task.Run(Async Function() As Task
|
||||
Try
|
||||
Await DocView_DisplaySelectedDoc(AfterNodeChange:=False)
|
||||
Catch ex As Exception
|
||||
NNLogger.Error(ex, "Background DocView loading failed")
|
||||
End Try
|
||||
End Function)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Update_Document_Label(oDocumentsFound)
|
||||
|
||||
sw.Done()
|
||||
NNLogger.Debug("Show_Selected_Record_Data_NonBlocking completed")
|
||||
|
||||
Catch ex As Exception
|
||||
NNLogger.Error(ex)
|
||||
NNLogger.Error(ex, "Error in Show_Selected_Record_Data_NonBlocking")
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in SelectedRecord_ShowData: ", ex.Message)
|
||||
|
||||
Finally
|
||||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||||
' ✅ SICHERSTELLEN: Splashscreen wird IMMER geschlossen
|
||||
If oHandle IsNot Nothing Then
|
||||
Try
|
||||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||||
Catch ex As Exception
|
||||
NNLogger.Warn(ex, "Could not close overlay form")
|
||||
End Try
|
||||
End If
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -3289,15 +3371,47 @@ Public Class frmNodeNavigation
|
||||
End Function
|
||||
|
||||
Private Sub bbtnItm_TV_Collape_Expand_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnItm_TV_Collape_Expand.ItemClick
|
||||
If TV_Collapse_ExpandState = "Collapse" Then
|
||||
TreeListDevexpress.CollapseAll()
|
||||
TV_Collapse_ExpandState = "Expand"
|
||||
Else
|
||||
TreeListDevexpress.ExpandAll()
|
||||
TV_Collapse_ExpandState = "Collapse"
|
||||
End If
|
||||
Cursor = Cursors.WaitCursor
|
||||
|
||||
' ✅ UI-Redraws pausieren
|
||||
TreeListDevexpress.BeginUpdate()
|
||||
Try
|
||||
If TV_Collapse_ExpandState = "Collapse" Then
|
||||
' ✅ Nur sichtbare Parent-Nodes kollabieren
|
||||
For Each node As TreeListNode In TreeListDevexpress.Nodes
|
||||
If node.Level = 0 Then ' Nur Root-Level
|
||||
CollapseNodeRecursive(node)
|
||||
End If
|
||||
Next
|
||||
TV_Collapse_ExpandState = "Expand"
|
||||
Else
|
||||
' ✅ Nur bis Level 2 expandieren (Performance!)
|
||||
For Each node As TreeListNode In TreeListDevexpress.Nodes
|
||||
ExpandNodeToLevel(node, maxLevel:=2)
|
||||
Next
|
||||
TV_Collapse_ExpandState = "Collapse"
|
||||
End If
|
||||
Finally
|
||||
TreeListDevexpress.EndUpdate() ' ✅ EINE Redraw-Operation
|
||||
Cursor = Cursors.Default
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub CollapseNodeRecursive(node As TreeListNode)
|
||||
For Each child As TreeListNode In node.Nodes
|
||||
CollapseNodeRecursive(child)
|
||||
Next
|
||||
node.Expanded = False
|
||||
End Sub
|
||||
|
||||
Private Sub ExpandNodeToLevel(node As TreeListNode, maxLevel As Integer, Optional currentLevel As Integer = 0)
|
||||
If currentLevel >= maxLevel Then Return
|
||||
|
||||
node.Expanded = True
|
||||
For Each child As TreeListNode In node.Nodes
|
||||
ExpandNodeToLevel(child, maxLevel, currentLevel + 1)
|
||||
Next
|
||||
End Sub
|
||||
Private Sub bbtnitmRecSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmRecSave.ItemClick
|
||||
Save_Record()
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user