aktueller Stand

This commit is contained in:
Meik
2026-01-28 12:08:39 +01:00
parent 1283750829
commit ee1f54675e
104 changed files with 6797 additions and 1867 deletions

View File

@@ -0,0 +1,16 @@
using FasdDesktopUi.Basics.Models;
using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.CustomEvents
{
public class HeadingDataEventArgs : EventArgs
{
public IEnumerable<cHeadingDataModel> NewValue { get; }
public HeadingDataEventArgs(IEnumerable<cHeadingDataModel> headingData) : base()
{
NewValue = headingData;
}
}
}

View File

@@ -1,11 +1,8 @@
using C4IT.FASD.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FasdDesktopUi.Basics.Services.RelationService
namespace FasdDesktopUi.Basics.CustomEvents
{
public class RelationEventArgs : EventArgs
{

View File

@@ -0,0 +1,12 @@
using C4IT.FASD.Base;
using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.CustomEvents
{
public class SupportCaseDataEventArgs : EventArgs
{
public cF4sdApiSearchResultRelation Relation { get; set; }
public IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> DataTables { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -125,7 +125,7 @@ namespace FasdDesktopUi.Basics.Helper
private bool HasRequiredInformationClasses(List<enumFasdInformationClass> required)
{
return !(required.Any(informationClass => _dataProvider.Identities.Any(identity => identity.Class == informationClass) == false));
return !(required.Any(informationClass => _dataProvider?.Identities?.Any(identity => identity.Class == informationClass) == false));
}

View File

@@ -280,7 +280,10 @@ namespace FasdDesktopUi.Basics.Models
}
if (App.M42OptionMenuItem != null)
App.M42OptionMenuItem.Enabled = userInfo != null;
App.Current.MainWindow.Dispatcher.Invoke(() =>
{
App.M42OptionMenuItem.Enabled = userInfo != null;
});
// check, if the are logons needed
bool m42Valid = await CheckAndRefreshM42LogonAsync();

View File

@@ -9,6 +9,7 @@ namespace FasdDesktopUi.Basics.Models
public enumFasdInformationClass InformationClass { get; set; }
public bool IsOnline { get; set; }
public cF4sdIdentityList Identities { get; set; }
public cF4sdApiSearchResultRelation Realtion { get; set; }
}
public class cSwapCaseInfo

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Windows;
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using FasdCockpitBase;
@@ -49,6 +50,7 @@ namespace FasdDesktopUi.Basics.Models
try
{
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
var outputTable = dataProvider.HealthCardDataHelper.HealthCardRawData.GetTableByName(valueAdress.ValueTable, true);
if (outputTable != null)

View File

@@ -69,79 +69,79 @@ namespace FasdDesktopUi.Basics.Models
set { if (_unassignedTicketsSelected != value) { _unassignedTicketsSelected = value; OnPropertyChanged(nameof(UnassignedTicketsSelected)); } }
}
private bool _unassignedTicketsCriticalSelected;
public bool UnassignedTicketsCriticalSelected
{
get => _unassignedTicketsCriticalSelected;
set { if (_unassignedTicketsCriticalSelected != value) { _unassignedTicketsCriticalSelected = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalSelected)); } }
}
#endregion
#region Highlight-Properties
private bool _ticketsNewHighlighted;
public bool TicketsNewHighlighted { get => _ticketsNewHighlighted; set { if (_ticketsNewHighlighted != value) { _ticketsNewHighlighted = value; OnPropertyChanged(nameof(TicketsNewHighlighted)); } } }
private bool _ticketsActiveHighlighted;
public bool TicketsActiveHighlighted { get => _ticketsActiveHighlighted; set { if (_ticketsActiveHighlighted != value) { _ticketsActiveHighlighted = value; OnPropertyChanged(nameof(TicketsActiveHighlighted)); } } }
private bool _ticketsCriticalHighlighted;
public bool TicketsCriticalHighlighted { get => _ticketsCriticalHighlighted; set { if (_ticketsCriticalHighlighted != value) { _ticketsCriticalHighlighted = value; OnPropertyChanged(nameof(TicketsCriticalHighlighted)); } } }
private bool _ticketsNewInfoHighlighted;
public bool TicketsNewInfoHighlighted { get => _ticketsNewInfoHighlighted; set { if (_ticketsNewInfoHighlighted != value) { _ticketsNewInfoHighlighted = value; OnPropertyChanged(nameof(TicketsNewInfoHighlighted)); } } }
private bool _incidentNewHighlighted;
public bool IncidentNewHighlighted { get => _incidentNewHighlighted; set { if (_incidentNewHighlighted != value) { _incidentNewHighlighted = value; OnPropertyChanged(nameof(IncidentNewHighlighted)); } } }
private bool _incidentActiveHighlighted;
public bool IncidentActiveHighlighted { get => _incidentActiveHighlighted; set { if (_incidentActiveHighlighted != value) { _incidentActiveHighlighted = value; OnPropertyChanged(nameof(IncidentActiveHighlighted)); } } }
private bool _incidentCriticalHighlighted;
public bool IncidentCriticalHighlighted { get => _incidentCriticalHighlighted; set { if (_incidentCriticalHighlighted != value) { _incidentCriticalHighlighted = value; OnPropertyChanged(nameof(IncidentCriticalHighlighted)); } } }
private bool _incidentNewInfoHighlighted;
public bool IncidentNewInfoHighlighted { get => _incidentNewInfoHighlighted; set { if (_incidentNewInfoHighlighted != value) { _incidentNewInfoHighlighted = value; OnPropertyChanged(nameof(IncidentNewInfoHighlighted)); } } }
private bool _unassignedTicketsHighlighted;
public bool UnassignedTicketsHighlighted { get => _unassignedTicketsHighlighted; set { if (_unassignedTicketsHighlighted != value) { _unassignedTicketsHighlighted = value; OnPropertyChanged(nameof(UnassignedTicketsHighlighted)); } } }
private bool _unassignedTicketsCriticalHighlighted;
public bool UnassignedTicketsCriticalHighlighted { get => _unassignedTicketsCriticalHighlighted; set { if (_unassignedTicketsCriticalHighlighted != value) { _unassignedTicketsCriticalHighlighted = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalHighlighted)); } } }
#endregion
#region Change Hint Properties
private string _ticketsNewChangeHint;
public string TicketsNewChangeHint { get => _ticketsNewChangeHint; set { if (_ticketsNewChangeHint != value) { _ticketsNewChangeHint = value; OnPropertyChanged(nameof(TicketsNewChangeHint)); } } }
private string _ticketsActiveChangeHint;
public string TicketsActiveChangeHint { get => _ticketsActiveChangeHint; set { if (_ticketsActiveChangeHint != value) { _ticketsActiveChangeHint = value; OnPropertyChanged(nameof(TicketsActiveChangeHint)); } } }
private string _ticketsCriticalChangeHint;
public string TicketsCriticalChangeHint { get => _ticketsCriticalChangeHint; set { if (_ticketsCriticalChangeHint != value) { _ticketsCriticalChangeHint = value; OnPropertyChanged(nameof(TicketsCriticalChangeHint)); } } }
private string _ticketsNewInfoChangeHint;
public string TicketsNewInfoChangeHint { get => _ticketsNewInfoChangeHint; set { if (_ticketsNewInfoChangeHint != value) { _ticketsNewInfoChangeHint = value; OnPropertyChanged(nameof(TicketsNewInfoChangeHint)); } } }
private string _incidentNewChangeHint;
public string IncidentNewChangeHint { get => _incidentNewChangeHint; set { if (_incidentNewChangeHint != value) { _incidentNewChangeHint = value; OnPropertyChanged(nameof(IncidentNewChangeHint)); } } }
private string _incidentActiveChangeHint;
public string IncidentActiveChangeHint { get => _incidentActiveChangeHint; set { if (_incidentActiveChangeHint != value) { _incidentActiveChangeHint = value; OnPropertyChanged(nameof(IncidentActiveChangeHint)); } } }
private string _incidentCriticalChangeHint;
public string IncidentCriticalChangeHint { get => _incidentCriticalChangeHint; set { if (_incidentCriticalChangeHint != value) { _incidentCriticalChangeHint = value; OnPropertyChanged(nameof(IncidentCriticalChangeHint)); } } }
private string _incidentNewInfoChangeHint;
public string IncidentNewInfoChangeHint { get => _incidentNewInfoChangeHint; set { if (_incidentNewInfoChangeHint != value) { _incidentNewInfoChangeHint = value; OnPropertyChanged(nameof(IncidentNewInfoChangeHint)); } } }
private string _unassignedTicketsChangeHint;
public string UnassignedTicketsChangeHint { get => _unassignedTicketsChangeHint; set { if (_unassignedTicketsChangeHint != value) { _unassignedTicketsChangeHint = value; OnPropertyChanged(nameof(UnassignedTicketsChangeHint)); } } }
private string _unassignedTicketsCriticalChangeHint;
public string UnassignedTicketsCriticalChangeHint { get => _unassignedTicketsCriticalChangeHint; set { if (_unassignedTicketsCriticalChangeHint != value) { _unassignedTicketsCriticalChangeHint = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalChangeHint)); } } }
#endregion
#region Ticket & Incident-Properties
private bool _unassignedTicketsCriticalSelected;
public bool UnassignedTicketsCriticalSelected
{
get => _unassignedTicketsCriticalSelected;
set { if (_unassignedTicketsCriticalSelected != value) { _unassignedTicketsCriticalSelected = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalSelected)); } }
}
#endregion
#region Highlight-Properties
private bool _ticketsNewHighlighted;
public bool TicketsNewHighlighted { get => _ticketsNewHighlighted; set { if (_ticketsNewHighlighted != value) { _ticketsNewHighlighted = value; OnPropertyChanged(nameof(TicketsNewHighlighted)); } } }
private bool _ticketsActiveHighlighted;
public bool TicketsActiveHighlighted { get => _ticketsActiveHighlighted; set { if (_ticketsActiveHighlighted != value) { _ticketsActiveHighlighted = value; OnPropertyChanged(nameof(TicketsActiveHighlighted)); } } }
private bool _ticketsCriticalHighlighted;
public bool TicketsCriticalHighlighted { get => _ticketsCriticalHighlighted; set { if (_ticketsCriticalHighlighted != value) { _ticketsCriticalHighlighted = value; OnPropertyChanged(nameof(TicketsCriticalHighlighted)); } } }
private bool _ticketsNewInfoHighlighted;
public bool TicketsNewInfoHighlighted { get => _ticketsNewInfoHighlighted; set { if (_ticketsNewInfoHighlighted != value) { _ticketsNewInfoHighlighted = value; OnPropertyChanged(nameof(TicketsNewInfoHighlighted)); } } }
private bool _incidentNewHighlighted;
public bool IncidentNewHighlighted { get => _incidentNewHighlighted; set { if (_incidentNewHighlighted != value) { _incidentNewHighlighted = value; OnPropertyChanged(nameof(IncidentNewHighlighted)); } } }
private bool _incidentActiveHighlighted;
public bool IncidentActiveHighlighted { get => _incidentActiveHighlighted; set { if (_incidentActiveHighlighted != value) { _incidentActiveHighlighted = value; OnPropertyChanged(nameof(IncidentActiveHighlighted)); } } }
private bool _incidentCriticalHighlighted;
public bool IncidentCriticalHighlighted { get => _incidentCriticalHighlighted; set { if (_incidentCriticalHighlighted != value) { _incidentCriticalHighlighted = value; OnPropertyChanged(nameof(IncidentCriticalHighlighted)); } } }
private bool _incidentNewInfoHighlighted;
public bool IncidentNewInfoHighlighted { get => _incidentNewInfoHighlighted; set { if (_incidentNewInfoHighlighted != value) { _incidentNewInfoHighlighted = value; OnPropertyChanged(nameof(IncidentNewInfoHighlighted)); } } }
private bool _unassignedTicketsHighlighted;
public bool UnassignedTicketsHighlighted { get => _unassignedTicketsHighlighted; set { if (_unassignedTicketsHighlighted != value) { _unassignedTicketsHighlighted = value; OnPropertyChanged(nameof(UnassignedTicketsHighlighted)); } } }
private bool _unassignedTicketsCriticalHighlighted;
public bool UnassignedTicketsCriticalHighlighted { get => _unassignedTicketsCriticalHighlighted; set { if (_unassignedTicketsCriticalHighlighted != value) { _unassignedTicketsCriticalHighlighted = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalHighlighted)); } } }
#endregion
#region Change Hint Properties
private string _ticketsNewChangeHint;
public string TicketsNewChangeHint { get => _ticketsNewChangeHint; set { if (_ticketsNewChangeHint != value) { _ticketsNewChangeHint = value; OnPropertyChanged(nameof(TicketsNewChangeHint)); } } }
private string _ticketsActiveChangeHint;
public string TicketsActiveChangeHint { get => _ticketsActiveChangeHint; set { if (_ticketsActiveChangeHint != value) { _ticketsActiveChangeHint = value; OnPropertyChanged(nameof(TicketsActiveChangeHint)); } } }
private string _ticketsCriticalChangeHint;
public string TicketsCriticalChangeHint { get => _ticketsCriticalChangeHint; set { if (_ticketsCriticalChangeHint != value) { _ticketsCriticalChangeHint = value; OnPropertyChanged(nameof(TicketsCriticalChangeHint)); } } }
private string _ticketsNewInfoChangeHint;
public string TicketsNewInfoChangeHint { get => _ticketsNewInfoChangeHint; set { if (_ticketsNewInfoChangeHint != value) { _ticketsNewInfoChangeHint = value; OnPropertyChanged(nameof(TicketsNewInfoChangeHint)); } } }
private string _incidentNewChangeHint;
public string IncidentNewChangeHint { get => _incidentNewChangeHint; set { if (_incidentNewChangeHint != value) { _incidentNewChangeHint = value; OnPropertyChanged(nameof(IncidentNewChangeHint)); } } }
private string _incidentActiveChangeHint;
public string IncidentActiveChangeHint { get => _incidentActiveChangeHint; set { if (_incidentActiveChangeHint != value) { _incidentActiveChangeHint = value; OnPropertyChanged(nameof(IncidentActiveChangeHint)); } } }
private string _incidentCriticalChangeHint;
public string IncidentCriticalChangeHint { get => _incidentCriticalChangeHint; set { if (_incidentCriticalChangeHint != value) { _incidentCriticalChangeHint = value; OnPropertyChanged(nameof(IncidentCriticalChangeHint)); } } }
private string _incidentNewInfoChangeHint;
public string IncidentNewInfoChangeHint { get => _incidentNewInfoChangeHint; set { if (_incidentNewInfoChangeHint != value) { _incidentNewInfoChangeHint = value; OnPropertyChanged(nameof(IncidentNewInfoChangeHint)); } } }
private string _unassignedTicketsChangeHint;
public string UnassignedTicketsChangeHint { get => _unassignedTicketsChangeHint; set { if (_unassignedTicketsChangeHint != value) { _unassignedTicketsChangeHint = value; OnPropertyChanged(nameof(UnassignedTicketsChangeHint)); } } }
private string _unassignedTicketsCriticalChangeHint;
public string UnassignedTicketsCriticalChangeHint { get => _unassignedTicketsCriticalChangeHint; set { if (_unassignedTicketsCriticalChangeHint != value) { _unassignedTicketsCriticalChangeHint = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalChangeHint)); } } }
#endregion
#region Ticket & Incident-Properties
// Ticket Properties
private int _ticketsNew;
@@ -184,11 +184,11 @@ namespace FasdDesktopUi.Basics.Models
#region Helper-Methods
public void ResetSelection()
{
TicketsNewSelected = false;
TicketsActiveSelected = false;
TicketsCriticalSelected = false;
public void ResetSelection()
{
TicketsNewSelected = false;
TicketsActiveSelected = false;
TicketsCriticalSelected = false;
TicketsNewInfoSelected = false;
IncidentNewSelected = false;
@@ -196,38 +196,44 @@ namespace FasdDesktopUi.Basics.Models
IncidentCriticalSelected = false;
IncidentNewInfoSelected = false;
UnassignedTicketsSelected = false;
UnassignedTicketsCriticalSelected = false;
}
public void ResetHighlights()
{
TicketsNewHighlighted = false;
TicketsActiveHighlighted = false;
TicketsCriticalHighlighted = false;
TicketsNewInfoHighlighted = false;
IncidentNewHighlighted = false;
IncidentActiveHighlighted = false;
IncidentCriticalHighlighted = false;
IncidentNewInfoHighlighted = false;
UnassignedTicketsHighlighted = false;
UnassignedTicketsCriticalHighlighted = false;
TicketsNewChangeHint = null;
TicketsActiveChangeHint = null;
TicketsCriticalChangeHint = null;
TicketsNewInfoChangeHint = null;
IncidentNewChangeHint = null;
IncidentActiveChangeHint = null;
IncidentCriticalChangeHint = null;
IncidentNewInfoChangeHint = null;
UnassignedTicketsChangeHint = null;
UnassignedTicketsCriticalChangeHint = null;
}
#endregion
}
}
UnassignedTicketsSelected = false;
UnassignedTicketsCriticalSelected = false;
}
public void ResetHighlights()
{
TicketsNewHighlighted = false;
TicketsActiveHighlighted = false;
TicketsCriticalHighlighted = false;
TicketsNewInfoHighlighted = false;
IncidentNewHighlighted = false;
IncidentActiveHighlighted = false;
IncidentCriticalHighlighted = false;
IncidentNewInfoHighlighted = false;
UnassignedTicketsHighlighted = false;
UnassignedTicketsCriticalHighlighted = false;
TicketsNewChangeHint = null;
TicketsActiveChangeHint = null;
TicketsCriticalChangeHint = null;
TicketsNewInfoChangeHint = null;
IncidentNewChangeHint = null;
IncidentActiveChangeHint = null;
IncidentCriticalChangeHint = null;
IncidentNewInfoChangeHint = null;
UnassignedTicketsChangeHint = null;
UnassignedTicketsCriticalChangeHint = null;
}
#endregion
public TicketOverviewModel()
{
}
}
}

