This commit is contained in:
Meik
2026-02-13 09:30:46 +01:00
parent 352dc42ae7
commit 86ce7e89e1
4 changed files with 238 additions and 127 deletions

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.Diagnostics; using System.Reflection;
using C4IT.FASD.Base; using C4IT.FASD.Base;
using C4IT.Logging;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.Models namespace FasdDesktopUi.Basics.Services.Models
{ {
@@ -13,6 +15,13 @@ namespace FasdDesktopUi.Basics.Services.Models
{ {
public int GetPollingMinutes(TileScope scope) public int GetPollingMinutes(TileScope scope)
{ {
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
int minutes = scope == TileScope.Role int minutes = scope == TileScope.Role
? cF4sdTicketConfig.DefaultOverviewPollingRole ? cF4sdTicketConfig.DefaultOverviewPollingRole
: cF4sdTicketConfig.DefaultOverviewPollingPersonal; : cF4sdTicketConfig.DefaultOverviewPollingPersonal;
@@ -29,7 +38,11 @@ namespace FasdDesktopUi.Basics.Services.Models
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine($"[TicketOverview] Settings fallback to defaults: {ex.Message}"); LogException(ex);
}
finally
{
LogMethodEnd(CM);
} }
if (minutes < 1) if (minutes < 1)

View File

@@ -1,12 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using C4IT.FASD.Base; using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication; using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using FasdDesktopUi.Basics.Models; using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.Models; using FasdDesktopUi.Basics.Services.Models;
#if isDemo #if isDemo
@@ -14,6 +16,7 @@ using System.Net;
using FasdCockpitCommunicationDemo; using FasdCockpitCommunicationDemo;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#endif #endif
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services namespace FasdDesktopUi.Basics.Services
{ {
@@ -303,6 +306,15 @@ namespace FasdDesktopUi.Basics.Services
} }
private async Task FetchScopeAsync(TileScope scope) private async Task FetchScopeAsync(TileScope scope)
{
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
try
{ {
if (!_isEnabled) if (!_isEnabled)
return; return;
@@ -314,8 +326,6 @@ namespace FasdDesktopUi.Basics.Services
return; return;
} }
try
{
_isDemo = communication.IsDemo(); _isDemo = communication.IsDemo();
var rawCounts = await communication.GetTicketOverviewCounts(OverviewKeys, scope == TileScope.Role).ConfigureAwait(false); var rawCounts = await communication.GetTicketOverviewCounts(OverviewKeys, scope == TileScope.Role).ConfigureAwait(false);
@@ -339,9 +349,13 @@ namespace FasdDesktopUi.Basics.Services
} }
catch (Exception ex) catch (Exception ex)
{ {
System.Diagnostics.Debug.WriteLine($"[TicketOverview] Fetch {scope} failed: {ex}"); LogException(ex);
ScheduleFetchRetry(scope); ScheduleFetchRetry(scope);
} }
finally
{
LogMethodEnd(CM);
}
} }
#endregion #endregion
@@ -789,6 +803,15 @@ namespace FasdDesktopUi.Basics.Services
#region Retry Handling #region Retry Handling
private void ScheduleFetchRetry(TileScope scope) private void ScheduleFetchRetry(TileScope scope)
{
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
try
{ {
if (!_isEnabled) if (!_isEnabled)
return; return;
@@ -822,10 +845,19 @@ namespace FasdDesktopUi.Basics.Services
} }
catch (Exception ex) catch (Exception ex)
{ {
System.Diagnostics.Debug.WriteLine($"[TicketOverview] Retry scheduling failed: {ex}"); LogException(ex);
} }
}); });
} }
catch (Exception ex)
{
LogException(ex);
}
finally
{
LogMethodEnd(CM);
}
}
#endregion #endregion
} }

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@@ -9,10 +9,12 @@ using System.Windows.Input;
using System.Windows.Threading; using System.Windows.Threading;
using C4IT.FASD.Cockpit.Communication; using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using FasdDesktopUi.Basics.Models; using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services; using FasdDesktopUi.Basics.Services;
using FasdDesktopUi.Basics.Services.Models; using FasdDesktopUi.Basics.Services.Models;
using FasdDesktopUi.Pages.SearchPage; using FasdDesktopUi.Pages.SearchPage;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UserControls namespace FasdDesktopUi.Basics.UserControls
{ {
public partial class TicketOverview : UserControl public partial class TicketOverview : UserControl
@@ -175,6 +177,15 @@ namespace FasdDesktopUi.Basics.UserControls
#region Methods #region Methods
private async void TicketOverview_Loaded(object sender, RoutedEventArgs e) private async void TicketOverview_Loaded(object sender, RoutedEventArgs e)
{
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
try
{ {
if (_isInitialized) if (_isInitialized)
return; return;
@@ -194,11 +205,20 @@ namespace FasdDesktopUi.Basics.UserControls
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine($"[TicketOverview] Refresh after toggle failed: {ex}"); LogException(ex);
} }
}; };
} }
} }
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
public void ResetSelection() public void ResetSelection()
{ {
@@ -218,7 +238,16 @@ namespace FasdDesktopUi.Basics.UserControls
private async Task RefreshCountsAsync(bool useRoleTickets) private async Task RefreshCountsAsync(bool useRoleTickets)
{ {
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
Dictionary<string, int> counts = null; Dictionary<string, int> counts = null;
try
{
var service = TicketOverviewUpdateService.Instance; var service = TicketOverviewUpdateService.Instance;
if (service != null) if (service != null)
@@ -231,7 +260,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine($"[TicketOverview] Service refresh failed: {ex}"); LogException(ex);
counts = null; counts = null;
} }
} }
@@ -252,8 +281,26 @@ namespace FasdDesktopUi.Basics.UserControls
UpdateHighlightState(useRoleTickets); UpdateHighlightState(useRoleTickets);
}, DispatcherPriority.Background); }, DispatcherPriority.Background);
} }
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
private async Task<Dictionary<string, int>> LoadCountsFallbackAsync(bool useRoleTickets) private async Task<Dictionary<string, int>> LoadCountsFallbackAsync(bool useRoleTickets)
{
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
try
{ {
var counts = CategorySetters.ToDictionary(item => item.Key, _ => 0); var counts = CategorySetters.ToDictionary(item => item.Key, _ => 0);
var communication = cFasdCockpitCommunicationBase.Instance; var communication = cFasdCockpitCommunicationBase.Instance;
@@ -273,13 +320,24 @@ namespace FasdDesktopUi.Basics.UserControls
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine($"[TicketOverview] Fallback load failed for '{kvp.Key}': {ex}"); LogException(ex);
counts[kvp.Key] = 0; counts[kvp.Key] = 0;
} }
} }
return counts; return counts;
} }
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
return CategorySetters.ToDictionary(item => item.Key, _ => 0);
}
public void UpdateCounts(IDictionary<string, int> counts, bool useRoleTickets) public void UpdateCounts(IDictionary<string, int> counts, bool useRoleTickets)
{ {

View File

@@ -1403,6 +1403,13 @@ namespace FasdDesktopUi.Pages.SearchPage
} }
private async void TicketOverview_SelectionRequested(object sender, TicketOverviewSelectionRequestedEventArgs e) private async void TicketOverview_SelectionRequested(object sender, TicketOverviewSelectionRequestedEventArgs e)
{ {
MethodBase CM = null;
if (cLogManager.DefaultLogger.IsDebug)
{
CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
}
try try
{ {
var app = Application.Current as FasdDesktopUi.App; var app = Application.Current as FasdDesktopUi.App;
@@ -1421,7 +1428,6 @@ namespace FasdDesktopUi.Pages.SearchPage
var relations = await LoadRelationsForTileAsync(e.Key, e.UseRoleScope, Math.Max(0, e.Count)); var relations = await LoadRelationsForTileAsync(e.Key, e.UseRoleScope, Math.Max(0, e.Count));
await PopulateTicketOverviewRelationUsersAsync(relations); await PopulateTicketOverviewRelationUsersAsync(relations);
Debug.WriteLine($"[TicketOverview] Relations loaded: {relations?.Count ?? 0}");
var firstRelation = relations.FirstOrDefault(); var firstRelation = relations.FirstOrDefault();
string displayText = header; string displayText = header;
if (firstRelation != null) if (firstRelation != null)
@@ -1486,8 +1492,10 @@ namespace FasdDesktopUi.Pages.SearchPage
LogException(ex); LogException(ex);
CancledSearchAction(); CancledSearchAction();
} }
System.Diagnostics.Debug.WriteLine( finally
$"[TicketOverview] Key={e.Key}, UseRoleScope={e.UseRoleScope}, Count={e.Count}"); {
LogMethodEnd(CM);
}
} }
private string BuildHeaderText(string key, bool useRoleScope, int? count = null) private string BuildHeaderText(string key, bool useRoleScope, int? count = null)
{ {