diff --git a/app/TaskFlow/frmMain.vb b/app/TaskFlow/frmMain.vb index 9e7d109..ea2f1bb 100644 --- a/app/TaskFlow/frmMain.vb +++ b/app/TaskFlow/frmMain.vb @@ -17,6 +17,7 @@ Imports DevExpress.XtraGrid.Views.Grid.ViewInfo Imports DevExpress.XtraNavBar Imports DevExpress.XtraPrinting Imports DevExpress.XtraSplashScreen +Imports DevExpress.XtraTreeList Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Base Imports DigitalData.Modules.EDMI.API.Constants @@ -4781,7 +4782,39 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G LOGGER.Error(ex) End Try End Sub + Private Async Sub TreeList_Cockpit_Click(sender As Object, e As EventArgs) Handles TreeList_Cockpit.Click + Try + Dim oFocusedNode As DevExpress.XtraTreeList.Nodes.TreeListNode = TreeList_Cockpit.FocusedNode + If oFocusedNode Is Nothing Then Exit Sub + Dim oTypeId As Object = oFocusedNode.GetValue("TYPE_ID") + If oTypeId Is Nothing OrElse IsDBNull(oTypeId) OrElse CInt(oTypeId) <> 2 Then + Exit Sub + End If + + ' ===== PRÜFEN OB MONITOR BEREITS GEÖFFNET IST ===== + Dim oMonitorId As Object = oFocusedNode.GetValue("FK_MONITOR_ID") + If oMonitorId Is Nothing OrElse IsDBNull(oMonitorId) Then + Exit Sub + End If + + Dim oMonitorIdInt As Integer = CInt(oMonitorId) + Dim existingMonitor = Application.OpenForms().OfType(Of frmMonitor)().FirstOrDefault(Function(f) f.MonitorID = oMonitorIdInt) + + If existingMonitor IsNot Nothing Then + ' ✅ Monitor ist offen → Nach vorne bringen + LOGGER.Debug($"TreeList_Cockpit_NodeCellClick: Monitor [{oMonitorIdInt}] already open - bringing to front") + existingMonitor.Activate() + existingMonitor.BringToFront() + Else + ' ✅ Monitor ist geschlossen → Neu öffnen via ProcessTreeListNodeAsync + LOGGER.Debug($"TreeList_Cockpit_NodeCellClick: Monitor [{oMonitorIdInt}] closed - reopening") + Await ProcessTreeListNodeAsync(oFocusedNode) + End If + Catch ex As Exception + LOGGER.Error(ex) + End Try + End Sub Private Sub BarButtonItemCock_refresh_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemCock_refresh.ItemClick Load_Treeview() End Sub