View File

@@ -242,7 +242,7 @@ namespace FasdDesktopUi.Basics
if (addRelation)
foreach (var _caseRelation in CaseRelations)
{
if (_caseRelation.isEqual(CaseRelation))
if (_caseRelation.Equals(CaseRelation))
{
addRelation = false;
break;

View File

@@ -5,15 +5,18 @@ namespace FasdDesktopUi.Basics.Services.Models
{
public sealed class TicketOverviewCountsChangedEventArgs : EventArgs
{
public TicketOverviewCountsChangedEventArgs(IReadOnlyList<TileCountChange> changes, IReadOnlyDictionary<string, TileCounts> currentCounts)
public TicketOverviewCountsChangedEventArgs(IReadOnlyList<TileCountChange> changes, IReadOnlyDictionary<string, TileCounts> currentCounts, TileScope? initializedScope = null)
{
Changes = changes;
Changes = changes ?? Array.Empty<TileCountChange>();
CurrentCounts = currentCounts;
InitializedScope = initializedScope;
}
public IReadOnlyList<TileCountChange> Changes { get; }
public IReadOnlyDictionary<string, TileCounts> CurrentCounts { get; }
public TileScope? InitializedScope { get; }
}
public readonly struct TileCountChange

View File

@@ -1,4 +1,5 @@
using System;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
@@ -8,14 +9,14 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class F4SDProtocoll
{
private readonly ICollection<IProtocollEntry> _protocollEntries = new List<IProtocollEntry>();
private readonly ICollection<ProtocollEntryBase> _protocollEntries = new List<ProtocollEntryBase>();
public static F4SDProtocoll Instance { get; private set; } = new F4SDProtocoll();
private F4SDProtocoll() { }
internal void Add(IProtocollEntry entry) => _protocollEntries.Add(entry);
internal void Add(IEnumerable<IProtocollEntry> entries)
internal void Add(ProtocollEntryBase entry) => _protocollEntries.Add(entry);
internal void Add(IEnumerable<ProtocollEntryBase> entries)
{
foreach (var entry in entries)
{
@@ -25,34 +26,34 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
internal void Clear() => _protocollEntries.Clear();
internal T GetLatestOfType<T>() where T : IProtocollEntry => _protocollEntries.OfType<T>().LastOrDefault();
internal T GetLatestOfType<T>() where T : ProtocollEntryBase => _protocollEntries.OfType<T>().LastOrDefault();
internal IEnumerable<T> GetOfType<T>(int? count = null) where T : IProtocollEntry
internal IEnumerable<T> GetOfType<T>(int? count = null) where T : ProtocollEntryBase
{
if(count.HasValue)
return _protocollEntries.OfType<T>().Reverse().Take(count.Value).Reverse();
return _protocollEntries.OfType<T>();
}
internal IEnumerable<IProtocollEntry> GetAll() => _protocollEntries;
internal IEnumerable<ProtocollEntryBase> GetAll() => _protocollEntries;
internal DataObject GetLatestOfTypeAsDataObject<T>(bool skipHtmlFrame) where T : IProtocollEntry
internal DataObject GetLatestOfTypeAsDataObject<T>(bool skipHtmlFrame) where T : ProtocollEntryBase
{
IProtocollEntry entry = _protocollEntries.OfType<T>().LastOrDefault();
ProtocollEntryBase entry = _protocollEntries.OfType<T>().LastOrDefault();
if (entry is null)
return new DataObject();
return GetDataObjectOf(new IProtocollEntry[] { entry }, skipHtmlFrame);
return GetDataObjectOf(new ProtocollEntryBase[] { entry }, skipHtmlFrame);
}
internal DataObject GetOfTypeAsDataObject<T>(bool skipHtmlFrame, int? count = null) where T : IProtocollEntry
=> GetDataObjectOf(GetOfType<T>(count).Cast<IProtocollEntry>(), skipHtmlFrame);
internal DataObject GetOfTypeAsDataObject<T>(bool skipHtmlFrame, int? count = null) where T : ProtocollEntryBase
=> GetDataObjectOf(GetOfType<T>(count).Cast<ProtocollEntryBase>(), skipHtmlFrame);
internal DataObject GetAllAsDataObject(bool skipHtmlFrame)
=> GetDataObjectOf(_protocollEntries, skipHtmlFrame);
private DataObject GetDataObjectOf(IEnumerable<IProtocollEntry> entries, bool skipHtmlFrame, int? count = null)
private DataObject GetDataObjectOf(IEnumerable<ProtocollEntryBase> entries, bool skipHtmlFrame, int? count = null)
{
DataObject dataObject = new DataObject();
@@ -67,16 +68,16 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
if (count.HasValue)
entries = entries.Reverse().Take(count.Value).Reverse();
foreach (IProtocollEntry entry in entries)
foreach (ProtocollEntryBase entry in entries)
{
string entryAscii = entry.GetAscii();
string entryAscii = entry.AsciiContent;
if (!string.IsNullOrEmpty(entryAscii))
{
ascii += entryAscii;
ascii += asciiSeparator;
}
string entryHtml = entry.GetHtml();
string entryHtml = entry.HtmlContent;
if (!string.IsNullOrEmpty(entryHtml))
{
html += entryHtml;

View File

@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal interface IProtocollEntry
{
string GetAscii();
string GetHtml();
}
}

View File

@@ -1,4 +1,4 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics.Models;
@@ -11,17 +11,26 @@ using static FasdDesktopUi.Basics.UserControls.QuickActionStatusMonitor;
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class QuickActionProtocollEntry : IProtocollEntry
internal static class QuickActionProtocollEntryOutput
{
private readonly cFasdQuickAction _quickActionDefinition;
private readonly cQuickActionCopyData _quickActionCopyData;
const string AsciiSeperator = "\n\n";
public QuickActionProtocollEntry(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData)
public static QuickActionProtocollEntry GetQuickActionProtocollEntry(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData)
{
_quickActionDefinition = quickActionDefinition;
_quickActionCopyData = quickActionCopyData;
string ascii = GetAscii(quickActionDefinition, quickActionCopyData);
string html = GetHtml(quickActionDefinition, quickActionCopyData);
return new QuickActionProtocollEntry(ascii, html)
{
Id = quickActionDefinition.Id,
Name = quickActionDefinition.Name,
ExecutionTypeId = (int)quickActionDefinition.ExecutionType,
WasRunningOnAffectedDevice = quickActionCopyData.WasRunningOnAffectedDevice,
AffectedDeviceName = quickActionCopyData.AffectedDeviceName,
ResultCode = (int?)quickActionCopyData.QuickActionOutput?.ResultCode,
ErrorMessage = quickActionCopyData.QuickActionOutput?.ErrorDescription,
MeasureValues = GetQuickActionHtmlValueComparison(quickActionCopyData.MeasureValues)
};
}
internal static cQuickActionCopyData GetCopyData(cFasdQuickAction quickActionDefinition, cSupportCaseDataProvider dataProvider, bool wasRunningOnAffectedDevice, cQuickActionOutput quickActionOutput, List<cQuickActionMeasureValue> measureValues)
@@ -51,38 +60,21 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return quickActionCopyData;
}
internal cQuickActionResult GetResult()
{
return new cQuickActionResult()
{
QuickActionId = _quickActionDefinition.Id,
QuickActionName = _quickActionDefinition.Name,
QuickActionExecutionType = (int)_quickActionDefinition.ExecutionType,
wasRunningOnAffectedDevice = _quickActionCopyData.WasRunningOnAffectedDevice,
AffectedDeviceName = _quickActionCopyData.AffectedDeviceName,
ExecutionTime = DateTime.UtcNow,
ResultCode = (int?)(_quickActionCopyData.QuickActionOutput?.ResultCode),
ErrorMessage = _quickActionCopyData.QuickActionOutput?.ErrorDescription,
Output = GetQuickActionHtmlOutput(_quickActionCopyData.QuickActionOutput),
MeasureValues = GetQuickActionHtmlValueComparison(_quickActionCopyData.MeasureValues)
};
}
private static string GetAscii(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData) => GetQuickActionAscii(quickActionDefinition, quickActionCopyData);
public string GetAscii() => GetQuickActionAscii(_quickActionCopyData);
private static string GetHtml(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData) => GetQuickActionHtml(quickActionDefinition, quickActionCopyData);
public string GetHtml() => GetQuickActionHtml(_quickActionCopyData);
private bool ShouldHideQuickActionOutput(string outputValueKey)
private static bool ShouldHideQuickActionOutput(cFasdQuickAction quickActionDefinition, string outputValueKey)
{
try
{
if (_quickActionDefinition.ColumnOutputFormattings is null)
if (quickActionDefinition.ColumnOutputFormattings is null)
return false;
if (!_quickActionDefinition.ShowAllOutputContent && !_quickActionDefinition.ColumnOutputFormattings.ContainsKey(outputValueKey))
if (!quickActionDefinition.ShowAllOutputContent && !quickActionDefinition.ColumnOutputFormattings.ContainsKey(outputValueKey))
return true;
if (_quickActionDefinition.ColumnOutputFormattings.TryGetValue(outputValueKey, out var columnFormatting))
if (quickActionDefinition.ColumnOutputFormattings.TryGetValue(outputValueKey, out var columnFormatting))
return columnFormatting.Hidden;
}
catch (Exception ex)
@@ -95,19 +87,19 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
#region Ascii
private string GetQuickActionAscii(cQuickActionCopyData copyData)
private static string GetQuickActionAscii(cFasdQuickAction quickActionDefinition, cQuickActionCopyData copyData)
{
string ascii = string.Empty;
ascii += GetQuickActionAsciiDescription(copyData.Name, copyData.AffectedDeviceName, copyData.WasRunningOnAffectedDevice, copyData.ExecutionTime, copyData.QuickActionOutput?.ResultCode);
ascii += GetQuickActionAsciiError(copyData.QuickActionOutput?.ErrorDescription);
ascii += GetQuickActionAsciiOutput(copyData.QuickActionOutput);
ascii += GetQuickActionAsciiOutput(quickActionDefinition, copyData.QuickActionOutput);
ascii += GetQuickActionAsciiValueComparisonString(copyData.MeasureValues);
return ascii;
}
private string GetQuickActionAsciiDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
private static string GetQuickActionAsciiDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
{
string asciiDescription = string.Empty;
try
@@ -136,7 +128,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return asciiDescription;
}
private string GetQuickActionAsciiError(string errorMessage)
private static string GetQuickActionAsciiError(string errorMessage)
{
if (!string.IsNullOrEmpty(errorMessage))
errorMessage.Insert(0, AsciiSeperator);
@@ -144,7 +136,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return errorMessage;
}
private string GetQuickActionAsciiOutput(QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
private static string GetQuickActionAsciiOutput(cFasdQuickAction quickActionDefinition, QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
{
string output = string.Empty;
@@ -162,7 +154,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += AsciiSeperator;
output += cMultiLanguageSupport.GetItem("QuickAction.Copy.Output") + " ";
output += singleOutput.GetDisplayValue(_quickActionDefinition.ColumnOutputFormattings);
output += singleOutput.GetDisplayValue(quickActionDefinition.ColumnOutputFormattings);
break;
}
@@ -174,10 +166,10 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
foreach (var value in listOutput.Values[0])
{
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
output += outputFormatting.Names.GetValue();
else
output += value.Key;
@@ -193,10 +185,10 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
string valueKey = listOutput.Values[0][j].Key;
if (ShouldHideQuickActionOutput(valueKey))
if (ShouldHideQuickActionOutput(quickActionDefinition, valueKey))
continue;
string displayValue = listOutput.GetDisplayValue(i, j, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = listOutput.GetDisplayValue(i, j, quickActionDefinition.ColumnOutputFormattings);
if (string.IsNullOrWhiteSpace(displayValue))
continue;
@@ -217,12 +209,12 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
var value = objectOutput.Values[i];
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
string columnTitle = string.Empty;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
columnTitle = outputFormatting.Names.GetValue();
else
columnTitle = value.Key;
@@ -230,7 +222,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
if (!string.IsNullOrEmpty(columnTitle))
output += $"{columnTitle}: ";
string displayValue = objectOutput.GetDisplayValue(i, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = objectOutput.GetDisplayValue(i, quickActionDefinition.ColumnOutputFormattings);
output += !string.IsNullOrWhiteSpace(displayValue) ? displayValue : null;
output += "\n";
@@ -248,7 +240,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return output;
}
private string GetQuickActionAsciiValueComparisonString(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
private static string GetQuickActionAsciiValueComparisonString(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
{
string output = string.Empty;
@@ -260,6 +252,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += AsciiSeperator + cMultiLanguageSupport.GetItem("QuickAction.Copy.Measure");
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
foreach (var measureValue in measureValues)
{
@@ -292,7 +285,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
#region Html
private string GetQuickActionHtml(cQuickActionCopyData copyData)
private static string GetQuickActionHtml(cFasdQuickAction quickActionDefinition, cQuickActionCopyData copyData)
{
string output = string.Empty;
@@ -300,7 +293,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
output += GetQuickActionHtmlDescription(copyData.Name, copyData.AffectedDeviceName, copyData.WasRunningOnAffectedDevice, copyData.ExecutionTime, copyData.QuickActionOutput?.ResultCode);
output += GetQuickActionHtmlError(copyData.QuickActionOutput?.ErrorDescription);
output += GetQuickActionHtmlOutput(copyData.QuickActionOutput);
output += GetQuickActionHtmlOutput(quickActionDefinition, copyData.QuickActionOutput);
output += GetQuickActionHtmlValueComparison(copyData.MeasureValues);
}
catch (Exception E)
@@ -311,7 +304,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return output;
}
private string GetQuickActionHtmlDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
private static string GetQuickActionHtmlDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
{
string output = string.Empty;
try
@@ -348,7 +341,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return errorMessage;
}
private string GetQuickActionHtmlOutput(QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
private static string GetQuickActionHtmlOutput(cFasdQuickAction quickActionDefinition, QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
{
string output = string.Empty;
@@ -366,7 +359,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
if (singleOutput.Value is null)
return output;
var displayValue = singleOutput.GetDisplayValue(_quickActionDefinition?.ColumnOutputFormattings);
var displayValue = singleOutput.GetDisplayValue(quickActionDefinition?.ColumnOutputFormattings);
output += "<p>" + cMultiLanguageSupport.GetItem("QuickAction.Copy.Output.Html") + " " + displayValue + "</p>";
break;
}
@@ -379,11 +372,11 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
foreach (var value in listOutput.Values[0])
{
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
string headingValue = value.Key;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
headingValue = outputFormatting.Names.GetValue();
output += "<th align=\"left\">";
@@ -400,10 +393,10 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
for (int j = 0; j < listOutput.Values[i].Count; j++)
{
string valueKey = listOutput.Values[0][j].Key;
if (ShouldHideQuickActionOutput(valueKey))
if (ShouldHideQuickActionOutput(quickActionDefinition, valueKey))
continue;
string displayValue = listOutput.GetDisplayValue(i, j, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = listOutput.GetDisplayValue(i, j, quickActionDefinition.ColumnOutputFormattings);
if (string.IsNullOrWhiteSpace(displayValue))
continue;
@@ -429,11 +422,11 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
var value = objectOutput.Values[i];
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
string headingValue = value.Key;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
headingValue = outputFormatting.Names.GetValue();
output += "<tr>";
@@ -442,7 +435,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += "</td>";
output += "<td>";
string displayValue = objectOutput.GetDisplayValue(i, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = objectOutput.GetDisplayValue(i, quickActionDefinition.ColumnOutputFormattings);
output += !string.IsNullOrWhiteSpace(displayValue) ? displayValue : null;
output += "</td>";
@@ -462,7 +455,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return output;
}
private string GetQuickActionHtmlValueComparison(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
private static string GetQuickActionHtmlValueComparison(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
{
string output = string.Empty;
@@ -474,6 +467,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += "<p>" + cMultiLanguageSupport.GetItem("QuickAction.Copy.Measure.Html") + "</p>";
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
foreach (var measureValue in measureValues)
{

View File

@@ -1,27 +1,30 @@
using C4IT.FASD.Base;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class QuickTipStepProtocollEntry : IProtocollEntry
internal static class QuickTipStepProtocollEntryOutput
{
private readonly cQuickTipElement _quickTipElementDefinition;
private readonly bool _wasSuccessfull;
public QuickTipStepProtocollEntry(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
public static QuickTipStepProtocollEntry GetQuickTipStepProtocollEntry(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
{
_quickTipElementDefinition = quickTipElementDefinition;
_wasSuccessfull = wasSuccessfull;
string ascii = GetAsciiOutput(quickTipElementDefinition, wasSuccessfull);
string html = GetHtmlOutput(quickTipElementDefinition, wasSuccessfull);
return new QuickTipStepProtocollEntry(ascii, html)
{
Name = quickTipElementDefinition.Name,
WasSuccessfull = wasSuccessfull
};
}
public string GetAscii()
private static string GetAsciiOutput(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
{
string currentLanguage = cMultiLanguageSupport.CurrentLanguage;
try
{
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage ?? currentLanguage;
string ascii = _wasSuccessfull ? cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Successfull") : cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Unsuccessfull");
return string.Format(ascii, _quickTipElementDefinition?.Names?.GetValue());
string ascii = wasSuccessfull ? cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Successfull") : cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Unsuccessfull");
return string.Format(ascii, quickTipElementDefinition?.Names?.GetValue());
}
finally
{
@@ -29,7 +32,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
}
}
public string GetHtml()
=> GetAscii();
private static string GetHtmlOutput(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
=> GetAsciiOutput(quickTipElementDefinition, wasSuccessfull);
}
}

View File

@@ -1,18 +0,0 @@
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class TextualProtocollEntry : IProtocollEntry
{
private readonly string _asciiText;
private readonly string _htmlText;
public TextualProtocollEntry(string asciiText, string htmlText)
{
_asciiText = asciiText;
_htmlText = htmlText;
}
public string GetAscii() => _asciiText;
public string GetHtml() => _htmlText;
}
}

View File

@@ -4,10 +4,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static C4IT.Logging.cLogManager;
[assembly: InternalsVisibleTo("F4SD.Cockpit.Client.Test")]
@@ -29,7 +27,7 @@ namespace FasdDesktopUi.Basics.Services.RelationService
{
try
{
_relations = new List<cF4sdApiSearchResultRelation>();
_relations = relatedTo?.Select(searchResult => new cF4sdApiSearchResultRelation(searchResult)).ToList() ?? new List<cF4sdApiSearchResultRelation>();
cF4sdStagedSearchResultRelationTaskId gatherRelationTask = await cFasdCockpitCommunicationBase.Instance.StartGatheringRelations(relatedTo, token);
_ = Task.Run(async () =>

View File

@@ -0,0 +1,255 @@
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Pages.DetailsPage.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.SupportCase.Controllers
{
/// <summary>
/// Used to manage the <see cref="ISupportCase"/> for the UI via the <see cref="SupportCaseProcessor"/>"
/// </summary>
public class SupportCaseController
{
private SupportCaseProcessor _supportCaseProcessor;
private cF4sdApiSearchResultRelation _focusedRelation;
private readonly Dictionary<enumFasdInformationClass, cF4sdApiSearchResultRelation> _selectedRelations = new Dictionary<enumFasdInformationClass, cF4sdApiSearchResultRelation>();
private cHealthCard _selectedHealthcard = null;
private bool _hasDirectionConnection = false;
public cSupportCaseDataProvider SupportCaseDataProviderArtifact { get => _supportCaseProcessor?.SupportCaseDataProviderArtifact; }
internal void SetSupportCaseProcessor(SupportCaseProcessor supportCaseProcessor, IEnumerable<cF4sdIdentityEntry> preselectedIdentities)
{
IEnumerable<cF4sdApiSearchResultRelation> preselectedRelations = GetPreselectedRelations(supportCaseProcessor.GetCaseRelations(), preselectedIdentities);
ResetSelectedRelations(preselectedRelations);
_hasDirectionConnection = false;
if (_supportCaseProcessor != null)
{
_supportCaseProcessor.AvailableCaseRelationsAdded -= HandleAvailableCaseRelationsAdded;
_supportCaseProcessor.CaseDataChanged -= HandleCaseDataChanged;
_supportCaseProcessor.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged -= HandleDirectConnectionChanged;
}
_supportCaseProcessor = supportCaseProcessor;
_supportCaseProcessor.AvailableCaseRelationsAdded += HandleAvailableCaseRelationsAdded;
_supportCaseProcessor.CaseDataChanged += HandleCaseDataChanged;
_supportCaseProcessor.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged += HandleDirectConnectionChanged;
}
private IEnumerable<cF4sdApiSearchResultRelation> GetPreselectedRelations
(ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> loadedRelations, IEnumerable<cF4sdIdentityEntry> preselectedIdentities)
{
List<cF4sdApiSearchResultRelation> preselectedRelations = new List<cF4sdApiSearchResultRelation>();
foreach (var relationType in loadedRelations)
{
foreach (var relation in relationType)
{
if (relation.Identities.All(ri => preselectedIdentities.Any(i => i.Id == ri.Id)))
preselectedRelations.Add(relation);
}
}
return preselectedRelations;
}
private void ResetSelectedRelations(IEnumerable<cF4sdApiSearchResultRelation> preselectedRelations)
{
try
{
_selectedRelations.Clear();
if (preselectedRelations is null)
return;
foreach (var relation in preselectedRelations)
{
_selectedRelations[cF4sdIdentityEntry.GetFromSearchResult(relation.Type)] = relation;
}
}
catch (Exception ex)
{
LogException(ex);
}
}
private void HandleAvailableCaseRelationsAdded(object sender, RelationEventArgs e)
=> AvailableCaseRelationsAdded?.Invoke(this, e);
private void HandleCaseDataChanged(object sender, SupportCaseDataEventArgs e)
{
CaseDataChanged?.Invoke(this, e);
_ = Task.Run(async () =>
{
await UpdateStatusOfSelectedRelations();
if (!_hasDirectionConnection)
await SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionStartAsync();
});
}
private void HandleDirectConnectionChanged(object sender, EventArgs e)
{
_hasDirectionConnection = SupportCaseDataProviderArtifact.DirectConnectionHelper.IsDirectConnectionActive;
}
/// <summary>
/// Updates the currently for a support case relevant and shown relation.
/// </summary>
/// <remarks>Raises <see cref="FocusedRelationsChanged"/></remarks>
internal void UpdateFocusedCaseRelation(cF4sdApiSearchResultRelation relation)
{
try
{
_selectedHealthcard = _supportCaseProcessor.GetHealthcardFor(relation);
HashSet<string> requiredTables = cHealthCard.GetRequiredTables(_selectedHealthcard);
_ = Task.Run(async () => await _supportCaseProcessor.LoadSupportCaseDataAsync(relation, requiredTables));
List<enumFasdInformationClass> requiredInformationClasses = relation.Identities
.Where(i => i.Class != enumFasdInformationClass.User)
.Select(i => i.Class)
.ToList();
if (relation.Type == enumF4sdSearchResultClass.User)
requiredInformationClasses = new List<enumFasdInformationClass>() { enumFasdInformationClass.User };
if (requiredInformationClasses.Count == 0)
requiredInformationClasses.Add(enumFasdInformationClass.User);
SupportCaseDataProviderArtifact.HealthCardDataHelper.TrySetSelectedHealthcard(requiredInformationClasses);
_focusedRelation = relation;
if (!_selectedRelations.Values.Contains(relation))
_hasDirectionConnection = false;
_selectedRelations[cF4sdIdentityEntry.GetFromSearchResult(relation.Type)] = relation;
_ = Task.Run(async () => await UpdateStatusOfSelectedRelations());
var focusedRelations = new cF4sdApiSearchResultRelation[1] { _focusedRelation };
FocusedRelationsChanged?.Invoke(this, new RelationEventArgs()
{
Relations = focusedRelations.ToLookup(r => cF4sdIdentityEntry.GetFromSearchResult(r.Type), r => r)
});
}
catch (Exception ex)
{
LogException(ex);
}
}
private async Task UpdateStatusOfSelectedRelations()
{
const string StatusString = "Status";
try
{
int? agentUserId = null;
int? agentDeviceId = null;
// todo these values should not be recieved from the NamedParameters, instead from the relation it self
if (SupportCaseDataProviderArtifact.NamedParameterEntries.TryGetValue("AgentUserId", out var userNamedParameter))
{
var value = userNamedParameter.GetValue();
if (!string.IsNullOrWhiteSpace(value))
agentUserId = int.Parse(value);
}
// todo these values should not be recieved from the NamedParameters, instead from the relation it self
if (SupportCaseDataProviderArtifact.NamedParameterEntries.TryGetValue("AgentDeviceId", out var deviceNamedParameter))
{
var value = deviceNamedParameter.GetValue();
if (!string.IsNullOrWhiteSpace(value))
agentDeviceId = int.Parse(deviceNamedParameter.GetValue());
}
foreach (var relationEntry in _selectedRelations)
{
if (relationEntry.Value is null)
continue;
string statusValue = "Unknown";
switch (relationEntry.Key)
{
case enumFasdInformationClass.Computer:
if (!agentDeviceId.HasValue)
continue;
bool isDeviceOnline = await cFasdCockpitCommunicationBase.Instance.GetAgentOnlineStatus(agentDeviceId.Value);
statusValue = isDeviceOnline ? "Online" : "Offline";
break;
case enumFasdInformationClass.User:
if (!agentDeviceId.HasValue || !agentUserId.HasValue)
continue;
bool isUserOnline = await cFasdCockpitCommunicationBase.Instance.GetAgentOnlineStatus(agentDeviceId.Value, agentUserId.Value);
statusValue = isUserOnline ? "Online" : "Offline";
break;
case enumFasdInformationClass.Ticket:
case enumFasdInformationClass.VirtualSession:
case enumFasdInformationClass.MobileDevice:
default:
continue;
}
if (relationEntry.Value.Infos is null)
relationEntry.Value.Infos = new Dictionary<string, string>();
relationEntry.Value.Infos[StatusString] = statusValue;
}
IEnumerable<cHeadingDataModel> newHeadingData = SupportCaseHeadingController.GetHeadingData(_selectedRelations);
HeadingDataChanged?.Invoke(this, new HeadingDataEventArgs(newHeadingData));
}
catch (Exception ex)
{
LogException(ex);
}
}
public async Task RefreshDataForCurrentlyFocusedRelationAsync()
{
await _supportCaseProcessor.UpdateLatestCaseDataFor(_focusedRelation);
}
public List<List<cWidgetValueModel>> GetWidgetData()
=> _supportCaseProcessor.GetWidgetData(_focusedRelation);
public cDetailsPageDataHistoryDataModel GetHistoryData()
=> _supportCaseProcessor.GetHistoryData(_focusedRelation);
public List<cContainerCollectionData> GetContainerData()
=> _supportCaseProcessor.GetContainerData(_focusedRelation);
public List<cMenuDataBase> GetMenuBarData()
=> _supportCaseProcessor.GetMenuBarData(_focusedRelation);
/// <summary>
/// Raised when the currently for a support case relevant and shown relations have been updated.
/// </summary>
public event EventHandler<RelationEventArgs> FocusedRelationsChanged;
/// <summary>
/// Raised when newly available relations for a support case were added.
/// </summary>
public event EventHandler<RelationEventArgs> AvailableCaseRelationsAdded;
/// <summary>
/// Raised when the data set of a support case has changed.
/// </summary>
public event EventHandler<SupportCaseDataEventArgs> CaseDataChanged;
public event EventHandler<HeadingDataEventArgs> HeadingDataChanged;
}
}

View File

@@ -0,0 +1,93 @@
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.SupportCase.Controllers
{
internal class SupportCaseHeadingController
{
internal static IEnumerable<cHeadingDataModel> GetHeadingData(Dictionary<enumFasdInformationClass, cF4sdApiSearchResultRelation> relations)
{
try
{
return Enum.GetValues(typeof(enumFasdInformationClass))
.Cast<enumFasdInformationClass>()
.Select(informationClass =>
{
if (relations.TryGetValue(informationClass, out var relation) && relation != null)
return GetHeadingDataFor(relation);
else
return GetEmptyHeadingDataFor(informationClass);
});
}
catch (Exception ex)
{
LogException(ex);
}
return Enumerable.Empty<cHeadingDataModel>();
}
private static cHeadingDataModel GetEmptyHeadingDataFor(enumFasdInformationClass informationClass)
{
string headingText = string.Empty;
switch (informationClass)
{
case enumFasdInformationClass.Computer:
headingText = cMultiLanguageSupport.GetItem("Header.Select.Computer");
break;
case enumFasdInformationClass.Ticket:
headingText = cMultiLanguageSupport.GetItem("Header.Select.Ticket");
break;
case enumFasdInformationClass.VirtualSession:
headingText = cMultiLanguageSupport.GetItem("Header.Select.VirtualSession");
break;
case enumFasdInformationClass.MobileDevice:
headingText = cMultiLanguageSupport.GetItem("Header.Select.MobileDevice");
break;
}
return new cHeadingDataModel() { InformationClass = informationClass, HeadingText = headingText };
}
private static cHeadingDataModel GetHeadingDataFor(cF4sdApiSearchResultRelation relation)
{
const string StatusString = "Status";
bool isOnline = false;
string statusValue = "Unknown";
if (relation?.Infos?.TryGetValue(StatusString, out var statusValueFromDictionary) ?? false)
statusValue = statusValueFromDictionary;
switch (relation.Type)
{
case enumF4sdSearchResultClass.Computer:
case enumF4sdSearchResultClass.User:
isOnline = string.Equals(statusValue, "Online", StringComparison.InvariantCultureIgnoreCase);
break;
case enumF4sdSearchResultClass.Ticket:
isOnline = !string.Equals(statusValue, nameof(enumTicketStatus.Closed));
break;
case enumF4sdSearchResultClass.VirtualSession:
isOnline = string.Equals(statusValue, nameof(enumCitrixSessionStatus.Active));
break;
case enumF4sdSearchResultClass.MobileDevice:
break;
}
return new cHeadingDataModel()
{
HeadingText = string.IsNullOrEmpty(relation.Name) ? relation.DisplayName : relation.Name,
InformationClass = cF4sdIdentityEntry.GetFromSearchResult(relation.Type),
IsOnline = isOnline,
Identities = relation.Identities,
Realtion = relation
};
}
}
}

View File

@@ -1,8 +1,9 @@
using C4IT.FASD.Base;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.CustomEvents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace FasdDesktopUi.Basics.Services.SupportCase
{
@@ -12,10 +13,13 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
void Initialize();
void AddCaseRelations(ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> relations);
ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> GetCaseRelations();
IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> GetSupportCaseHealthcardData(object identities, object valueAddress);
void UpdateSupportCaseDataCache();
Task LoadSupportCaseDataAsync(cF4sdApiSearchResultRelation relation, IEnumerable<string> tablesToLoad);
IEnumerable<object> GetSupportCaseHealthcardData(cF4sdApiSearchResultRelation relation, cValueAddress valueAddress);
void UpdateSupportCaseDataCache(cF4sdApiSearchResultRelation relation, IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> tables);
void InvalidateCaseDataCacheFor(cF4sdApiSearchResultRelation relation);
void InvalidateLatestCaseDataCacheFor(cF4sdApiSearchResultRelation relation, out ICollection<cF4SDHealthCardRawData.cHealthCardTable> invalidatedTables);
event EventHandler<RelationEventArgs> CaseRelationsAdded;
event EventHandler<object> SupportCaseDataCacheHasChanged;
event EventHandler<SupportCaseDataEventArgs> SupportCaseDataCacheHasChanged;
}
}

View File

@@ -1,10 +1,10 @@
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Services.RelationService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using static C4IT.Logging.cLogManager;
@@ -13,7 +13,7 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
public class SupportCase : ISupportCase
{
private readonly Dictionary<enumFasdInformationClass, IList<cF4sdApiSearchResultRelation>> _caseRelations = new Dictionary<enumFasdInformationClass, IList<cF4sdApiSearchResultRelation>>();
//private readonly Lookup<IdentitySet, cF4SDHealthCardRawData.cHealthCardTable> _supportCaseDataCache;
private readonly Dictionary<string, Dictionary<cF4sdApiSearchResultRelation, cF4SDHealthCardRawData.cHealthCardTable>> _supportCaseDataCache = new Dictionary<string, Dictionary<cF4sdApiSearchResultRelation, cF4SDHealthCardRawData.cHealthCardTable>>();
internal readonly Guid Id;
private readonly IRelationService _relationService;
@@ -67,12 +67,12 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
foreach (var relationType in relations)
{
if (_caseRelations.TryGetValue(relationType.Key, out var caseRelation))
caseRelation = caseRelation.Union(relationType, new SearchResultRelationEqualityComparer()).ToList();
caseRelation = caseRelation.Union(relationType).ToList();
else
_caseRelations.Add(relationType.Key, relationType.ToList());
if (SupportCaseDataProviderArtifact?.CaseRelations?.TryGetValue(relationType.Key, out var caseRelations) ?? false)
caseRelations = caseRelations.Union(relationType, new SearchResultRelationEqualityComparer()).ToList();
caseRelations = caseRelations.Union(relationType).ToList();
else
SupportCaseDataProviderArtifact?.CaseRelations?.Add(relationType.Key, relationType.ToList());
}
@@ -85,14 +85,158 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
}
}
public void UpdateSupportCaseDataCache()
public async Task LoadSupportCaseDataAsync(cF4sdApiSearchResultRelation relation, IEnumerable<string> tablesToLoad)
{
throw new NotImplementedException();
try
{
cF4SDHealthCardRawData rawData = null;
// todo this is only a temporary fix. Currently the tablesToLoad contain also detail tables
// and tables won't be loaded e.g. the QuickActionHistory
bool isDataComplete = tablesToLoad.Any(t =>
_supportCaseDataCache.TryGetValue(t, out var cachedTables)
&& cachedTables.TryGetValue(relation, out var table)
&& !table.IsIncomplete && !table.Columns.Values.Any(c => c.IsIncomplete)
);
var rawDataRequest = new cF4sdHealthCardRawDataRequest()
{
Identities = relation.Identities,
Tables = tablesToLoad.ToList(),
MaxAge = cF4SDCockpitXmlConfig.Instance?.HealthCardConfig?.SearchResultAge ?? 14
};
while (!isDataComplete)
{
if (rawData is null)
{
rawData = await cFasdCockpitCommunicationBase.Instance.GetHealthCardData(rawDataRequest);
await SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.SetHealthCardRawData(rawData, rawDataRequest.Identities);
}
else
{
rawData = await cFasdCockpitCommunicationBase.Instance.GetHealthCardData(rawData.Id);
await SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.UpdateHealthcardRawData(rawData);
}
UpdateSupportCaseDataCache(relation, rawData?.Tables?.Values);
isDataComplete = rawData?.Tables?
.Where(table => table.Key.StartsWith("Computation_") == false)
.All(table => !table.Value.IsIncomplete && !table.Value.Columns.Values.Any(c => c.IsIncomplete)) ?? false;
}
}
catch (Exception ex)
{
LogException(ex);
}
}
public IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> GetSupportCaseHealthcardData(object identities, object valueAddress)
public void UpdateSupportCaseDataCache(cF4sdApiSearchResultRelation relation, IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> tables)
{
throw new NotImplementedException();
try
{
if (tables is null)
return;
List<cF4SDHealthCardRawData.cHealthCardTable> dataTables = tables?.ToList();
foreach (var table in dataTables)
{
if (string.IsNullOrEmpty(table.Name))
continue;
if (!_supportCaseDataCache.ContainsKey(table.Name))
_supportCaseDataCache.Add(table.Name, new Dictionary<cF4sdApiSearchResultRelation, cF4SDHealthCardRawData.cHealthCardTable>());
if (!_supportCaseDataCache[table.Name].ContainsKey(relation))
_supportCaseDataCache[table.Name][relation] = table;
else
MergeTable(_supportCaseDataCache[table.Name][relation], table);
}
SupportCaseDataCacheHasChanged?.Invoke(this, new SupportCaseDataEventArgs() { Relation = relation, DataTables = dataTables });
}
catch (Exception ex)
{
LogException(ex);
}
void MergeTable(cF4SDHealthCardRawData.cHealthCardTable existingTable, cF4SDHealthCardRawData.cHealthCardTable newTable)
{
foreach (var newColumn in newTable.Columns)
{
existingTable.Columns[newColumn.Key] = newColumn.Value;
}
}
}
public void InvalidateCaseDataCacheFor(cF4sdApiSearchResultRelation relation)
{
try
{
foreach (var tableCache in _supportCaseDataCache.Values)
{
tableCache.Remove(relation);
}
// todo: invoke SupportCaseDataChache with empty tables
// SupportCaseDataCacheHasChanged?.Invoke(this, new SupportCaseDataEventArgs() { Relation = relation });
}
catch (Exception ex)
{
LogException(ex);
}
}
public void InvalidateLatestCaseDataCacheFor(cF4sdApiSearchResultRelation relation, out ICollection<cF4SDHealthCardRawData.cHealthCardTable> invalidatedTables)
{
invalidatedTables = new HashSet<cF4SDHealthCardRawData.cHealthCardTable>();
try
{
foreach (var tableCache in _supportCaseDataCache.Values)
{
if (!tableCache.TryGetValue(relation, out cF4SDHealthCardRawData.cHealthCardTable table))
continue;
table.IsIncomplete = true;
foreach (var column in table.Columns.Values)
{
column.Values[0] = null;
column.IsIncomplete = true;
}
invalidatedTables.Add(table);
}
}
catch (Exception ex)
{
LogException(ex);
}
}
public IEnumerable<object> GetSupportCaseHealthcardData(cF4sdApiSearchResultRelation relation, cValueAddress valueAddress)
{
try
{
if (!_supportCaseDataCache.TryGetValue(valueAddress.ValueTable, out var tables))
return null;
if (!tables.TryGetValue(relation, out var table))
return null;
if (!table.Columns.TryGetValue(valueAddress.ValueColumn, out var column))
return null;
return column.Values;
}
catch (Exception ex)
{
LogException(ex);
}
return null;
}
private void HandleRelationsFound(object sender, StagedSearchResultRelationsEventArgs e)
@@ -107,19 +251,6 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
=> AddCaseRelations(relations?.ToLookup(r => cF4sdIdentityEntry.GetFromSearchResult(r.Type), r => r));
public event EventHandler<RelationEventArgs> CaseRelationsAdded;
public event EventHandler<object> SupportCaseDataCacheHasChanged; // Lookup for IdentitySet and tables which has been updated
private class SearchResultRelationEqualityComparer : IEqualityComparer<cF4sdApiSearchResultRelation>
{
public bool Equals(cF4sdApiSearchResultRelation x, cF4sdApiSearchResultRelation y)
{
return x.isEqual(y);
}
public int GetHashCode(cF4sdApiSearchResultRelation obj)
{
return obj.GetHashCode();
}
}
public event EventHandler<SupportCaseDataEventArgs> SupportCaseDataCacheHasChanged;
}
}

View File

@@ -23,9 +23,6 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
if (primaryIdentity is null)
throw new InvalidEnumArgumentException($"{nameof(primaryIdentity)} must not be null.");
if (primaryIdentity.Class != enumFasdInformationClass.User)
throw new InvalidEnumArgumentException($"{nameof(primaryIdentity)} must be of class {nameof(enumFasdInformationClass.User)}.");
if (_supportCases.TryGetValue(primaryIdentity.Id, out var supportCase))
{
supportCase.Initialize();

View File

@@ -0,0 +1,274 @@
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Pages.DetailsPage.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.SupportCase
{
/// <summary>
/// Used for processing raw data of a <see cref="ISupportCase"/> for the UI in a certain way.
/// </summary>
internal class SupportCaseProcessor
{
private ISupportCase _supportCase;
public cSupportCaseDataProvider SupportCaseDataProviderArtifact { get => _supportCase?.SupportCaseDataProviderArtifact; }
private readonly Dictionary<cF4sdApiSearchResultRelation, cDetailsPageData> _detailsPageDataCache = new Dictionary<cF4sdApiSearchResultRelation, cDetailsPageData>();
private readonly Dictionary<cF4sdApiSearchResultRelation, Dictionary<string, object>> _namedParameterCache = new Dictionary<cF4sdApiSearchResultRelation, Dictionary<string, object>>();
internal void SetSupportCase(ISupportCase supportCase)
{
if (_supportCase != null)
{
_supportCase.CaseRelationsAdded -= HandleSupportCaseRelationsAdded;
_supportCase.SupportCaseDataCacheHasChanged -= HandleSupportCaseDataCacheHasChanged;
}
_supportCase = supportCase;
_supportCase.CaseRelationsAdded += HandleSupportCaseRelationsAdded;
_supportCase.SupportCaseDataCacheHasChanged += HandleSupportCaseDataCacheHasChanged;
}
private void HandleSupportCaseRelationsAdded(object sender, RelationEventArgs e)
=> AvailableCaseRelationsAdded?.Invoke(this, e);
private async void HandleSupportCaseDataCacheHasChanged(object sender, SupportCaseDataEventArgs e)
{
bool isArtifactShowingCorrectHealthCard
= SupportCaseDataProviderArtifact.HealthCardDataHelper.SelectedHealthCard == GetHealthcardFor(e.Relation);
if (!isArtifactShowingCorrectHealthCard)
{
// todo this can probably be removed, as soon as the last dependency of the SupportCaseDataProviderArtifact is gone.
// till then the detailspageData gets overriden with the detailspageData of the new relation.
// However, the removal shouldn't be much of a problem, due to the fact the Artifact also stores the raw data
_detailsPageDataCache.Remove(e.Relation);
return;
}
if (_detailsPageDataCache.TryGetValue(e.Relation, out var cachedData))
{
cDetailsPageData detailData = _supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataWithoutHeading();
cachedData.WidgetData = detailData.WidgetData;
cachedData.DataHistoryList = detailData.DataHistoryList;
cachedData.MenuBarData = detailData.MenuBarData;
cachedData.DataContainerCollectionList = detailData.DataContainerCollectionList;
}
else
{
_detailsPageDataCache[e.Relation] = await _supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataAsync();
}
UpdateNamedParameters(e.Relation, e.DataTables);
CaseDataChanged?.Invoke(this, e);
}
private void UpdateNamedParameters(cF4sdApiSearchResultRelation relation, IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> dataTables)
{
try
{
if (!_namedParameterCache.ContainsKey(relation))
_namedParameterCache.Add(relation, new Dictionary<string, object>());
var healthcard = GetHealthcardFor(relation);
foreach (var namedParameter in cHealthCardPrerequisites.GetNamedParameters(healthcard).Values)
{
var table = dataTables.FirstOrDefault(t => t.Name == namedParameter.DatabaseInfo.ValueTable);
if (table is null)
continue;
if (!table.Columns.TryGetValue(namedParameter.DatabaseInfo.ValueColumn, out var column))
continue;
string value = cUtility.RawValueFormatter.GetDisplayValue(column.Values.FirstOrDefault(), namedParameter.Display);
_namedParameterCache[relation][namedParameter.ParameterName] = value;
}
}
catch (Exception ex)
{
LogException(ex);
}
}
public async Task LoadSupportCaseDataAsync(cF4sdApiSearchResultRelation relation, IEnumerable<string> tablesToLoad)
{
_ = Task.Run(async () => await _supportCase.LoadSupportCaseDataAsync(relation, tablesToLoad.Where(t => !t.Contains("-details-"))));
if (!_detailsPageDataCache.TryGetValue(relation, out var detailsData))
{
detailsData = await _supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataAsync();
_detailsPageDataCache.Add(relation, detailsData);
}
CaseDataChanged?.Invoke(this, new SupportCaseDataEventArgs());
}
public async Task UpdateLatestCaseDataFor(cF4sdApiSearchResultRelation relation)
{
try
{
int? agentUserId = relation.Identities.FirstOrDefault(i => i.Class == enumFasdInformationClass.User)?.agentId;
int? agentDeviceId = relation.Identities.FirstOrDefault(i => i.Class == enumFasdInformationClass.Computer)?.agentId;
await ActualizeDataAsync(agentUserId, agentDeviceId);
_supportCase.InvalidateLatestCaseDataCacheFor(relation, out var invalidatedTables);
_detailsPageDataCache.Remove(relation);
await _supportCase.LoadSupportCaseDataAsync(relation, invalidatedTables.Select(t => t.Name));
}
catch (Exception ex)
{
LogException(ex);
}
}
private async Task<enumActualizeStatus> ActualizeDataAsync(int? agentUserId, int? agentDeviceId)
{
var status = enumActualizeStatus.unknown;
try
{
TimeSpan refreshDelay = TimeSpan.FromMilliseconds(500);
const int maxPollCount = 20;
if (!agentDeviceId.HasValue)
{
LogEntry("Coudldn't acutalize data. There was no valid AgentDeviceId found.", LogLevels.Error);
return status;
}
var taskId = await cFasdCockpitCommunicationBase.Instance.ActualizeAgentData(agentDeviceId.Value, agentUserId);
if (taskId == Guid.Empty)
return enumActualizeStatus.failed;
enumFasdInformationClass informationClass = agentUserId != null ? enumFasdInformationClass.User : enumFasdInformationClass.Computer;
int pollCount = 0;
do
{
status = await cFasdCockpitCommunicationBase.Instance.GetActualizeAgentDataStatus(taskId, informationClass);
if (status == enumActualizeStatus.unknown)
{
pollCount++;
if (pollCount >= maxPollCount)
return status;
await Task.Delay(refreshDelay);
}
} while (status == enumActualizeStatus.unknown);
}
catch (Exception E)
{
LogException(E);
}
return status;
}
internal ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> GetCaseRelations()
=> _supportCase.GetCaseRelations();
internal cHealthCard GetHealthcardFor(cF4sdApiSearchResultRelation relation)
{
var availableHealthCards = cF4SDCockpitXmlConfig.Instance?.HealthCardConfig?.HealthCards?.Values;
if (availableHealthCards is null || availableHealthCards.Count == 0)
return null;
return availableHealthCards
.FirstOrDefault(hc =>
hc.InformationClasses.All(i => i == cF4sdIdentityEntry.GetFromSearchResult(relation.Type))
&& HasCockpitUserRequiredRoles(hc.RequiredRoles));
}
private static bool HasCockpitUserRequiredRoles(List<string> requiredRoles)
{
try
{
if (requiredRoles is null || requiredRoles.Count == 0)
return true;
List<string> roles = null;
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
{
roles = cFasdCockpitCommunicationBase.CockpitUserInfo?.Roles;
}
if (roles is null || roles.Count == 0)
return false;
foreach (var requiredRole in requiredRoles)
{
if (roles.Contains(requiredRole, StringComparer.InvariantCultureIgnoreCase))
return true;
}
}
catch (Exception E)
{
LogException(E);
}
return false;
}
public List<List<cWidgetValueModel>> GetWidgetData(cF4sdApiSearchResultRelation relation)
{
List<List<cWidgetValueModel>> widgetData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
widgetData = detailsData?.WidgetData;
return widgetData ?? new List<List<cWidgetValueModel>>();
}
public cDetailsPageDataHistoryDataModel GetHistoryData(cF4sdApiSearchResultRelation relation)
{
cDetailsPageDataHistoryDataModel historyData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
historyData = detailsData?.DataHistoryList;
return historyData ?? new cDetailsPageDataHistoryDataModel();
}
public List<cContainerCollectionData> GetContainerData(cF4sdApiSearchResultRelation relation)
{
List<cContainerCollectionData> containerData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
containerData = detailsData?.DataContainerCollectionList;
return containerData ?? new List<cContainerCollectionData>();
}
public List<cMenuDataBase> GetMenuBarData(cF4sdApiSearchResultRelation relation)
{
List<cMenuDataBase> menuData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
menuData = detailsData?.MenuBarData;
return menuData ?? new List<cMenuDataBase>();
}
/// <summary>
/// Raised when newly available relations for a support case were added.
/// </summary>
public event EventHandler<RelationEventArgs> AvailableCaseRelationsAdded;
/// <summary>
/// Raised when the data set of a support case has changed.
/// </summary>
public event EventHandler<SupportCaseDataEventArgs> CaseDataChanged;
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.Services.SupportCase
{
internal class SupportCaseProcessorFactory
{
private readonly static Dictionary<Guid, SupportCaseProcessor> _supportCaseProccesors = new Dictionary<Guid, SupportCaseProcessor>();
internal static SupportCaseProcessor Get(Guid id)
{
if (!_supportCaseProccesors.ContainsKey(id))
_supportCaseProccesors.Add(id, new SupportCaseProcessor());
return _supportCaseProccesors[id];
}
}
}

View File

@@ -7,8 +7,9 @@ using System.Windows.Threading;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.Models;
using FasdDesktopUi;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.Models;
#if isDemo
using System.Net;
using FasdCockpitCommunicationDemo;
@@ -19,11 +20,10 @@ namespace FasdDesktopUi.Basics.Services
{
public sealed class TicketOverviewUpdateService
{
private static readonly TimeSpan RefreshInterval = TimeSpan.FromMinutes(5);
private static readonly string[] OverviewKeys = new[]
{
"TicketsNew",
"TicketsActive",
private static readonly string[] OverviewKeys = new[]
{
"TicketsNew",
"TicketsActive",
"TicketsCritical",
"TicketsNewInfo",
"IncidentNew",
@@ -33,16 +33,22 @@ namespace FasdDesktopUi.Basics.Services
"UnassignedTickets",
"UnassignedTicketsCritical"
};
private const string DemoTicketDetailsKey = "Demo.HasTicketDetails";
private readonly Dispatcher _dispatcher;
private readonly Dictionary<string, TileCounts> _currentCounts = new Dictionary<string, TileCounts>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<(string Key, bool UseRoleScope), List<cF4sdApiSearchResultRelation>> _demoRelations = new Dictionary<(string, bool), List<cF4sdApiSearchResultRelation>>();
private DispatcherTimer _timer;
private bool _isFetching;
private bool _fetchRetryPending;
private bool _isDemo;
private bool _initialized;
private readonly Random _random = new Random();
private const string DemoTicketDetailsKey = "Demo.HasTicketDetails";
private readonly Dispatcher _dispatcher;
private readonly Dictionary<string, TileCounts> _currentCounts = new Dictionary<string, TileCounts>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<(string Key, bool UseRoleScope), List<cF4sdApiSearchResultRelation>> _demoRelations = new Dictionary<(string, bool), List<cF4sdApiSearchResultRelation>>();
private readonly HashSet<TileScope> _pendingScopes = new HashSet<TileScope>();
private readonly HashSet<TileScope> _initializedScopes = new HashSet<TileScope>();
private readonly object _fetchLock = new object();
private readonly HashSet<TileScope> _retryScopes = new HashSet<TileScope>();
private DispatcherTimer _personalTimer;
private DispatcherTimer _roleTimer;
private Task _fetchWorker;
private bool _retryScheduled;
private bool _isDemo;
private bool _initialized;
private bool _isEnabled;
private readonly Random _random = new Random();
#if isDemo
private readonly List<DemoTicketRecord> _persistedDemoTickets = new List<DemoTicketRecord>();
private readonly List<DemoTicketTemplate> _demoTemplates = new List<DemoTicketTemplate>();
@@ -67,138 +73,338 @@ namespace FasdDesktopUi.Basics.Services
#endif
}
static TicketOverviewUpdateService()
{
#if isDemo
Instance = new TicketOverviewUpdateService();
#endif
}
public static TicketOverviewUpdateService Instance { get; } = null;
static TicketOverviewUpdateService()
{
Instance = new TicketOverviewUpdateService();
}
public static TicketOverviewUpdateService Instance { get; }
public event EventHandler<TicketOverviewCountsChangedEventArgs> OverviewCountsChanged;
public IReadOnlyDictionary<string, TileCounts> CurrentCounts => _currentCounts;
public IReadOnlyDictionary<string, TileCounts> CurrentCounts => _currentCounts;
public bool IsScopeInitialized(TileScope scope)
{
lock (_fetchLock)
{
return _initializedScopes.Contains(scope);
}
}
public bool AreAllScopesInitialized
{
get
{
lock (_fetchLock)
{
return _initializedScopes.Contains(TileScope.Personal)
&& _initializedScopes.Contains(TileScope.Role);
}
}
}
public void Start()
{
if (_initialized)
return;
public void Start()
{
UpdateAvailability(true);
}
public void Stop()
{
UpdateAvailability(false);
}
public void UpdateAvailability(bool isEnabled)
{
if (isEnabled)
{
if (!_isEnabled)
{
_isEnabled = true;
StartInternal();
}
else
{
RefreshTimerIntervals();
}
}
else
{
if (_isEnabled)
StopInternal();
_isEnabled = false;
}
}
private void StartInternal()
{
if (_initialized)
return;
_initialized = true;
#if isDemo
_isDemo = true;
LoadPersistedDemoTickets();
#else
_isDemo = cFasdCockpitCommunicationBase.Instance?.IsDemo() == true;
#endif
InitializeTimers();
_ = FetchAsync();
}
private void StopInternal()
{
if (!_initialized)
return;
_initialized = false;
lock (_fetchLock)
{
_pendingScopes.Clear();
_initializedScopes.Clear();
}
lock (_retryScopes)
{
_retryScheduled = false;
_retryScopes.Clear();
}
_dispatcher.InvokeAsync(() =>
{
_personalTimer?.Stop();
_roleTimer?.Stop();
_personalTimer = null;
_roleTimer = null;
foreach (var key in OverviewKeys)
{
_currentCounts[key] = TileCounts.Empty;
}
});
}
private void InitializeTimers()
{
_personalTimer = CreateScopeTimer(TileScope.Personal);
_roleTimer = CreateScopeTimer(TileScope.Role);
_personalTimer?.Start();
_roleTimer?.Start();
}
private DispatcherTimer CreateScopeTimer(TileScope scope)
{
var interval = GetPollingInterval(scope);
var timer = new DispatcherTimer(interval, DispatcherPriority.Background, async (s, e) => await FetchAsync(scope).ConfigureAwait(false), _dispatcher)
{
IsEnabled = false
};
return timer;
}
private TimeSpan GetPollingInterval(TileScope scope)
{
var ticketConfig = cFasdCockpitConfig.Instance?.Global?.TicketConfiguration;
int minutes = scope == TileScope.Role
? cF4sdTicketConfig.DefaultOverviewPollingRole
: cF4sdTicketConfig.DefaultOverviewPollingPersonal;
if (ticketConfig != null)
{
minutes = scope == TileScope.Role
? ticketConfig.OverviewPollingRole
: ticketConfig.OverviewPollingPersonal;
}
if (minutes < 1)
minutes = 1;
return TimeSpan.FromMinutes(minutes);
}
_initialized = true;
#if isDemo
_isDemo = true;
LoadPersistedDemoTickets();
#else
_isDemo = cFasdCockpitCommunicationBase.Instance?.IsDemo() == true;
#endif
if (!_isDemo)
{
_timer = new DispatcherTimer(RefreshInterval, DispatcherPriority.Background, async (s, e) => await FetchAsync().ConfigureAwait(false), _dispatcher);
_timer.Start();
_ = FetchAsync();
}
else
{
_ = FetchAsync();
}
}
public async Task FetchAsync()
{
if (_isFetching)
return;
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
{
ScheduleFetchRetry();
return;
}
_isFetching = true;
try
{
_isDemo = communication?.IsDemo() == true;
if (_isDemo && _timer != null)
{
_timer.Stop();
_timer = null;
}
var counts = await Task.Run(() => RetrieveCountsAsync()).ConfigureAwait(false);
if (counts != null)
{
await _dispatcher.InvokeAsync(() => ProcessCounts(counts));
}
}
finally
{
_isFetching = false;
}
}
private Dictionary<string, TileCounts> RetrieveCountsAsync()
{
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
return null;
var result = new Dictionary<string, TileCounts>(StringComparer.OrdinalIgnoreCase);
foreach (var key in OverviewKeys)
{
var personalTask = communication.GetTicketOverviewRelations(key, useRoleScope: false, count: 0);
var roleTask = communication.GetTicketOverviewRelations(key, useRoleScope: true, count: 0);
Task.WaitAll(personalTask, roleTask);
int personalCount = personalTask.Result?.Count ?? 0;
int roleCount = roleTask.Result?.Count ?? 0;
if (_isDemo)
{
personalCount += GetDemoRelationCount(key, useRoleScope: false);
roleCount += GetDemoRelationCount(key, useRoleScope: true);
}
result[key] = new TileCounts(personalCount, roleCount);
}
return result;
}
private void ProcessCounts(Dictionary<string, TileCounts> newCounts)
{
var changes = new List<TileCountChange>();
bool hasPrevious = _currentCounts.Values.Any(tc => tc.Personal > 0 || tc.Role > 0);
foreach (var key in OverviewKeys)
{
var previous = _currentCounts[key];
var current = newCounts.TryGetValue(key, out var value) ? value : TileCounts.Empty;
if (previous.Personal != current.Personal)
{
changes.Add(new TileCountChange(key, TileScope.Personal, previous.Personal, current.Personal));
}
if (previous.Role != current.Role)
{
changes.Add(new TileCountChange(key, TileScope.Role, previous.Role, current.Role));
}
_currentCounts[key] = current;
}
if (!hasPrevious)
return;
if (changes.Count == 0)
return;
var args = new TicketOverviewCountsChangedEventArgs(changes, new Dictionary<string, TileCounts>(_currentCounts));
OverviewCountsChanged?.Invoke(this, args);
}
public Task FetchAsync()
{
if (!_isEnabled)
return Task.CompletedTask;
return QueueFetchAsync(new[] { TileScope.Personal, TileScope.Role });
}
public Task FetchAsync(TileScope scope)
{
if (!_isEnabled)
return Task.CompletedTask;
return QueueFetchAsync(new[] { scope });
}
private Task QueueFetchAsync(IEnumerable<TileScope> scopes)
{
if (!_isEnabled)
return Task.CompletedTask;
if (scopes == null)
return Task.CompletedTask;
lock (_fetchLock)
{
foreach (var scope in scopes)
{
_pendingScopes.Add(scope);
}
if (_fetchWorker == null || _fetchWorker.IsCompleted)
{
_fetchWorker = Task.Run(ProcessFetchQueueAsync);
}
return _fetchWorker;
}
}
private async Task ProcessFetchQueueAsync()
{
while (true)
{
TileScope scope;
lock (_fetchLock)
{
if (_pendingScopes.Count == 0)
{
_fetchWorker = null;
return;
}
scope = _pendingScopes.First();
_pendingScopes.Remove(scope);
}
await FetchScopeAsync(scope).ConfigureAwait(false);
}
}
private async Task FetchScopeAsync(TileScope scope)
{
if (!_isEnabled)
return;
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
{
ScheduleFetchRetry(scope);
return;
}
try
{
_isDemo = communication.IsDemo();
var rawCounts = await communication.GetTicketOverviewCounts(OverviewKeys, scope == TileScope.Role).ConfigureAwait(false);
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
if (rawCounts != null)
{
foreach (var kvp in rawCounts)
{
if (string.IsNullOrWhiteSpace(kvp.Key))
continue;
counts[kvp.Key] = Math.Max(0, kvp.Value);
}
}
if (_isDemo)
{
foreach (var key in OverviewKeys)
{
var extras = GetDemoRelationCount(key, scope == TileScope.Role);
if (counts.ContainsKey(key))
counts[key] += extras;
else
counts[key] = extras;
}
}
if (!_isEnabled)
return;
await _dispatcher.InvokeAsync(() => ProcessScopeCounts(scope, counts));
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[TicketOverview] Fetch {scope} failed: {ex}");
ScheduleFetchRetry(scope);
}
}
private void RefreshTimerIntervals()
{
_dispatcher.InvokeAsync(() =>
{
if (_personalTimer != null)
_personalTimer.Interval = GetPollingInterval(TileScope.Personal);
if (_roleTimer != null)
_roleTimer.Interval = GetPollingInterval(TileScope.Role);
});
}
private void ProcessScopeCounts(TileScope scope, IDictionary<string, int> newCounts)
{
if (newCounts == null)
return;
var hasInitializedScope = _initializedScopes.Contains(scope);
var changes = new List<TileCountChange>();
foreach (var key in OverviewKeys)
{
var previous = _currentCounts.TryGetValue(key, out var counts) ? counts : TileCounts.Empty;
var incoming = newCounts.TryGetValue(key, out var value) ? value : 0;
TileCounts updated;
int oldValue;
if (scope == TileScope.Role)
{
updated = new TileCounts(previous.Personal, incoming);
oldValue = previous.Role;
}
else
{
updated = new TileCounts(incoming, previous.Role);
oldValue = previous.Personal;
}
_currentCounts[key] = updated;
if (hasInitializedScope && oldValue != incoming)
{
changes.Add(new TileCountChange(key, scope, oldValue, incoming));
}
}
if (!hasInitializedScope)
{
_initializedScopes.Add(scope);
var initArgs = new TicketOverviewCountsChangedEventArgs(
Array.Empty<TileCountChange>(),
new Dictionary<string, TileCounts>(_currentCounts, StringComparer.OrdinalIgnoreCase),
scope);
OverviewCountsChanged?.Invoke(this, initArgs);
return;
}
if (changes.Count == 0)
return;
var args = new TicketOverviewCountsChangedEventArgs(changes, new Dictionary<string, TileCounts>(_currentCounts, StringComparer.OrdinalIgnoreCase));
OverviewCountsChanged?.Invoke(this, args);
}
public void SimulateDemoTicket()
{
@@ -318,9 +524,9 @@ namespace FasdDesktopUi.Basics.Services
if (appliedChanges.Count == 0)
return;
var args = new TicketOverviewCountsChangedEventArgs(appliedChanges, new Dictionary<string, TileCounts>(_currentCounts));
OverviewCountsChanged?.Invoke(this, args);
}
var args = new TicketOverviewCountsChangedEventArgs(appliedChanges, new Dictionary<string, TileCounts>(_currentCounts));
OverviewCountsChanged?.Invoke(this, args);
}
private void AddRelationForRecord(DemoTicketRecord record)
{
@@ -577,24 +783,43 @@ namespace FasdDesktopUi.Basics.Services
return 0;
}
private void ScheduleFetchRetry()
{
if (_fetchRetryPending)
return;
_fetchRetryPending = true;
_ = _dispatcher.InvokeAsync(async () =>
{
try
{
await Task.Delay(250).ConfigureAwait(false);
await FetchAsync().ConfigureAwait(false);
}
finally
{
_fetchRetryPending = false;
}
}, DispatcherPriority.Background);
}
private void ScheduleFetchRetry(TileScope scope)
{
if (!_isEnabled)
return;
lock (_retryScopes)
{
_retryScopes.Add(scope);
if (_retryScheduled)
return;
_retryScheduled = true;
}
_ = _dispatcher.InvokeAsync(async () =>
{
try
{
await Task.Delay(TimeSpan.FromSeconds(5)).ConfigureAwait(false);
TileScope[] scopes;
lock (_retryScopes)
{
scopes = _retryScopes.ToArray();
_retryScopes.Clear();
_retryScheduled = false;
}
foreach (var pendingScope in scopes)
{
await FetchAsync(pendingScope).ConfigureAwait(false);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[TicketOverview] Retry scheduling failed: {ex}");
}
}, DispatcherPriority.Background);
}
}
}
}

View File

@@ -6,7 +6,8 @@ using System.Windows;
using System.Windows.Documents;
using System.Linq;
using System.Windows.Input;
using System.Diagnostics;
using System.Diagnostics;
using System.Windows.Threading;
using C4IT.FASD.Base;
using C4IT.Logging;
@@ -26,6 +27,8 @@ using Newtonsoft.Json;
using FasdDesktopUi.Basics.Services.ProtocollService;
using FasdDesktopUi.Basics.Services.SupportCase;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
using C4IT.F4SD.SupportCaseProtocoll.Models;
namespace FasdDesktopUi.Basics
@@ -100,10 +103,10 @@ namespace FasdDesktopUi.Basics
QuickActionProtocollHelper = new cQuickActionProtocollHelper(this);
}
public static async Task<cSupportCaseDataProvider> GetDataProviderForAsync(List<cF4sdApiSearchResultRelation> storedRelations, cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService)
{
try
{
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!");
@@ -147,43 +150,68 @@ namespace FasdDesktopUi.Basics
cSupportCaseDataProvider.CurrentProvider = null;
}
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);
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);
var supportCase = SupportCaseFactory.Get(MainIdentity, relationService, _result);
cSupportCaseDataProvider.detailsPage.SetSupportCase(supportCase);
cSupportCaseDataProvider.slimPage.SetSupportCase(supportCase);
var supportCaseProcessor = SupportCaseProcessorFactory.Get(MainIdentity.Id);
var supportCaseController = new SupportCaseController();
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);
var Status = await _result.SetViewDataAsync(requiredInformationClasses, Identities, true);
cF4sdApiSearchResultRelation relationToFocus = GetRelationToFocus(selectedRelation, relationService.GetLoadedRelations());
// relation to focus may not have all identities
supportCaseController.UpdateFocusedCaseRelation(relationToFocus);
if (!Status)
return null;
var selectedHealthCard = _result.HealthCardDataHelper?.SelectedHealthCard;
if (selectedHealthCard != null)
_ = cHealthCard.GetRequiredTables(selectedHealthCard); // todo the healthcard is not selected at this point
if (detailsPage?.WidgetCollection != null)
detailsPage.WidgetCollection.WidgetDataList = supportCaseController.GetWidgetData();
if (detailsPage?.DataHistoryCollectionUserControl != null)
detailsPage.DataHistoryCollectionUserControl.HistoryDataList = supportCaseController.GetHistoryData();
if (detailsPage?.CustomizableSectionUc != null)
detailsPage.CustomizableSectionUc.ContainerCollections = supportCaseController.GetContainerData();
CurrentProvider = _result;
// start the direct connection
if (_result.DirectConnectionHelper.IsDirectConnectionActive is false)
_ = Task.Run(async () =>
{
try
{
await _result.DirectConnectionHelper.DirectConnectionStartAsync();
}
catch { }
});
// start the slim or detaild page
bool shouldSkipSlimView = Identities.Any(identity => identity.Class is enumFasdInformationClass.Ticket) || cFasdCockpitConfig.Instance.Global.ShouldSkipSlimView;
if (shouldSkipSlimView)
cSupportCaseDataProvider.detailsPage?.Show();
else
cSupportCaseDataProvider.slimPage.Show();
bool shouldSkipSlimView = (Identities?.Any(identity => identity.Class is enumFasdInformationClass.Ticket) ?? false)
|| (cFasdCockpitConfig.Instance?.Global?.ShouldSkipSlimView ?? false);
if (shouldSkipSlimView)
{
cSupportCaseDataProvider.detailsPage?.Show();
cSupportCaseDataProvider.slimPage?.Hide();
}
else
{
cSupportCaseDataProvider.slimPage?.Show();
cSupportCaseDataProvider.detailsPage?.Hide();
}
return _result;
}
@@ -194,11 +222,35 @@ namespace FasdDesktopUi.Basics
return null;
}
public void StartCase(Guid userId)
private static cF4sdApiSearchResultRelation GetRelationToFocus(cF4sdApiSearchResultRelation selectedRelation, IEnumerable<cF4sdApiSearchResultRelation> loadedRelations)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
if (selectedRelation.Type != enumF4sdSearchResultClass.User)
return selectedRelation;
cF4sdIdentityEntry alternativeIdentity = selectedRelation.Identities.FirstOrDefault(i => i.Class != enumFasdInformationClass.User);
cF4sdApiSearchResultRelation relationToFocus = loadedRelations.FirstOrDefault(r => r.id == alternativeIdentity?.Id && cF4sdIdentityEntry.GetFromSearchResult(r.Type) == alternativeIdentity.Class);
if (relationToFocus is null)
return selectedRelation;
relationToFocus.Identities = selectedRelation.Identities;
return relationToFocus;
}
catch (Exception ex)
{
LogException(ex);
}
return selectedRelation;
}
public void StartCase(Guid userId)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
lock (caseIdLockObject)
{
@@ -238,11 +290,28 @@ namespace FasdDesktopUi.Basics
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
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);
}
public async Task CloseCaseAsync()
{
@@ -452,35 +521,12 @@ namespace FasdDesktopUi.Basics
}
}
var isOk = await HealthCardDataHelper.LoadingHelper.GetHealthCardRawDataAsync(new cF4sdHealthCardRawDataRequest()
{
Identities = Identities,
Tables = requiredTables.ToList(),
MaxAge = cF4SDCockpitXmlConfig.Instance?.HealthCardConfig?.SearchResultAge ?? 14
});
if (isNewCase)
HealthCardDataHelper.LoadingHelper.LastDataRequest = DateTime.Now;
if (isOk == false)
{
string identityString = "";
foreach (var identity in Identities)
{
identityString += "\n" + identity.Id + " (Type: " + identity.Class + ")";
}
LogEntry($"Error trying to receive healthcard data for following identities: {identityString}", LogLevels.Error);
CustomMessageBox.Show($"Error trying to receive healthcard data for following identities: {identityString}", "Data Error", enumHealthCardStateLevel.Error);
return false;
}
var slimPageData = await HealthCardDataHelper.SlimCard.GetDataAsync();
var detailsPageData = await HealthCardDataHelper.DetailPage.GetDataAsync();
slimPage?.SetPropertyValues(slimPageData);
detailsPage?.SetPropertyValues(detailsPageData);
return true;
}
@@ -545,11 +591,6 @@ namespace FasdDesktopUi.Basics
}
relationIdentity.CopyTo(existingIdentity);
}
else
{
Identities.Add(relationIdentity.CreateCopy());
ComputerAdded |= relationIdentity.Class == enumFasdInformationClass.Computer;
}
}
@@ -561,16 +602,6 @@ namespace FasdDesktopUi.Basics
var searchResultInfoClass = cF4sdIdentityEntry.GetFromSearchResult(searchResultRelation.Type);
await SetViewDataAsync(new List<enumFasdInformationClass>() { searchResultInfoClass }, Identities, false);
if (ComputerAdded)
_ = Task.Run(async () =>
{
try
{
await DirectConnectionHelper.DirectConnectionStartAsync();
}
catch { }
});
}
catch (Exception E)
{

View File

@@ -1,24 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.UserControls;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
using FasdDesktopUi.Pages.DetailsPage;
using FasdDesktopUi.Pages.DetailsPage.UserControls;
using static C4IT.Logging.cLogManager;
@@ -26,11 +13,14 @@ namespace FasdDesktopUi.Basics.UiActions
{
public class cChangeHealthCardAction : cUiActionBase
{
private readonly SupportCaseController _supportCaseController;
public cF4sdApiSearchResultRelation ResultRelation { get; private set; } = null;
public cChangeHealthCardAction(cF4sdApiSearchResultRelation resultRelation)
public cChangeHealthCardAction(cF4sdApiSearchResultRelation resultRelation, SupportCaseController supportCaseController)
{
ResultRelation = resultRelation;
_supportCaseController = supportCaseController;
}
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
@@ -52,6 +42,8 @@ namespace FasdDesktopUi.Basics.UiActions
detailsPage.NavigationHeadingUc.ResetSelectors();
await dataProvider.ExchangeCaseIdentitiesAsync(ResultRelation);
_supportCaseController.UpdateFocusedCaseRelation(ResultRelation);
detailsPage.UpdateHealthcardSectionVisibilities();
return true;
}

View File

@@ -34,17 +34,17 @@ namespace FasdDesktopUi.Basics.UiActions
private string Recommendation { get; set; }
private cHealthCardDetailsTable ValuedDetailsData = null;
private readonly cHealthCardDetailsTable _valuedDetailsData = null;
public cShowDetailedDataAction(cHealthCardStateBase StateDefinition, int DayIndex = 0, cHealthCardDetailsTable ValuedDetailsData = null)
public cShowDetailedDataAction(cHealthCardStateBase stateDefinition, int dayIndex = 0, cHealthCardDetailsTable valuedDetailsData = null)
{
this.StateDefinition = StateDefinition;
this.DayIndex = DayIndex;
this.DetailsTitle = StateDefinition.Names.GetValue();
this.Recommendation = StateDefinition.Descriptions.GetValue();
if (this.Recommendation == String.Empty)
this.Recommendation = null;
this.ValuedDetailsData = ValuedDetailsData;
StateDefinition = stateDefinition;
DayIndex = dayIndex;
DetailsTitle = stateDefinition.Names.GetValue();
Recommendation = stateDefinition.Descriptions.GetValue();
if (Recommendation == string.Empty)
Recommendation = null;
_valuedDetailsData = valuedDetailsData;
}
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
@@ -61,7 +61,7 @@ namespace FasdDesktopUi.Basics.UiActions
if (StateDefinition.Details is cHealthCardDetailsValued)
{
if (ValuedDetailsData == null)
if (_valuedDetailsData == null)
return false;
}
else
@@ -240,26 +240,37 @@ namespace FasdDesktopUi.Basics.UiActions
private cDetailedDataModel GetValuedDataModel()
{
if (!(StateDefinition.Details is cHealthCardDetailsValued _details) || ValuedDetailsData == null)
if (!(StateDefinition.Details is cHealthCardDetailsValued details) || _valuedDetailsData == null)
return null;
if (ValuedDetailsData.Columns.Count > 1)
var _colCount = details.Count;
if (_colCount == 0)
return null;
var _rowHeadings = _details.Select(v => v.Names.GetValue() as object).ToList();
var rowHeadings = details.Select(v => (object)v.Names.GetValue()).ToList();
cDetailedDataModel output = new cDetailedDataModel()
{
Heading = StateDefinition.Names.GetValue(),
FullDetailedData = new List<object>(),
HasColumnHeaders = _rowHeadings.Count > 1
HasColumnHeaders = _colCount > 1
};
if (_rowHeadings.Count > 1)
output.FullDetailedData.Add(_rowHeadings);
if (rowHeadings.Count > 1)
output.FullDetailedData.Add(rowHeadings);
var _data = ValuedDetailsData.Values[0];
var _data = _valuedDetailsData.Values[0];
foreach (var _row in _data)
output.FullDetailedData.Add(new List<object>() { _row[0] });
{
var _rowValues = new List<object>();
for (int i = 0; i < _colCount; i++)
{
_rowValues.Add(_row[i]);
}
output.FullDetailedData.Add(_rowValues);
}
var _json = Newtonsoft.Json.JsonConvert.SerializeObject(output);
return output;
}
@@ -307,7 +318,7 @@ namespace FasdDesktopUi.Basics.UiActions
var valueProcessing = splitColumnName.Length > 1 ? splitColumnName[1] : null;
rawColumnIndexes.Add(rawColumnIndex);
displayTypes.Add(cUtility.GetRawValueType(displayType));
displayTypes.Add(displayType);
valueProcessings.Add(valueProcessing);
}
@@ -326,7 +337,8 @@ namespace FasdDesktopUi.Basics.UiActions
shouldHideRow = true;
}
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultCulture(new CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
foreach (var index in rawColumnIndexes)
{
@@ -366,6 +378,8 @@ namespace FasdDesktopUi.Basics.UiActions
output.FullDetailedData.Add(displayValuesOfRow);
}
var _json = Newtonsoft.Json.JsonConvert.SerializeObject(output);
return output;
}
catch (Exception E)

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.Logging;
using C4IT.MultiLanguage;
@@ -135,8 +136,10 @@ namespace FasdDesktopUi.Basics.UiActions
StatusMonitor.QuickActionOutputs.Add(_ref.Output);
quickActionOutput = QuickActionStatusMonitor.cQuickActionOutput.GetQuickActionOutput(_ref.Output, DataProvider);
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(quickActionDemo, DataProvider, true, quickActionOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(quickActionDemo, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(quickActionDemo, DataProvider, true, quickActionOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(quickActionDemo, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
_msg = cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.FinishedSuccessfull");
}

View File

@@ -6,6 +6,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
@@ -154,9 +155,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
string quickActionStatus;
switch (ResultRevision.Status)
@@ -193,8 +195,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
output = new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.Logging;
using C4IT.MultiLanguage;
@@ -124,8 +125,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
return new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.FinishedSuccessfull"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}
@@ -141,8 +144,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage;
protocollOutput = new cQuickActionOutputSingle(new cF4sdQuickActionRevision.cOutput() { ResultCode = enumQuickActionSuccess.error, ErrorDescription = cMultiLanguageSupport.GetItem("QuickAction.Copy.Output.Cancel") });
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
cMultiLanguageSupport.CurrentLanguage = tempLang;
return new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };

View File

@@ -58,7 +58,7 @@ namespace FasdDesktopUi.Basics.UiActions
}
}
HistoryEntry.isSeen = true;
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(RelationEntry.Relations, RelationEntry.SelectedRelation, relationService);
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(RelationEntry.SelectedRelation, relationService);
if (dataProvider is null)
{
Debug.Assert(true, "Could not start a data provider for the selected criterias.");

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using static C4IT.Logging.cLogManager;
@@ -23,7 +24,7 @@ namespace FasdDesktopUi.Basics.UiActions
public cUiProcessSearchRelationAction(cSearchHistorySearchResultEntry searchHistoryEntry, cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService, ISearchUiProvider searchUiProvider)
{
Name = $"{searchHistoryEntry.HeaderText} → {selectedRelation.DisplayName}";
Name = !string.IsNullOrWhiteSpace(selectedRelation.DisplayName) ? $"{searchHistoryEntry.HeaderText} → {selectedRelation.DisplayName}" : searchHistoryEntry.HeaderText;
_selectedSearchResult = searchHistoryEntry.SelectedSearchResult;
_relations = searchHistoryEntry.Relations;
_selectedRelation = selectedRelation;
@@ -32,7 +33,7 @@ namespace FasdDesktopUi.Basics.UiActions
_searchHistoryEntry = searchHistoryEntry;
}
public cUiProcessSearchRelationAction(string name, List<cFasdApiSearchResultEntry> selectedSearchResult, List<cF4sdApiSearchResultRelation> relations, cF4sdApiSearchResultRelation selectedRelation, ISearchUiProvider searchUiProvider, cSearchHistoryEntryBase searchHistoryEntry)
public cUiProcessSearchRelationAction(string name, List<cFasdApiSearchResultEntry> selectedSearchResult, List<cF4sdApiSearchResultRelation> relations, cF4sdApiSearchResultRelation selectedRelation, ISearchUiProvider searchUiProvider, cSearchHistoryEntryBase searchHistoryEntry, IRelationService relationService)
{
Name = name;
_selectedSearchResult = selectedSearchResult;
@@ -40,6 +41,7 @@ namespace FasdDesktopUi.Basics.UiActions
_selectedRelation = selectedRelation;
_searchUiProvider = searchUiProvider;
_searchHistoryEntry = searchHistoryEntry;
_relationService = relationService;
}
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
@@ -84,10 +86,15 @@ namespace FasdDesktopUi.Basics.UiActions
return false;
}
// set the new result menu properies for loading ....
_seachHistoryEntry.isSeen = true;
// get the new data provider for the support call informations (get it from the cache or create a new one)
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(_relations, _selectedRelation, _relationService);
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(_selectedRelation, _relationService);
bool shouldLoadRelationsForSelectedRelation = _selectedRelation.Type == enumF4sdSearchResultClass.User;
if (shouldLoadRelationsForSelectedRelation)
StartLoadingRelationsFor(_selectedRelation);
if (dataProvider is null)
{
@@ -106,5 +113,26 @@ namespace FasdDesktopUi.Basics.UiActions
return false;
}
private void StartLoadingRelationsFor(cF4sdApiSearchResultRelation selectedRelation)
{
try
{
var relationsToReload = new List<cFasdApiSearchResultEntry>() { new cFasdApiSearchResultEntry()
{
DisplayName = selectedRelation.DisplayName,
id = selectedRelation.id,
Infos = selectedRelation.Infos,
Name = selectedRelation.Name,
Status = selectedRelation.Status,
Type = selectedRelation.Type
} };
_ = Task.Run(async () => _relationService.LoadRelationsAsync(relationsToReload), CancellationToken.None);
}
catch (Exception ex)
{
LogException(ex);
}
}
}
}

View File

@@ -24,6 +24,8 @@ namespace FasdDesktopUi.Basics.UiActions
private readonly List<cF4sdApiSearchResultRelation> _loadedRelations = new List<cF4sdApiSearchResultRelation>();
private readonly TaskCompletionSource<bool> _isSearchUnambigous = new TaskCompletionSource<bool>();
private IRelationService _relationService = null;
public cF4sdApiSearchResultRelation PreSelectedSearchRelation { get; set; } = null;
public cUiProcessSearchResultAction(string name, ISearchUiProvider searchUiProvider, List<cFasdApiSearchResultEntry> searchResults)
@@ -115,10 +117,10 @@ namespace FasdDesktopUi.Basics.UiActions
private async Task<bool> ProcessSearchResultRelationAsync(string name, List<cF4sdApiSearchResultRelation> caseRelations, cF4sdApiSearchResultRelation selectedRelation)
{
var relationSearchResult = new cSearchHistorySearchResultEntry(_searchResults.FirstOrDefault().DisplayName, _searchResults.FirstOrDefault().DisplayName, _searchResults, caseRelations, _searchUiProvider);
string displayName = selectedRelation != null ? $"{name} → {selectedRelation.Name}" : name;
string displayName = !string.IsNullOrWhiteSpace(selectedRelation?.Name) ? $"{name} → {selectedRelation.Name}" : name;
cUiProcessSearchRelationAction action
= new cUiProcessSearchRelationAction(displayName, _searchResults, caseRelations, caseRelations.FirstOrDefault(), _searchUiProvider, relationSearchResult)
= new cUiProcessSearchRelationAction(displayName, _searchResults, caseRelations, selectedRelation, _searchUiProvider, relationSearchResult, _relationService)
{
DisplayType = enumActionDisplayType.enabled,
};
@@ -155,6 +157,7 @@ namespace FasdDesktopUi.Basics.UiActions
try
{
_loadedRelations.AddRange(e.StagedResultRelations.Relations);
_relationService = e.RelationService;
if (!e.StagedResultRelations.IsComplete)
return;

View File

@@ -45,6 +45,7 @@ namespace FasdDesktopUi.Basics.UiActions
return;
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
shouldRunImmidiate = QuickActionConfig.RunImmediate;
Description = QuickActionConfig.Descriptions?.GetValue(Default: null);

View File

@@ -27,12 +27,12 @@ namespace FasdDesktopUi.Basics.UiActions
_quickTip = quickTip;
}
public override Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
{
try
{
if (!(UiLocation is QuickTipStatusMonitor quickTipStatusMonitor))
return Task.FromResult(false);
return false;
DataProvider = dataProvider;
@@ -49,13 +49,13 @@ namespace FasdDesktopUi.Basics.UiActions
quickTipStatusMonitor.Visibility = Visibility.Visible;
return Task.FromResult(true);
return true;
}
catch (Exception E)
{
LogException(E);
}
return Task.FromResult(false);
return false;
}
private void CreateElementData()

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
@@ -137,9 +138,10 @@ namespace FasdDesktopUi.Basics.UiActions
cQuickActionStatusMonitorModel.cQuickActionStep.SetQuickActionStepStatuses(StatusMonitor.QuickActionData.ActionSteps, RemoteQuickAction.Name, enumActionStepType.running, status);
cQuickActionStatusMonitorModel.cQuickActionStep.SetQuickActionStepStatuses(StatusMonitor.QuickActionData.ActionSteps, RemoteQuickAction.Name, enumActionStepType.main, status);
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(RemoteQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(RemoteQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
}
else
{
@@ -155,8 +157,11 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(RemoteQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(RemoteQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
return new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}
@@ -241,7 +246,7 @@ namespace FasdDesktopUi.Basics.UiActions
{
Id = measure.Id,
Names = measureDefinition.Names,
Display = cUtility.GetRawValueType(measureDefinition.Display),
Display = measureDefinition.Display,
Value = measure.Value,
PostValue = measure.PostValue
});

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
@@ -170,8 +171,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(ServerQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(ServerQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
string quickActionStatus;
switch (ResultRevision.Status)
@@ -208,8 +211,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(ServerQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(ServerQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
output = new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using C4IT.Logging;
using FasdDesktopUi.Pages.RawHealthCardValuesPage;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UiActions
{
public class UiShowRawHealthcardValues : cUiActionBase
{
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
var _rawValueWindow = new RawHealthCardValuesPage();
_rawValueWindow.Show();
return true;
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
return false;
}
}
}

View File

@@ -0,0 +1,27 @@
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.Badge"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FasdDesktopUi.Basics.UserControls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="20"
d:DesignWidth="40"
x:Name="BadgeControl">
<Border Background="{DynamicResource Color.F4SD}"
CornerRadius="5">
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal"
Margin="7.5 2.5">
<TextBlock FontSize="12"
FontWeight="Bold"
Foreground="White"
Text="{Binding ElementName=BadgeControl, Path=Text}" />
</StackPanel>
</Border>
</UserControl>

View File

@@ -0,0 +1,27 @@
using F4SD_AdaptableIcon;
using FasdDesktopUi.Basics.Helper;
using System;
using System.Windows;
using System.Windows.Controls;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UserControls
{
public partial class Badge : UserControl
{
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register(nameof(Text), typeof(string), typeof(Badge), new PropertyMetadata("Beta"));
public Badge()
{
InitializeComponent();
}
}
}

View File

@@ -23,12 +23,6 @@
Visibility="{Binding ElementName=DataCanvasUc, Path=IsDetailedLayout, Converter={StaticResource BoolToVisibility}}"
IsCloseButtonVisible="{Binding ElementName=DataCanvasUc, Path=DataCanvasData, Converter={StaticResource IsCloseButtonVisible}, ConverterParameter={x:Static converter:enumDataCanvasTypes.detailedData} }" />
<local:DetailedChart x:Name="DetailedChartUc"
HorizontalAlignment="Stretch"
Width="385"
Visibility="{Binding ElementName=DataCanvasUc, Path=IsDetailedLayout, Converter={StaticResource BoolToVisibility}}"
IsCloseButtonVisible="{Binding ElementName=DataCanvasUc, Path=DataCanvasData, Converter={StaticResource IsCloseButtonVisible}, ConverterParameter={x:Static converter:enumDataCanvasTypes.detailedData} }" />
<local:DynamicChart x:Name="DynamicChartUc"
HorizontalAlignment="Stretch"
Width="385"

View File

@@ -72,20 +72,16 @@ namespace FasdDesktopUi.Basics.UserControls
{
_me.DetailedDataUc.DetailedInformationData = _me.DataCanvasData.DetailedData;
_me.DetailedDataUc.CloseButtonClickedAction = _me.CloseDataCanvas;
_me.DetailedChartUc.ChartData = null;
_me.DynamicChartUc.ChartData = null;
}
else if (_me.DataCanvasData.ChartData is null)
{
_me.DetailedChartUc.ChartData = _me.DataCanvasData.DetailedChartData;
_me.DynamicChartUc.ChartData = null;
_me.DetailedDataUc.DetailedInformationData = null;
_me.DetailedChartUc.CloseButtonClickedAction = _me.CloseDataCanvas;
}
else
{
_me.DynamicChartUc.ChartData = _me.DataCanvasData.ChartData;
_me.DetailedChartUc.ChartData = null;
_me.DetailedDataUc.DetailedInformationData = null;
_me.DynamicChartUc.CloseButtonClickedAction = _me.CloseDataCanvas;
}
@@ -169,7 +165,6 @@ namespace FasdDesktopUi.Basics.UserControls
public DataCanvas()
{
InitializeComponent();
DetailedChartUc.Visibility = Visibility.Visible;
}
public DataCanvas(bool drawInScrollViewer)
@@ -186,6 +181,11 @@ namespace FasdDesktopUi.Basics.UserControls
}
private async void HealthCardDataHelper_DataRefreshed(object sender, EventArgs e)
{
await UpdateDataAsync();
}
internal async Task UpdateDataAsync()
{
try
{
@@ -215,7 +215,7 @@ namespace FasdDesktopUi.Basics.UserControls
tempDataCanvasData.DetailedData = detailedData;
else if (chartData is null)
tempDataCanvasData.DetailedChartData = detailedChartData;
else
else
tempDataCanvasData.ChartData = chartData;
DataCanvasData = tempDataCanvasData;

View File

@@ -555,21 +555,34 @@ namespace FasdDesktopUi.Basics.UserControls
}
}
public void SetValuesLineGraph()
{
try
{
double oneDayMs = TimeSpan.FromDays(1).TotalMilliseconds;
double chartStartMs = 0;
double chartEndMs = oneDayMs;
foreach (var data in GraphicDataProperty)
{
DateTime dataTime = data.Time;
double dataValue = data.Value;
int dataDuration = data.Duration;
double time = dataTime.TimeOfDay.TotalMilliseconds;
double startMs = dataTime.TimeOfDay.TotalMilliseconds;
double endMs = startMs + dataDuration;
double xLeft = xCoordinate.GetCoordinate(time);
double xRight = xCoordinate.GetCoordinate(time + dataDuration);
if (startMs >= chartEndMs || endMs <= chartStartMs)
continue;
if (startMs < chartStartMs)
startMs = chartStartMs;
if (endMs > chartEndMs)
endMs = chartEndMs;
double xLeft = xCoordinate.GetCoordinate(startMs);
double xRight = xCoordinate.GetCoordinate(endMs);
double y = 0;
@@ -585,19 +598,19 @@ namespace FasdDesktopUi.Basics.UserControls
{
y = yCoordinate.GetCoordinate(dataValue);
}
Border border = new Border()
{
Height = 6.0,
Width = xRight - xLeft,
Width = xRight - xLeft,
CornerRadius = new CornerRadius(4.0),
ToolTip = dataTime.ToShortTimeString() + " - " + dataTime.AddMilliseconds(dataDuration).ToShortTimeString() + " | " + dataValue,
};
if (border.Width < 6)
{
border.Width = 6;
}
border.Width = 6;
}
if (ChartData.IsThresholdActive == false)
{
border.Background = new SolidColorBrush(Color.FromRgb(0, 157, 221));
@@ -652,16 +665,30 @@ namespace FasdDesktopUi.Basics.UserControls
{
try
{
double oneDayMs = TimeSpan.FromDays(1).TotalMilliseconds;
double chartStartMs = 0;
double chartEndMs = oneDayMs;
foreach (var data in GraphicDataProperty)
{
DateTime dataTime = data.Time;
double dataValue = data.Value;
int dataDuration = data.Duration;
double time = dataTime.TimeOfDay.TotalMilliseconds;
double startMs = dataTime.TimeOfDay.TotalMilliseconds;
double endMs = startMs + dataDuration;
double xLeft = xCoordinate.GetCoordinate(time);
double xRight = xCoordinate.GetCoordinate(time + dataDuration);
if (startMs >= chartEndMs || endMs <= chartStartMs)
continue;
if (startMs < chartStartMs)
startMs = chartStartMs;
if (endMs > chartEndMs)
endMs = chartEndMs;
double xLeft = xCoordinate.GetCoordinate(startMs);
double xRight = xCoordinate.GetCoordinate(endMs);
double y = 0;

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using F4SD_AdaptableIcon.Enums;
@@ -38,6 +39,7 @@ namespace FasdDesktopUi.Basics.UserControls
public cQuickActionOutput(cF4sdQuickActionRevision.cOutput scriptOutput)
{
_rawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
_rawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
ErrorCode = scriptOutput.ErrorCode;
ErrorDescription = scriptOutput.ErrorDescription;
ResultCode = scriptOutput.ResultCode.GetValueOrDefault();
@@ -246,7 +248,7 @@ namespace FasdDesktopUi.Basics.UserControls
return veiledText;
if (outputFormatting.DisplayType != null)
output = _rawValueFormatter.GetDisplayValue(Value, cUtility.GetRawValueType(outputFormatting.DisplayType.Value));
output = _rawValueFormatter.GetDisplayValue(Value, outputFormatting.DisplayType.Value);
if (outputFormatting.Translation != null)
{
@@ -372,7 +374,7 @@ namespace FasdDesktopUi.Basics.UserControls
return veiledText;
if (outputFormatting.DisplayType != null)
output = _rawValueFormatter.GetDisplayValue(selectedItem.Value, cUtility.GetRawValueType(outputFormatting.DisplayType.Value));
output = _rawValueFormatter.GetDisplayValue(selectedItem.Value, outputFormatting.DisplayType.Value);
if (outputFormatting.Translation != null)
{
@@ -464,7 +466,7 @@ namespace FasdDesktopUi.Basics.UserControls
return veiledText;
if (outputFormatting.DisplayType != null)
output = _rawValueFormatter.GetDisplayValue(Values[row][column].Value, cUtility.GetRawValueType(outputFormatting.DisplayType.Value));
output = _rawValueFormatter.GetDisplayValue(Values[row][column].Value, outputFormatting.DisplayType.Value);
if (outputFormatting.Translation != null)
{
@@ -803,6 +805,7 @@ namespace FasdDesktopUi.Basics.UserControls
return;
_rawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
_rawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
for (int i = 0; i < measureValues.Count; i++)
{

View File

@@ -1,14 +1,17 @@
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.QuickTip.QuickTipStatusMonitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:uc="clr-namespace:FasdDesktopUi.Basics.UserControls"
xmlns:local="clr-namespace:FasdDesktopUi.Basics.UserControls.QuickTip"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:icod="clr-namespace:F4SD_AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
xmlns:converter="clr-namespace:FasdDesktopUi.Basics.Converter"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="400"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="400"
MinWidth="400"
MinHeight="200"
IsVisibleChanged="QuickTipStatusMonitorUc_IsVisibleChanged"
@@ -16,116 +19,122 @@
<UserControl.Resources>
<converter:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<Style x:Key="BorderButtonWithText" TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="Background" Value="{DynamicResource Color.AppBackground}"/>
<Setter Property="Height" Value="35"/>
<EventSetter Event="MouseEnter" Handler="ButtonBorder_MouseEnter"/>
<EventSetter Event="MouseLeave" Handler="ButtonBorder_MouseLeave"/>
<Style x:Key="BorderButtonWithText"
TargetType="Border">
<Setter Property="CornerRadius"
Value="5" />
<Setter Property="Background"
Value="{DynamicResource Color.AppBackground}" />
<Setter Property="Height"
Value="35" />
<EventSetter Event="MouseEnter"
Handler="ButtonBorder_MouseEnter" />
<EventSetter Event="MouseLeave"
Handler="ButtonBorder_MouseLeave" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource BackgroundColor.Menu.MainCategory}"/>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Border CornerRadius="10"
Padding="10"
Margin="0 0 0 10"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
VerticalAlignment="Top">
<Grid>
<uc:Badge Panel.ZIndex="999"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="10" />
<DockPanel>
<DockPanel LastChildFill="False" DockPanel.Dock="Top">
<Border CornerRadius="10"
Padding="10"
Margin="0 0 0 10"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
VerticalAlignment="Top">
<ico:AdaptableIcon
x:Name="HeadingIcon"
DockPanel.Dock="Left"
Style="{DynamicResource Menu.MenuBar.PinnedIcon.Base}"
VerticalAlignment="Center"
Margin="7.5 0 0 0"
BorderPadding="0"
IconHeight="15"
IconWidth="15"
SelectedInternIcon="{Binding QuickTipIcon.Intern, ElementName=QuickTipStatusMonitorUc}"
SelectedMaterialIcon="{Binding QuickTipIcon.Material, ElementName=QuickTipStatusMonitorUc}"/>
<DockPanel>
<DockPanel LastChildFill="False"
DockPanel.Dock="Top">
<TextBlock
x:Name="HeadingText"
Text="{Binding QuickTipName, ElementName=QuickTipStatusMonitorUc}"
DockPanel.Dock="Left"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="10" />
<ico:AdaptableIcon x:Name="HeadingIcon"
DockPanel.Dock="Left"
Style="{DynamicResource Menu.MenuBar.PinnedIcon.Base}"
VerticalAlignment="Center"
Margin="7.5 0 0 0"
BorderPadding="0"
IconHeight="15"
IconWidth="15"
SelectedInternIcon="{Binding QuickTipIcon.Intern, ElementName=QuickTipStatusMonitorUc}"
SelectedMaterialIcon="{Binding QuickTipIcon.Material, ElementName=QuickTipStatusMonitorUc}" />
<TextBlock x:Name="HeadingText"
Text="{Binding QuickTipName, ElementName=QuickTipStatusMonitorUc}"
DockPanel.Dock="Left"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="10" />
</DockPanel>
<Grid Margin="0,5,0,0"
DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.5*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="CompleteButton"
Grid.Column="1"
Style="{DynamicResource BorderButtonWithText}"
MouseLeftButtonUp="CompleteButton_Click"
TouchDown="CompleteButton_Click">
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Complete}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Border>
<Border x:Name="CancelButton"
Grid.Column="3"
Style="{DynamicResource BorderButtonWithText}"
MouseLeftButtonUp="CancelButton_Click"
TouchDown="CancelButton_Click">
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Cancel}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Border>
</Grid>
<TextBlock x:Name="StepCountTextBlock"
TextAlignment="Center"
Text="0 von 0 Schritten abgeschlossen"
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
DockPanel.Dock="Bottom" />
<ScrollViewer x:Name="QuickTipElementViewer"
VerticalScrollBarVisibility="Auto"
DockPanel.Dock="Top">
<StackPanel x:Name="QuickTipElementPanel">
</StackPanel>
</ScrollViewer>
</DockPanel>
<Grid Margin="0,5,0,0" DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border
x:Name="CompleteButton"
Grid.Column="1"
Style="{DynamicResource BorderButtonWithText}"
MouseLeftButtonUp="CompleteButton_Click"
TouchDown="CompleteButton_Click">
<TextBlock
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Complete}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<Border
x:Name="CancelButton"
Grid.Column="3"
Style="{DynamicResource BorderButtonWithText}"
MouseLeftButtonUp="CancelButton_Click"
TouchDown="CancelButton_Click">
<TextBlock
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Cancel}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
</Grid>
<TextBlock
x:Name="StepCountTextBlock"
TextAlignment="Center"
Text="0 von 0 Schritten abgeschlossen"
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
DockPanel.Dock="Bottom"/>
<ScrollViewer
x:Name="QuickTipElementViewer"
VerticalScrollBarVisibility="Auto"
DockPanel.Dock="Top">
<StackPanel
x:Name="QuickTipElementPanel">
</StackPanel>
</ScrollViewer>
</DockPanel>
</Border>
</Border>
</Grid>
</UserControl>

View File

@@ -1,4 +1,5 @@
using C4IT.FASD.Base;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using F4SD_AdaptableIcon;
using F4SD_AdaptableIcon.Enums;
@@ -254,7 +255,9 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
return;
bool wasSuccessfull = step.SuccessState == enumQuickActionSuccess.finished || step.SuccessState == enumQuickActionSuccess.successfull;
F4SDProtocoll.Instance.Add(new QuickTipStepProtocollEntry(step.StepData.QuickTipElementDefinition, wasSuccessfull));
ProtocollEntryBase protocollEntry = QuickTipStepProtocollEntryOutput.GetQuickTipStepProtocollEntry(step.StepData.QuickTipElementDefinition, wasSuccessfull);
F4SDProtocoll.Instance.Add(protocollEntry);
}
catch (Exception ex)
{

View File

@@ -173,7 +173,7 @@ namespace FasdDesktopUi.Basics.UserControls
}
SearchTextBox.Text = search;
await ChangedSearchValue.Invoke(_result);
await ChangedSearchValue?.Invoke(_result);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1911,7 +1911,7 @@ namespace FasdDesktopUi.Basics.UserControls
ResponsibleRole = selectedRole,
ResponsiblePerson = selectedPerson,
Comment = comment,
QuickActionHistory = TransferQuickActionHistoryCheck.IsChecked ?? false ? F4SDProtocoll.Instance.GetOfType<QuickActionProtocollEntry>().Select(e => e.GetResult()).ToList() : null,
SupportCaseProtocollEntries = TransferQuickActionHistoryCheck.IsChecked ?? false ? F4SDProtocoll.Instance.GetAll().ToList() : null,
workTimes = workingTimes,
StatusIdValue = statusIdValue,
CaseId = DataProvider.CaseId

View File

@@ -10,6 +10,7 @@ using System.Windows.Threading;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services;
using FasdDesktopUi.Basics.Services.Models;
using FasdDesktopUi.Pages.SearchPage;
namespace FasdDesktopUi.Basics.UserControls
@@ -217,36 +218,33 @@ namespace FasdDesktopUi.Basics.UserControls
private async Task RefreshCountsAsync(bool useRoleTickets)
{
var communication = cFasdCockpitCommunicationBase.Instance;
Dictionary<string, int> counts = null;
var service = TicketOverviewUpdateService.Instance;
var counts = CategorySetters.ToDictionary(item => item.Key, _ => 0);
if (communication != null)
if (service != null)
{
var tasks = CategorySetters.ToDictionary(
item => item.Key,
item => communication.GetTicketOverviewRelations(item.Key, useRoleTickets, 0));
foreach (var kvp in tasks)
try
{
try
{
var relations = await kvp.Value.ConfigureAwait(false);
counts[kvp.Key] = relations?.Count ?? 0;
}
catch (Exception ex)
{
Debug.WriteLine($"[TicketOverview] Failed to load count for '{kvp.Key}': {ex}");
counts[kvp.Key] = 0;
}
var scope = useRoleTickets ? TileScope.Role : TileScope.Personal;
await service.FetchAsync(scope).ConfigureAwait(false);
counts = service.GetCountsForScope(useRoleTickets);
}
catch (Exception ex)
{
Debug.WriteLine($"[TicketOverview] Service refresh failed: {ex}");
counts = null;
}
}
if (counts == null || counts.Count == 0)
counts = await LoadCountsFallbackAsync(useRoleTickets).ConfigureAwait(false);
await Dispatcher.InvokeAsync(() =>
{
foreach (var (key, setter) in CategorySetters)
{
setter(_viewModel, counts[key]);
counts.TryGetValue(key, out var value);
setter(_viewModel, value);
}
_viewModel.ResetSelection();
@@ -255,6 +253,34 @@ namespace FasdDesktopUi.Basics.UserControls
}, DispatcherPriority.Background);
}
private async Task<Dictionary<string, int>> LoadCountsFallbackAsync(bool useRoleTickets)
{
var counts = CategorySetters.ToDictionary(item => item.Key, _ => 0);
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
return counts;
var tasks = CategorySetters.ToDictionary(
item => item.Key,
item => communication.GetTicketOverviewRelations(item.Key, useRoleTickets, 0));
foreach (var kvp in tasks)
{
try
{
var relations = await kvp.Value.ConfigureAwait(false);
counts[kvp.Key] = relations?.Count ?? 0;
}
catch (Exception ex)
{
Debug.WriteLine($"[TicketOverview] Fallback load failed for '{kvp.Key}': {ex}");
counts[kvp.Key] = 0;
}
}
return counts;
}
public void UpdateCounts(IDictionary<string, int> counts, bool useRoleTickets)
{
if (counts == null)
@@ -272,6 +298,16 @@ namespace FasdDesktopUi.Basics.UserControls
}, DispatcherPriority.Background);
}
public void ClearHighlightsForScope(TileScope scope)
{
var highlightStates = scope == TileScope.Role ? _roleHighlightStates : _personalHighlightStates;
if (highlightStates.Count == 0)
return;
highlightStates.Clear();
UpdateHighlightState(scope == TileScope.Role);
}
public void SetHighlights(IEnumerable<TileCountChange> changes, bool useRoleTickets)
{
if (changes != null)

View File

@@ -26,55 +26,6 @@ namespace FasdDesktopUi.Basics
{
public static readonly IRawValueFormatter RawValueFormatter = new RawValueFormatter();
internal static RawValueType GetRawValueType(enumHealthCardDisplayTypes displayType)
{
switch (displayType)
{
case enumHealthCardDisplayTypes.STRING:
return RawValueType.STRING;
case enumHealthCardDisplayTypes.INTEGER:
return RawValueType.INTEGER;
case enumHealthCardDisplayTypes.PERCENT:
return RawValueType.PERCENT;
case enumHealthCardDisplayTypes.PERCENT100:
return RawValueType.PERCENT100;
case enumHealthCardDisplayTypes.PERCENT1000:
return RawValueType.PERCENT1000;
case enumHealthCardDisplayTypes.TIME:
return RawValueType.TIME;
case enumHealthCardDisplayTypes.DATE:
return RawValueType.DATE;
case enumHealthCardDisplayTypes.DATE_CALC:
return RawValueType.DATE_CALC;
case enumHealthCardDisplayTypes.DATETIME:
return RawValueType.DATETIME;
case enumHealthCardDisplayTypes.DURATION_DAY:
return RawValueType.DURATION_DAY;
case enumHealthCardDisplayTypes.DURATION_HOUR:
return RawValueType.DURATION_HOUR;
case enumHealthCardDisplayTypes.DURATION_MINUTE:
return RawValueType.DURATION_MINUTE;
case enumHealthCardDisplayTypes.DURATION_SECOND:
return RawValueType.DURATION_SECOND;
case enumHealthCardDisplayTypes.DURATION_MILLI:
return RawValueType.DURATION_MILLI;
case enumHealthCardDisplayTypes.DURATION_MICRO:
return RawValueType.DURATION_MICRO;
case enumHealthCardDisplayTypes.DURATION_DAY_SINCE_NOW:
return RawValueType.DURATION_DAY_SINCE_NOW;
case enumHealthCardDisplayTypes.BITS_PERSECOND:
return RawValueType.BITS_PERSECOND;
case enumHealthCardDisplayTypes.BYTES:
return RawValueType.BYTES;
case enumHealthCardDisplayTypes.HERTZ:
return RawValueType.HERTZ;
case enumHealthCardDisplayTypes.MEGA_HERTZ:
return RawValueType.MEGA_HERTZ;
default:
return RawValueType.STRING;
}
}
public static int SmoothedInt(int oldValue, int newValue)
{
if (oldValue < newValue)
@@ -410,24 +361,25 @@ namespace FasdDesktopUi.Basics
{
try
{
FormattingOptions options = new FormattingOptions() { ReferenceDate = DateTime.UtcNow.AddDays(_v.ReferenceDays) };
FormattingOptions options = new FormattingOptions() { ReferenceDate = DateTime.UtcNow.AddDays(_v.ReferenceDays), TimeZone = TimeZoneInfo.Local };
RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
var _strVal = RawValueFormatter.GetDisplayValue(_v.Value, GetRawValueType(_v.StateDefinition.DisplayType), options);
RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
var _strVal = RawValueFormatter.GetDisplayValue(_v.Value, _v.StateDefinition.DisplayType, options);
_t.rawValue.Text = _strVal;
if (_v.StateDefinition is cHealthCardStateLevel _sl)
{
_strVal = RawValueFormatter.GetDisplayValue(_sl.Warning, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sl.Warning, _v.StateDefinition.DisplayType, options);
_t.tresholdWarning.Text = _strVal;
_strVal = RawValueFormatter.GetDisplayValue(_sl.Error, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sl.Error, _v.StateDefinition.DisplayType, options);
_t.tresholdError.Text = _strVal;
}
else if (_v.StateDefinition is cHealthCardStateVersion _sv)
{
_strVal = RawValueFormatter.GetDisplayValue(_sv.Warning, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sv.Warning, _v.StateDefinition.DisplayType, options);
_t.tresholdWarning.Text = _strVal;
_strVal = RawValueFormatter.GetDisplayValue(_sv.Error, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sv.Error, _v.StateDefinition.DisplayType, options);
_t.tresholdError.Text = _strVal;
}
else if (_v.StateDefinition is cHealthCardStateDateTime _sd)