This commit is contained in:
Meik
2026-02-19 11:20:53 +01:00
parent b132755215
commit 610e479e69
20 changed files with 963 additions and 395 deletions

View File

@@ -6,8 +6,7 @@ using System.Windows;
using System.Windows.Documents;
using System.Linq;
using System.Windows.Input;
using System.Diagnostics;
using System.Windows.Threading;
using System.Diagnostics;
using C4IT.FASD.Base;
using C4IT.Logging;
@@ -103,19 +102,19 @@ namespace FasdDesktopUi.Basics
QuickActionProtocollHelper = new cQuickActionProtocollHelper(this);
}
public static async Task<cSupportCaseDataProvider> GetDataProviderForAsync(cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService)
{
try
{
if (selectedRelation == null)
{
Debug.Assert(true, "The selected relation must not be null here!");
LogEntry("The selected relation must not be null here!", LogLevels.Error);
return null;
}
// get the identities of the selected relation
var Identities = selectedRelation.Identities.Clone();
public static async Task<cSupportCaseDataProvider> GetDataProviderForAsync(cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService)
{
try
{
if (selectedRelation == null)
{
Debug.Assert(true, "The selected relation must not be null here!");
LogEntry("The selected relation must not be null here!", LogLevels.Error);
return null;
}
// get the identities of the selected relation
var Identities = selectedRelation.Identities.Clone();
// get the main indentities from all identites (normally this is the user, in a special case, where a computer was searched and found without any user activities, it could be the computer)
var MainIdentity = Identities.FirstOrDefault(identity => identity.Class == enumFasdInformationClass.User);
@@ -150,17 +149,15 @@ namespace FasdDesktopUi.Basics
cSupportCaseDataProvider.CurrentProvider = null;
}
if (!DataProviders.TryGetValue(MainIdentity.Id, out var _result))
{
_result = new cSupportCaseDataProvider();
DataProviders.Add(MainIdentity.Id, _result);
}
//await EnsureSupportCasePagesAsync();
_result.NamedParameterEntries = new cNamedParameterList(_result);
_result.StartCase(MainIdentity.Id);
if (!DataProviders.TryGetValue(MainIdentity.Id, out var _result))
{
_result = new cSupportCaseDataProvider();
DataProviders.Add(MainIdentity.Id, _result);
}
_result.NamedParameterEntries = new cNamedParameterList(_result);
_result.StartCase(MainIdentity.Id);
var supportCase = SupportCaseFactory.Get(MainIdentity, relationService, _result);
var supportCaseProcessor = SupportCaseProcessorFactory.Get(MainIdentity.Id);
@@ -169,14 +166,8 @@ namespace FasdDesktopUi.Basics
supportCaseProcessor.SetSupportCase(supportCase);
supportCaseController.SetSupportCaseProcessor(supportCaseProcessor, Identities);
if (cSupportCaseDataProvider.detailsPage == null || cSupportCaseDataProvider.slimPage == null)
{
LogEntry("Support case pages are not initialized; aborting case start.", LogLevels.Error);
return null;
}
cSupportCaseDataProvider.detailsPage.SetSupportCaseController(supportCaseController);
cSupportCaseDataProvider.slimPage.SetSupportCaseController(supportCaseController);
cSupportCaseDataProvider.detailsPage.SetSupportCaseController(supportCaseController);
cSupportCaseDataProvider.slimPage.SetSupportCaseController(supportCaseController);
var Status = await _result.SetViewDataAsync(requiredInformationClasses, Identities, true);
@@ -204,7 +195,7 @@ namespace FasdDesktopUi.Basics
{
cSupportCaseDataProvider.slimPage.Show();
cSupportCaseDataProvider.detailsPage?.Hide();
}
}
return _result;
}
@@ -239,11 +230,11 @@ namespace FasdDesktopUi.Basics
return selectedRelation;
}
public void StartCase(Guid userId)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
public void StartCase(Guid userId)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
lock (caseIdLockObject)
{
@@ -283,28 +274,11 @@ namespace FasdDesktopUi.Basics
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
private static async Task EnsureSupportCasePagesAsync()
{
if (detailsPage != null && slimPage != null)
return;
if (Application.Current == null)
return;
await Application.Current.Dispatcher.InvokeAsync(() =>
{
if (slimPage == null)
slimPage = new Pages.SlimPage.SlimPageView();
if (detailsPage == null)
detailsPage = new Pages.DetailsPage.DetailsPageView();
}, DispatcherPriority.Normal);
}
finally
{
LogMethodEnd(CM);
}
}
public async Task CloseCaseAsync()
{