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

@@ -25,7 +25,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.1.0" newVersion="10.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@@ -3,10 +3,11 @@ using C4IT.FASD.Cockpit.Communication;
using C4IT.FASD.Security;
using C4IT.Graphics;
using C4IT.Logging;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Helper;
using FasdDesktopUi.Basics.Models;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Helper;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.Models;
using FasdDesktopUi.Pages.CustomMessageBox;
using FasdDesktopUi.Pages.PhoneSettingsPage;
using FasdDesktopUi.Pages.SearchPage;
@@ -35,10 +36,11 @@ namespace FasdDesktopUi
static public System.Windows.Forms.ToolStripItem M42OptionMenuItem = null;
public System.Windows.Forms.NotifyIcon notifyIcon = new System.Windows.Forms.NotifyIcon() { Text = $"First Aid Service Desk" };
public bool UseOsLanguage = string.IsNullOrEmpty(cFasdCockpitConfig.Instance.SelectedLanguage);
private TrayTicketNotificationManager _ticketTrayNotification;
public System.Windows.Forms.NotifyIcon notifyIcon = new System.Windows.Forms.NotifyIcon() { Text = $"First Aid Service Desk" };
public bool UseOsLanguage = string.IsNullOrEmpty(cFasdCockpitConfig.Instance.SelectedLanguage);
private TrayTicketNotificationManager _ticketTrayNotification;
private TileScope? _pendingTicketOverviewScope;
private async void Application_Startup(object sender, StartupEventArgs e)
{
@@ -166,42 +168,50 @@ namespace FasdDesktopUi
}
private void NotifyIcon_Click(object sender, EventArgs e)
{
try
{
if (e is System.Windows.Forms.MouseEventArgs mouseEventArgs)
if (mouseEventArgs.Button == System.Windows.Forms.MouseButtons.Right)
return;
private void NotifyIcon_Click(object sender, EventArgs e)
{
try
{
if (e is System.Windows.Forms.MouseEventArgs mouseEventArgs)
if (mouseEventArgs.Button == System.Windows.Forms.MouseButtons.Right)
return;
var searchView = SearchPageView.Instance;
if (searchView == null)
return;
#if isDemo
var hasNotification = HasPendingTicketOverviewNotification();
if (searchView.IsVisible && !hasNotification)
{
searchView.Hide();
return;
}
if (!searchView.IsVisible)
searchView.ActivateSearchView();
else
searchView.BringToFrontPreserveState();
searchView.ShowTicketOverviewPane();
if (hasNotification)
ClearTicketOverviewTrayNotification();
#else
if (SearchPageView.Instance.IsVisible)
SearchPageView.Instance.Hide();
else
SearchPageView.Instance.ActivateSearchView();
var searchView = SearchPageView.Instance;
if (searchView == null)
return;
var hasNotification = HasPendingTicketOverviewNotification();
if (hasNotification)
{
if (!searchView.IsVisible)
searchView.ActivateSearchView();
else
searchView.BringToFrontPreserveState();
searchView.ShowTicketOverviewPaneForScope(PendingTicketOverviewScope);
ClearTicketOverviewTrayNotification();
return;
}
#if isDemo
if (searchView.IsVisible)
{
searchView.Hide();
return;
}
if (!searchView.IsVisible)
searchView.ActivateSearchView();
else
searchView.BringToFrontPreserveState();
searchView.ShowTicketOverviewPane();
#else
if (SearchPageView.Instance.IsVisible)
SearchPageView.Instance.Hide();
else
SearchPageView.Instance.ActivateSearchView();
#endif
}
catch (Exception E)
@@ -271,48 +281,56 @@ namespace FasdDesktopUi
}
}
private void NotifyIcon_BalloonTipClicked(object sender, EventArgs e)
{
try
{
SearchPageView.Instance?.BringToFrontPreserveState();
SearchPageView.Instance?.ShowTicketOverviewPane();
ClearTicketOverviewTrayNotification();
}
catch (Exception E)
{
LogException(E);
}
}
private void NotifyIcon_BalloonTipClicked(object sender, EventArgs e)
{
try
{
SearchPageView.Instance?.BringToFrontPreserveState();
SearchPageView.Instance?.ShowTicketOverviewPaneForScope(PendingTicketOverviewScope);
ClearTicketOverviewTrayNotification();
}
catch (Exception E)
{
LogException(E);
}
}
private bool HasPendingTicketOverviewNotification()
{
return _ticketTrayNotification?.HasNotification ?? false;
}
public void ShowTicketOverviewTrayNotification(string message)
{
try
{
_ticketTrayNotification?.Show(message);
}
public void ShowTicketOverviewTrayNotification(string message)
{
try
{
_ticketTrayNotification?.Show(message);
}
catch (Exception ex)
{
LogException(ex);
}
}
public void ClearTicketOverviewTrayNotification()
{
try
{
_ticketTrayNotification?.Clear();
}
catch (Exception ex)
{
LogException(ex);
}
}
public void ClearTicketOverviewTrayNotification()
{
try
{
_pendingTicketOverviewScope = null;
_ticketTrayNotification?.Clear();
}
catch (Exception ex)
{
LogException(ex);
}
}
public void SetTicketOverviewNotificationScope(TileScope? scope)
{
_pendingTicketOverviewScope = scope;
}
public TileScope? PendingTicketOverviewScope => _pendingTicketOverviewScope;
private System.Windows.Forms.ToolStripItem SetUpNotifyIconLanguageOption()
{

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)

View File

@@ -71,6 +71,11 @@
<Language Lang="DE">Als angedocktes Fenster anzeigen</Language>
</UIItem>
<UIItem Name="Global.NavBar.ShowRawValues">
<Language Lang="EN">Show raw values of healthcard</Language>
<Language Lang="DE">Rohwerte der Healthcard anzeigen</Language>
</UIItem>
<UIItem Name="Global.Time.Suffix">
<Language Lang="EN"></Language>
<Language Lang="DE"> Uhr</Language>
@@ -96,7 +101,35 @@
<Language Lang="DE">Nicht erneut anzeigen</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Unknown">
<Language Lang="EN">All</Language>
<Language Lang="DE">Alle</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Main">
<Language Lang="EN">Main Information</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.F4sdAgent">
<Language Lang="EN">F4SD Agent</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.NexthinkNxql">
<Language Lang="EN">Nexthink NXQL</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.ActiveDirectory">
<Language Lang="EN">Active Directory</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.AzureAD">
<Language Lang="EN">Azure AD</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.M42Wpm">
<Language Lang="EN">Matrix42 WPM</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Intune">
<Language Lang="EN">MS Intune</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Citrix">
<Language Lang="EN">Citrix</Language>
</UIItem>
<UIItem Name="App.Startup.SecurityInitFailed.Text">
<Language Lang="EN">The RSA encryption could not be initialised correctly. The cockpit will be closed.</Language>
<Language Lang="DE">Die RSA Verschlüsselung konnte nicht korrekt initialisiert werden. Das Cockpit wird beendet.</Language>
@@ -1355,10 +1388,10 @@
<Language Lang="DE">Kategorie</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.Save">
<Language Lang="EN">Save</Language>
<Language Lang="DE">Speichern</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.Save">
<Language Lang="EN">Save</Language>
<Language Lang="DE">Speichern</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.Abort">
<Language Lang="EN">Cancel</Language>
@@ -1578,21 +1611,21 @@
<Language Lang="DE">Fehler: </Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorSummaryEmpty">
<Language Lang="EN">Fill summary</Language>
<Language Lang="DE">Zusammenfassung angeben</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorCategoryEmpty">
<Language Lang="EN">Select a category</Language>
<Language Lang="DE">Kategorie auswählen</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorQuickCallEmpty">
<Language Lang="EN">Select a quickcall template</Language>
<Language Lang="DE">Quickcall auswählen</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorSolutionEmpty">
<Language Lang="EN">Fill solution</Language>
<UIItem Name="Dialog.CloseCase.ValidationErrorSummaryEmpty">
<Language Lang="EN">Fill summary</Language>
<Language Lang="DE">Zusammenfassung angeben</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorCategoryEmpty">
<Language Lang="EN">Select a category</Language>
<Language Lang="DE">Kategorie auswählen</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorQuickCallEmpty">
<Language Lang="EN">Select a quickcall template</Language>
<Language Lang="DE">Quickcall auswählen</Language>
</UIItem>
<UIItem Name="Dialog.CloseCase.ValidationErrorSolutionEmpty">
<Language Lang="EN">Fill solution</Language>
<Language Lang="DE">Lösung angeben</Language>
</UIItem>

View File

@@ -91,32 +91,58 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="C4IT.F4SD.DisplayFormatting, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.DisplayFormatting.0.0.1-preview-0.0.2\lib\netstandard2.0\C4IT.F4SD.DisplayFormatting.dll</HintPath>
<Reference Include="C4IT.F4SD.DisplayFormatting, Version=1.0.9509.21303, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.DisplayFormatting.1.0.0\lib\netstandard2.0\C4IT.F4SD.DisplayFormatting.dll</HintPath>
</Reference>
<Reference Include="C4IT.F4SD.SupportCaseProtocoll, Version=1.0.9516.21165, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.SupportCaseProtocoll.1.0.0\lib\netstandard2.0\C4IT.F4SD.SupportCaseProtocoll.dll</HintPath>
</Reference>
<Reference Include="MaterialIcons, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialIcons.1.0.3\lib\MaterialIcons.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=3.1.32.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.3.1.32\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Framework, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.3240.44, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3240.44\lib\net462\Microsoft.Web.WebView2.Core.dll</HintPath>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.3240.44, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3240.44\lib\net462\Microsoft.Web.WebView2.WinForms.dll</HintPath>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.3240.44, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3240.44\lib\net462\Microsoft.Web.WebView2.Wpf.dll</HintPath>
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.3650.58, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3650.58\lib\net462\Microsoft.Web.WebView2.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.3650.58, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3650.58\lib\net462\Microsoft.Web.WebView2.WinForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.3650.58, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3650.58\lib\net462\Microsoft.Web.WebView2.Wpf.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
@@ -151,6 +177,9 @@
</Compile>
<Compile Include="AppStartUp.cs" />
<Compile Include="Basics\Browser.cs" />
<Compile Include="Basics\CustomEvents\HeadingDataEventArgs.cs" />
<Compile Include="Basics\Services\SupportCase\Controllers\SupportCaseController.cs" />
<Compile Include="Basics\Services\SupportCase\Controllers\SupportCaseHeadingController.cs" />
<Compile Include="Basics\ExternalToolExecutorEnh.cs" />
<Compile Include="Basics\Converter\BoolOrToVisibilityConverter.cs" />
<Compile Include="Basics\Converter\DataCanvasIsCloseButtonVisibileConverter.cs" />
@@ -173,18 +202,19 @@
<Compile Include="Basics\Models\TicketOverviewSelectionRequestedEventArgs.cs" />
<Compile Include="Basics\SearchHistoryManager.cs" />
<Compile Include="Basics\Services\ProtocollService\F4SDProtocoll.cs" />
<Compile Include="Basics\Services\ProtocollService\IProtocollEntry.cs" />
<Compile Include="Basics\Services\ProtocollService\QuickActionProtocollEntry.cs" />
<Compile Include="Basics\Services\ProtocollService\QuickTipStepProtocollEntry.cs" />
<Compile Include="Basics\Services\ProtocollService\TextualProtocollEntry.cs" />
<Compile Include="Basics\Services\RelationService\IRelationService.cs" />
<Compile Include="Basics\Services\RelationService\RelationService.cs" />
<Compile Include="Basics\Services\RelationService\RelationEventArgs.cs" />
<Compile Include="Basics\CustomEvents\RelationEventArgs.cs" />
<Compile Include="Basics\Services\RelationService\StagedSearchResultRelationsEventArgs.cs" />
<Compile Include="Basics\Services\SupportCaseSearchService\SupportCaseSearchService.cs" />
<Compile Include="Basics\Services\SupportCase\ISupportCase.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCase.cs" />
<Compile Include="Basics\CustomEvents\SupportCaseDataEventArgs.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCaseFactory.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCaseProcessor.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCaseProcessorFactory.cs" />
<Compile Include="Basics\SupportCaseDataProvider.cs" />
<Compile Include="Basics\Enums\enumActionDisplayType.cs" />
<Compile Include="Basics\Helper\DirectConnectionHelper.cs" />
@@ -234,13 +264,18 @@
<Compile Include="Basics\UiActions\UiQuickTipAction.cs" />
<Compile Include="Basics\UiActions\UiRemoteQuickAction.cs" />
<Compile Include="Basics\UiActions\UiServerQuickAction.cs" />
<Compile Include="Basics\UiActions\UiShowRawHealthcardValues.cs" />
<Compile Include="Basics\UiActions\UiSystemDefaultQuickAction.cs" />
<Compile Include="Basics\UserControls\BlurInvokerContainer.xaml.cs">
<DependentUpon>BlurInvokerContainer.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\ComboBoxPageAble.xaml.cs">
<DependentUpon>ComboBoxPageAble.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\Badge.xaml.cs">
<DependentUpon>Badge.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\BlurInvokerContainer.xaml.cs">
<DependentUpon>BlurInvokerContainer.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\ComboBoxPageAble.xaml.cs">
<DependentUpon>ComboBoxPageAble.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\HierarchicalSelectionControl.xaml.cs">
<DependentUpon>HierarchicalSelectionControl.xaml</DependentUpon>
</Compile>
@@ -340,6 +375,12 @@
<DependentUpon>CustomMessageBox.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\CustomPopupBase.cs" />
<Compile Include="Pages\RawHealthCardValuesPage\RawHealthCardValuesPage.xaml.cs">
<DependentUpon>RawHealthCardValuesPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SearchPage\SearchPageView.xaml.cs">
<DependentUpon>SearchPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SplashScreenView\IntroView.xaml.cs">
<DependentUpon>IntroView.xaml</DependentUpon>
</Compile>
@@ -398,9 +439,6 @@
<Compile Include="Pages\SettingsPage\PhoneSettingsPage.xaml.cs">
<DependentUpon>PhoneSettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SearchPage\SearchPageView.xaml.cs">
<DependentUpon>SearchPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPage\M42SettingsPageView.xaml.cs">
<DependentUpon>M42SettingsPageView.xaml</DependentUpon>
</Compile>
@@ -443,6 +481,10 @@
<Compile Include="Pages\SlimPage\UserControls\SlimPageWidgetCollection.xaml.cs">
<DependentUpon>SlimPageWidgetCollection.xaml</DependentUpon>
</Compile>
<Page Include="Basics\UserControls\Badge.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Basics\UserControls\BlurInvokerContainer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -701,13 +743,17 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SettingsPage\PhoneSettingsPage.xaml">
<Page Include="Pages\RawHealthCardValuesPage\RawHealthCardValuesPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SearchPage\SearchPageView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SearchPage\SearchPageView.xaml">
<SubType>Designer</SubType>
<Page Include="Pages\SettingsPage\PhoneSettingsPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SettingsPage\M42SettingsPageView.xaml">
<SubType>Designer</SubType>
@@ -854,15 +900,6 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="..\..\C4IT FASD\_Common\XmlSchemas\LanguageDefinitions.xsd">
<Link>Config\LanguageDefinitions.xsd</Link>
<SubType>Designer</SubType>
@@ -993,6 +1030,7 @@
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == BuildToTeams powershell.exe -ExecutionPolicy remotesigned -file "$(SolutionDir)BuildToTeams.ps1" -DirectoryToZip "$(SolutionDir)\FasdDesktopUi\bin\Release"</PostBuildEvent>
@@ -1008,11 +1046,11 @@ taskkill -im "F4SD-Cockpit-Client.exe" -f -FI "STATUS eq RUNNING"
<PropertyGroup>
<PreBuildEvent>copy "$(ProjectDir)..\..\C4IT FASD\_Common\XmlSchemas\LanguageDefinitions.xsd" "$(ProjectDir)Config"</PreBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets')" />
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets'))" />
</Target>
</Project>

View File

@@ -90,12 +90,11 @@
<Border x:Name="DialogCloseElement"
x:FieldModifier="private"
DockPanel.Dock="Bottom"
Width="{Binding ElementName=WindowStateBarUserControl, Path=ActualWidth}"
HorizontalAlignment="Right"
Cursor="Hand"
CornerRadius="5"
Margin="0 2.5 7.5 -30"
Padding="0 2.5"
Padding="10 2.5"
Background="{DynamicResource BackgroundColor.DetailsPage.Widget.Value}"
MouseLeftButtonUp="CloseCaseWithTicketIcon_MouseLeftButtonUp"
TouchDown="CloseCaseWithTicketIcon_TouchDown">
@@ -220,8 +219,7 @@
<uc:DetailsPageWidgetCollection x:Name="WidgetCollection"
Grid.Row="1"
Margin="0 35 0 10"
WidgetGeometryList="{Binding WidgetGeometryList}"
WidgetDataList="{Binding WidgetDataList}" />
WidgetGeometryList="{Binding WidgetGeometryList}" />
<uc:DetailsPageRefreshControl x:Name="RefreshControl"
Grid.Row="2"

View File

@@ -31,8 +31,7 @@ using static C4IT.Logging.cLogManager;
using F4SD_AdaptableIcon.Enums;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Converter;
using FasdDesktopUi.Basics.Services.SupportCase;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
namespace FasdDesktopUi.Pages.DetailsPage
{
@@ -54,7 +53,9 @@ namespace FasdDesktopUi.Pages.DetailsPage
private bool isQuickActionDecoratorVisible = false;
private bool isNotepadDecoratorVisible = false;
private DispatcherTimer midnightTimer = new DispatcherTimer();
private readonly DispatcherTimer _midnightTimer = new DispatcherTimer();
private double _lastDesiredHeightOfWidgetCollection = 0; // to avoid resizing the main grid on every data changed event
#region Notepad
@@ -131,9 +132,9 @@ namespace FasdDesktopUi.Pages.DetailsPage
try
{
InitializeComponent();
midnightTimer.Interval = TimeSpan.FromSeconds(1);
midnightTimer.Tick += MidnightTimer_Tick;
midnightTimer.Start();
_midnightTimer.Interval = TimeSpan.FromSeconds(1);
_midnightTimer.Tick += MidnightTimer_Tick;
_midnightTimer.Start();
SupportNotepad = true;
var _screen = System.Windows.Forms.Screen.PrimaryScreen;
@@ -159,44 +160,150 @@ namespace FasdDesktopUi.Pages.DetailsPage
BlurInvoker.BlurInvokerVisibilityChanged -= (obj, e) => UpdateBlurStatus(obj);
}
public override void SetSupportCase(ISupportCase supportCase)
internal override void SetSupportCaseController(SupportCaseController supportCaseController)
{
if (_supportCase != null)
_supportCase.CaseRelationsAdded -= HandleCaseRelationsAdded;
if (_supportCaseController != null)
UnsubscribeEventsOf(_supportCaseController);
supportCase.CaseRelationsAdded += HandleCaseRelationsAdded;
base.SetSupportCase(supportCase);
ResetPageToDefaultState();
SubscribeEventsOf(supportCaseController);
base.SetSupportCaseController(supportCaseController);
NavigationHeadingUc.SupportCaseController = supportCaseController;
IsBlurred = true;
RefreshControl.DataProvider = supportCase.SupportCaseDataProviderArtifact;
NavigationHeadingUc.DataProvider = supportCase.SupportCaseDataProviderArtifact;
RefreshControl.DataProvider = supportCaseController.SupportCaseDataProviderArtifact;
NavigationHeadingUc.DataProvider = supportCaseController.SupportCaseDataProviderArtifact;
cSupportCaseDataProvider.CaseChanged += DataProvider_CaseChanged;
RefreshControl.IsDataIncomplete = true;
RefreshControl.LoadingDataIndicatorUc.LoadingText = cMultiLanguageSupport.GetItem("DetailsPage.Loading");
CustomizableSectionUc.IsDataIncomplete = true;
supportCase.SupportCaseDataProviderArtifact.NotepadDocumentUpdated += ResetNotepadNotification;
supportCaseController.SupportCaseDataProviderArtifact.NotepadDocumentUpdated += ResetNotepadNotification;
void SubscribeEventsOf(SupportCaseController controller)
{
controller.AvailableCaseRelationsAdded += HandleAvailableRelationsAdded;
controller.FocusedRelationsChanged += HandleFocusedRelationsChanged;
controller.CaseDataChanged += HandleCaseDataChanged;
controller.HeadingDataChanged += HandleHeadingDataChanged;
}
void UnsubscribeEventsOf(SupportCaseController controller)
{
controller.AvailableCaseRelationsAdded -= HandleAvailableRelationsAdded;
controller.FocusedRelationsChanged -= HandleFocusedRelationsChanged;
controller.CaseDataChanged -= HandleCaseDataChanged;
controller.HeadingDataChanged -= HandleHeadingDataChanged;
}
}
private async void HandleCaseRelationsAdded(object sender, RelationEventArgs e)
private void HandleAvailableRelationsAdded(object sender, RelationEventArgs e)
{
await Dispatcher.Invoke(async () =>
}
private void HandleFocusedRelationsChanged(object sender, RelationEventArgs e)
{
IsBlurred = false;
_supportCaseController.SupportCaseDataProviderArtifact.Identities = e.Relations.FirstOrDefault()?.FirstOrDefault()?.Identities; // todo remove when ShowDetailedDataAction is not dependent on Artifact anymore
Dispatcher.Invoke(() =>
{
NavigationHeadingUc.HeadingData = _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.GetHeadingDataWithoutOnlineStatus();
NavigationHeadingUc.HeadingData = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.UpdateOnlineStatusAsync();
ResetPageToDefaultState();
UpdateHealthcardSectionVisibilities();
HandleCaseDataChanged(null, null);
});
}
private void HandleHeadingDataChanged(object sender, HeadingDataEventArgs e)
{
Dispatcher.Invoke(() => NavigationHeadingUc.HeadingData = e.NewValue.ToList());
}
// todo update NavigationHeadingUc_HeadingIconClickedEvent as soon as EventArgs are taken into account
private void HandleCaseDataChanged(object sender, SupportCaseDataEventArgs e)
{
try
{
if (isDataChangedEventRunning)
{
shouldReRunDataChangedEvent = true;
return;
}
isDataChangedEventRunning = true;
Dispatcher.Invoke(() =>
{
if (QuickActionDecorator.Child is DataCanvas dataCanvas)
Dispatcher.Invoke(async () => await dataCanvas.UpdateDataAsync());
if (WidgetCollection.WidgetDataList is null || WidgetCollection.WidgetDataList.Count == 0)
WidgetCollection.WidgetDataList = _supportCaseController?.GetWidgetData();
WidgetCollection.UpdateWidgetData(_supportCaseController?.GetWidgetData());
if (DataHistoryCollectionUserControl.HistoryDataList is null || DataHistoryCollectionUserControl.HistoryDataList.Count == 0)
DataHistoryCollectionUserControl.HistoryDataList = _supportCaseController?.GetHistoryData();
DataHistoryCollectionUserControl.UpdateHistory(_supportCaseController?.GetHistoryData());
if (CustomizableSectionUc.ContainerCollections is null || CustomizableSectionUc.ContainerCollections.Count == 0)
CustomizableSectionUc.ContainerCollections = _supportCaseController?.GetContainerData();
CustomizableSectionUc.UpdateContainerCollection(_supportCaseController?.GetContainerData());
if (this.DataContext is DetailsPageViewModel viewModel)
viewModel.MenuBarData = _supportCaseController?.GetMenuBarData();
if (_lastDesiredHeightOfWidgetCollection != WidgetCollection.DesiredSize.Height)
{
_lastDesiredHeightOfWidgetCollection = WidgetCollection.DesiredSize.Height;
MainGrid.InvalidateMeasure();
MainGrid.UpdateLayout();
}
});
if (shouldReRunDataChangedEvent)
HandleCaseDataChanged(sender, e);
}
finally
{
isDataChangedEventRunning = false;
shouldReRunDataChangedEvent = false;
}
}
/// <summary>
/// Sets the visibility of History and Customizable Section based on the currently selected Healthcard.
/// </summary>
internal void UpdateHealthcardSectionVisibilities()
{
try
{
cHealthCard selectedHealthcard = _supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.SelectedHealthCard;
bool showHistorySection = selectedHealthcard.CategoriesHistory?.StateCategories != null && selectedHealthcard.CategoriesHistory.StateCategories.Count > 0;
Dispatcher.Invoke(() =>
{
DataHistoryCollectionUserControl.Visibility = showHistorySection ? Visibility.Visible : Visibility.Collapsed;
CustomizableSectionUc.Visibility = showHistorySection ? Visibility.Collapsed : Visibility.Visible;
});
}
catch (Exception ex)
{
LogException(ex);
}
}
private void ReinitializeNotepad()
{
if (SupportNotepad == true)
{
notepad = new Notepad(_supportCase?.SupportCaseDataProviderArtifact);
notepad = new Notepad(_supportCaseController?.SupportCaseDataProviderArtifact);
ChangeNotepadNotification();
NotepadDecorator.Child = notepad;
NotepadDecorator.Visibility = Visibility.Collapsed;
@@ -319,31 +426,34 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
Panel.SetZIndex(NavigationHeadingUc, 1);
NavigationHeadingUc.ResetSelectors();
if (cConnectionStatusHelper.Instance?.ApiConnectionStatus == cConnectionStatusHelper.enumOnlineStatus.online)
Dispatcher.Invoke(() =>
{
SearchBarUserControl.Visibility = Visibility.Collapsed;
SearchBarUserControl.Clear();
MenuBarUserControl.Visibility = Visibility.Visible;
}
Panel.SetZIndex(NavigationHeadingUc, 1);
NavigationHeadingUc.ResetSelectors();
SearchResultBorder.Visibility = Visibility.Collapsed;
OverlayBorder.Child = null;
OverlayBorder.Visibility = Visibility.Collapsed;
if (BlurInvokers?.Count > 0)
{
foreach (var blurInvoker in BlurInvokers.ToArray())
if (cConnectionStatusHelper.Instance?.ApiConnectionStatus == cConnectionStatusHelper.enumOnlineStatus.online)
{
if (blurInvoker is Window blurInvokerWindow)
blurInvokerWindow.Hide();
SearchBarUserControl.Visibility = Visibility.Collapsed;
SearchBarUserControl.Clear();
MenuBarUserControl.Visibility = Visibility.Visible;
}
}
IsBlurred = BlurInvokers?.Count > 0;
SearchResultBorder.Visibility = Visibility.Collapsed;
OverlayBorder.Child = null;
OverlayBorder.Visibility = Visibility.Collapsed;
if (BlurInvokers?.Count > 0)
{
foreach (var blurInvoker in BlurInvokers.ToArray())
{
if (blurInvoker is Window blurInvokerWindow)
blurInvokerWindow.Hide();
}
}
IsBlurred = BlurInvokers?.Count > 0;
});
}
catch (Exception E)
{
@@ -450,21 +560,8 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
Dispatcher.Invoke(() =>
{
NavigationHeadingUc.IsHitTestVisible = false;
NavigationHeadingUc.Opacity = 0.7;
});
RefreshControl.IsDataIncomplete = true;
List<Task> tasks = new List<Task>
{
_supportCase?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.UpdateOnlineStatusAsync(),
_supportCase?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.LoadingHelper?.RefreshLatestDataAsync()
};
await Task.WhenAll(tasks);
await _supportCaseController.RefreshDataForCurrentlyFocusedRelationAsync();
RefreshControl.UpdateLastDataRequestTime();
RefreshControl.IsDataIncomplete = false;
}
@@ -495,6 +592,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
case cChangeHealthCardAction _:
case cShowHeadingSelectionMenuAction _:
case UiShowRawHealthcardValues _:
break;
case cUiQuickAction _:
case cShowRecommendationAction _:
@@ -515,7 +613,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
break;
}
await e.UiAction.RunUiActionAsync(e.OriginalSource, drawingArea, true, _supportCase?.SupportCaseDataProviderArtifact);
await e.UiAction.RunUiActionAsync(e.OriginalSource, drawingArea, true, _supportCaseController?.SupportCaseDataProviderArtifact);
UpdateHistoryWidth();
}
catch (Exception E)
@@ -545,21 +643,13 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
if (isDataProviderLoading)
return;
if (!(sender is FrameworkElement senderElement))
return;
if (!(senderElement.Tag is enumFasdInformationClass informationClassTag))
if (!(senderElement.Tag is cF4sdApiSearchResultRelation selectedRelation))
return;
if (_supportCase?.SupportCaseDataProviderArtifact is null || !_supportCase.SupportCaseDataProviderArtifact.Identities.Any(identity => identity.Class == informationClassTag))
return;
Mouse.OverrideCursor = Cursors.Wait;
await _supportCase?.SupportCaseDataProviderArtifact.ChangeHealthCardAsync(informationClassTag);
_supportCaseController.UpdateFocusedCaseRelation(selectedRelation);
}
catch (Exception E)
{
@@ -654,7 +744,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
private void F4SDIcon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
CustomMessageBox.CustomMessageBox.Show("1. Have you tried turning it off and on again?\n2. Are you sure it is plugged in?", "How to solve (almost) any computer problem", enumHealthCardStateLevel.Info, this);
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.IsInEditMode = true;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.IsInEditMode = true;
}
#region CloseCaseWithTicketIcon_Click
@@ -701,17 +791,14 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
if (!(e.NewValue is bool isVisible))
if (!(e.NewValue is bool isVisible && isVisible))
return;
if (isVisible)
{
Show();
Activate();
Focus();
if (IsWindowLoaded)
WindowState = WindowState.Maximized;
}
Show();
Activate();
Focus();
if (IsWindowLoaded)
WindowState = WindowState.Maximized;
}
catch (Exception E)
{
@@ -936,7 +1023,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
LogMethodBegin(CM);
try
{
LogEntry($"DataChanged - DataProvider for Class: {_supportCase?.SupportCaseDataProviderArtifact.Identities[0].Class} - Id: {_supportCase?.SupportCaseDataProviderArtifact.Identities[0].Id}");
LogEntry($"DataChanged - DataProvider for Class: {_supportCaseController?.SupportCaseDataProviderArtifact.Identities[0].Class} - Id: {_supportCaseController?.SupportCaseDataProviderArtifact.Identities[0].Id}");
if (isDataChangedEventRunning)
{
@@ -949,21 +1036,6 @@ namespace FasdDesktopUi.Pages.DetailsPage
if (!(e is BooleanEventArgs booleanArg) || booleanArg.BooleanArg == false)
isDataProviderLoading = true;
var data = _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataWithoutHeading();
await Dispatcher.Invoke(async () =>
{
NavigationHeadingUc.HeadingData = _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.GetHeadingDataWithoutOnlineStatus();
NavigationHeadingUc.HeadingData = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.UpdateOnlineStatusAsync();
});
Dispatcher.Invoke(() => { WidgetCollection.UpdateWidgetData(data.WidgetData); });
Dispatcher.Invoke(() => DataHistoryCollectionUserControl.UpdateHistory(data.DataHistoryList));
Dispatcher.Invoke(() => CustomizableSectionUc.UpdateContainerCollection(data.DataContainerCollectionList));
Dispatcher.Invoke(() =>
{
if (DataContext is DetailsPageViewModel viewModel)
viewModel.SetPropertyValues(data);
});
Dispatcher.Invoke(UpdateHistoryWidth);
@@ -1023,7 +1095,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
Dispatcher.Invoke(() =>
{
bool hasDirectConnection = _supportCase?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
bool hasDirectConnection = _supportCaseController?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
NavigationHeadingUc.HasDirectConnection = hasDirectConnection;
if (hasDirectConnection)
@@ -1295,7 +1367,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
private void ChangeNotepadNotification()
{
FlowDocument document = _supportCase?.SupportCaseDataProviderArtifact.CaseNotes;
FlowDocument document = _supportCaseController?.SupportCaseDataProviderArtifact.CaseNotes;
bool isFlowDocumentEmpty = !document.Blocks.Any(block =>
{
if (block is Paragraph paragraph)
@@ -1358,22 +1430,16 @@ namespace FasdDesktopUi.Pages.DetailsPage
BlurBorder_Click();
MenuBarUserControl.Visibility = Visibility.Visible;
SearchBarUserControl.Visibility = Visibility.Collapsed;
QuickActionSelectorUc.QuickActionList = null;
QuickActionSelectorUc.Visibility = Visibility.Collapsed;
QuickActionDecorator.Child.Visibility = Visibility.Collapsed;
NotepadDecorator.Visibility = Visibility.Collapsed;
NotepadDecorator.Child = null;
notepad = null;
isQuickActionDecoratorVisible = false;
isQuickActionSelectorVisible = false;
if (IsLoaded)
ReinitializeNotepad();
DataHistoryCollectionUserControl.ToggleVerticalCollapseDetails(true);
UpdateHistoryWidth();
}
@@ -1383,64 +1449,6 @@ namespace FasdDesktopUi.Pages.DetailsPage
}
}
public void SetPropertyValues(cDetailsPageData detailPageData)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
if (DataContext is DetailsPageViewModel viewModel)
{
viewModel.SetPropertyValues(detailPageData);
NavigationHeadingUc.HeadingData = detailPageData.HeadingData;
ResetPageToDefaultState();
if (detailPageData.DataHistoryList?.Count > 0)
{
CustomizableSectionUc.Visibility = Visibility.Collapsed;
DataHistoryCollectionUserControl.Visibility = Visibility.Visible;
DataHistoryCollectionUserControl.HistoryDataList = detailPageData.DataHistoryList;
DataHistoryCollectionUserControl.DataProvider = _supportCase?.SupportCaseDataProviderArtifact;
QuickActionSelectorUc.IsLocked = cFasdCockpitConfig.Instance.IsHistoryQuickActionSelectorVisible;
if (cFasdCockpitConfig.Instance.IsHistoryQuickActionSelectorVisible)
MoreButtonClickedAction();
}
else if (detailPageData.DataContainerCollectionList?.Count > 0)
{
DataHistoryCollectionUserControl.Visibility = Visibility.Collapsed;
CustomizableSectionUc.Visibility = Visibility.Visible;
CustomizableSectionUc.ContainerCollections = detailPageData.DataContainerCollectionList;
var ticketMenuData = detailPageData.MenuBarData.FirstOrDefault(menuData => menuData.MenuText == "Ticket");
if (ticketMenuData != null)
if (ticketMenuData is cMenuDataContainer containerMenuData)
{
QuickActionSelectorUc.QuickActionSelectorHeading = containerMenuData.MenuText;
QuickActionSelectorUc.QuickActionList = containerMenuData.SubMenuData;
}
QuickActionSelectorUc.IsLocked = cFasdCockpitConfig.Instance.IsCustomizableQuickActionSelectorVisible;
if (cFasdCockpitConfig.Instance.IsCustomizableQuickActionSelectorVisible)
QuickActionSelectorUc.Visibility = Visibility.Visible;
}
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
#endregion
#region DataHistoryCollection
@@ -1589,9 +1597,9 @@ namespace FasdDesktopUi.Pages.DetailsPage
try
{
midnightTimer.Stop();
_midnightTimer.Stop();
var from = _supportCase?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.LoadingHelper?.LastDataRequest;
var from = _supportCaseController?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.LoadingHelper?.LastDataRequest;
if (from == null)
{
@@ -1618,7 +1626,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
}
finally
{
midnightTimer.Start();
_midnightTimer.Start();
}

View File

@@ -1,19 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Pages.DetailsPage.Models;
using FasdDesktopUi.Basics;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
@@ -48,56 +39,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
#endregion
#region Header Properties
#region PageTitle Property
private string pageTitle;
public string PageTitle
{
get { return pageTitle; }
set
{
pageTitle = value;
OnPropertyChanged();
}
}
#endregion
#region HeadingData Property
private List<cHeadingDataModel> headingData;
public List<cHeadingDataModel> HeadingData
{
get { return headingData; }
set
{
headingData = value;
OnPropertyChanged();
}
}
#endregion
#endregion
#region Widget Properties
#region WidgetData Property
private List<List<cWidgetValueModel>> widgetDataList;
public List<List<cWidgetValueModel>> WidgetDataList
{
get { return widgetDataList; }
set
{
widgetDataList = value;
OnPropertyChanged();
}
}
#endregion
#region WidgetGeometry Property
private List<DetailsPageWidgetGeometryModel> widgetGeometryList;
public List<DetailsPageWidgetGeometryModel> WidgetGeometryList
@@ -112,8 +53,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
#endregion
#endregion
#region Details Properties
#region TimeSinceLastRefresh property
@@ -145,21 +84,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
#endregion
#region DetailsData property
private cDetailsPageDataHistoryDataModel detailsDataList;
public cDetailsPageDataHistoryDataModel DetailsDataList
{
get { return detailsDataList; }
set
{
detailsDataList = value;
OnPropertyChanged();
}
}
#endregion
#region ShownValueColumnsCount
public int ShownValueColumnsCount
{
@@ -245,39 +169,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
}
}
public void SetPropertyValues(cDetailsPageData propertyValues)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
DataProvider = propertyValues.DataProvider;
//Heading Properties
HeadingData = propertyValues.HeadingData;
//Widget Properties
WidgetDataList = propertyValues.WidgetData;
//Details Properties
TimeSinceLastRefresh = propertyValues.TimeSinceLastRefresh;
ShownValueColumnsCount = propertyValues.ShownValueColumnsCount;
DetailsDataList = propertyValues.DataHistoryList;
//Menu Properties
MenuBarData = propertyValues.MenuBarData;
}
catch (Exception E)
{
LogEntry($"Passed history values: {propertyValues}");
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
#endregion
#endregion

View File

@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
mc:Ignorable="d"

View File

@@ -1,21 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using C4IT.Logging;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Enums;
using FasdDesktopUi.Pages.DetailsPage.Models;
@@ -509,7 +503,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
default:
subtitleStyle = titleColumnMainTitleStyle;
break;
};
}
double subtitleLength = MeasureStringSize(subtitle.Content, new TextBox { Style = subtitleStyle }).Width;
maxTitleLength = maxTitleLength < subtitleLength ? subtitleLength + 70 : maxTitleLength;

View File

@@ -19,6 +19,7 @@ using C4IT.FASD.Base;
using static C4IT.Logging.cLogManager;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
namespace FasdDesktopUi.Pages.DetailsPage.UserControls
{
@@ -41,6 +42,8 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
}
}
public SupportCaseController SupportCaseController { get; set; }
private List<Border> _highlightBorders;
private void UpdateHeaderHighlights()
@@ -457,6 +460,8 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
if (headingIcon != null)
{
headingIcon.Tag = heading.Realtion;
if (heading.IsOnline)
{
headingIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Green");
@@ -471,6 +476,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
if (headingTextBlock != null && string.IsNullOrWhiteSpace(heading.HeadingText) is false)
{
headingTextBlock.Tag = heading.Realtion;
headingTextBlock.Text = heading.HeadingText;
}
@@ -632,7 +638,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
var action = new cShowHeadingSelectionMenuAction();
ShowsRelations = true;
cUiActionBase.RaiseEvent(new cShowHeadingSelectionMenuAction(), this, sender);
DoShowRelations(swapCaseData, location);
DoShowRelations(swapCaseData, location, SupportCaseController);
//Dispatcher.Invoke(async () => await action.RunUiActionAsync(sender, location, false, DataProvider));
}
catch (Exception E)
@@ -642,7 +648,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
}
private void DoShowRelations(cSwapCaseInfo swapCaseData, CustomMenu customMenu)
private void DoShowRelations(cSwapCaseInfo swapCaseData, CustomMenu customMenu, SupportCaseController supportCaseController)
{
var CM = MethodBase.GetCurrentMethod();
@@ -669,7 +675,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
{
IsMatchingRelation = isMatchingRelation,
IsUsedForCaseEnrichment = true,
UiAction = new cChangeHealthCardAction(storedRelation)
UiAction = new cChangeHealthCardAction(storedRelation, supportCaseController)
});
}
}

View File

@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
xmlns:uc="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
x:Name="_this"
mc:Ignorable="d"

View File

@@ -10,7 +10,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
d:Background="White"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
DataContext="{Binding RelativeSource={RelativeSource Self}}" Loaded="UserControl_Loaded">
<UserControl.Resources>
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
@@ -50,6 +50,15 @@
</Style>
</StackPanel.Resources>
<ico:AdaptableIcon x:Name="RawValuesButton"
Margin="7.5 0 0 0"
Visibility="Collapsed"
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.ShowRawValues}"
SelectedMaterialIcon="ic_view_list"
MouseUp="RawValuesButton_Click"
TouchDown="RawValuesButton_Click"
/>
<ico:AdaptableIcon x:Name="MinimizeButton"
BorderPadding="0 10 0 0"
VerticalAlignment="Bottom"

View File

@@ -1,7 +1,10 @@
using System.Windows;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using FasdDesktopUi.Basics.UiActions;
namespace FasdDesktopUi.Pages.DetailsPage.UserControls
{
public partial class DetailsPageWindowStateBar : UserControl
@@ -11,6 +14,14 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
if (cFasdCockpitConfig.Instance?.ShowRawHealthcardValues == true)
RawValuesButton.Visibility = Visibility.Visible;
else
RawValuesButton.Visibility = Visibility.Collapsed;
}
private void MinimizeButton_Click(object sender, InputEventArgs e)
{
if (sender is UIElement senderVisual)
@@ -28,5 +39,11 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
if (sender is UIElement senderVisual)
Window.GetWindow(senderVisual).Close();
}
private void RawValuesButton_Click(object sender, InputEventArgs e)
{
cUiActionBase.RaiseEvent(new UiShowRawHealthcardValues(), this, this);
}
}
}

View File

@@ -0,0 +1,109 @@
<Window x:Class="FasdDesktopUi.Pages.RawHealthCardValuesPage.RawHealthCardValuesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FasdDesktopUi.Pages.RawHealthCardValuesPage"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
mc:Ignorable="d"
Title="F4SD Raw healthcard values"
Height="800" Width="1024"
MinHeight="800" MinWidth="1024" Loaded="Window_Loaded"
>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="20" />
</WindowChrome.WindowChrome>
<Window.Resources>
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<Style x:Key="AdaptableIconButtonStyle" TargetType="ico:AdaptableIcon">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon}" />
<Setter Property="Margin" Value="7.5 0" />
<Setter Property="BorderPadding" Value="0" />
<Setter Property="IconHeight" Value="25" />
<Setter Property="IconWidth" Value="25" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon.Hover}" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="45"/>
<RowDefinition Height="*"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" FontSize="12" Margin="0,0,0,0" Text="Dieter Sagawe | PC010089" />
<TextBlock VerticalAlignment="Center" Margin="20,0,0,0" FontSize="12" Text="Origin filter:" />
<ComboBox Name="OriginFilterComboBox" Width="150" Height="28" FontSize="12" Margin="5,0,0,0" SelectionChanged="OriginFilterComboBox_SelectionChanged">
<ComboBoxItem Content="All" IsSelected="True"/>
<ComboBoxItem Content="Main"/>
<ComboBoxItem Content="Active Directory"/>
<ComboBoxItem Content="Azure AD"/>
<ComboBoxItem Content="F4SD Agent"/>
<ComboBoxItem Content="Intune"/>
<ComboBoxItem Content="Citrix"/>
<ComboBoxItem Content="Matrix42"/>
</ComboBox>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" WindowChrome.IsHitTestVisibleInChrome="True">
<ico:AdaptableIcon x:Name="MinimizeButton"
Style="{StaticResource AdaptableIconButtonStyle}"
BorderPadding="0 10 0 0"
VerticalAlignment="Bottom"
MouseUp="MinimizeButton_Click"
TouchDown="MinimizeButton_Click"
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Minimize}"
SelectedInternIcon="window_minimize" />
<ico:AdaptableIcon x:Name="WindowSizeButton"
MouseUp="WindowSizeButton_Click"
TouchDown="WindowSizeButton_Click">
<ico:AdaptableIcon.Resources>
<Style TargetType="ico:AdaptableIcon"
BasedOn="{StaticResource AdaptableIconButtonStyle}">
<Setter Property="SelectedInternIcon"
Value="window_fullscreen" />
<Setter Property="ToolTip"
Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Maximize}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=WindowState}"
Value="Normal">
<Setter Property="SelectedInternIcon"
Value="window_fullscreen" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=WindowState}"
Value="Maximized">
<Setter Property="SelectedInternIcon"
Value="window_fullscreenExit" />
<Setter Property="ToolTip"
Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.UnMaximize}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ico:AdaptableIcon.Resources>
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="CloseButton"
Style="{StaticResource AdaptableIconButtonStyle}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Close}"
MouseUp="CloseButton_Click"
TouchDown="CloseButton_Click"
SelectedInternIcon="window_close" />
</StackPanel>
<TreeView Grid.Row="1" Grid.Column="1" Name="RawValuesTreeView" />
</Grid>
</Window>

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
namespace FasdDesktopUi.Pages.RawHealthCardValuesPage
{
public partial class RawHealthCardValuesPage : Window
{
private enumDataHistoryOrigin originFilter = enumDataHistoryOrigin.Unknown;
public RawHealthCardValuesPage()
{
InitializeComponent();
}
private void CloseButton_Click(object sender, InputEventArgs e)
{
Close();
}
private void MinimizeButton_Click(object sender, InputEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
private void WindowSizeButton_Click(object sender, InputEventArgs e)
{
this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
OriginFilterComboBox.Items.Clear();
foreach (enumDataHistoryOrigin origin in Enum.GetValues(typeof(enumDataHistoryOrigin)))
{
string _name = cMultiLanguageSupport.GetItem("Global.Enumeration.DataHistoryOrigin." + origin.ToString());
if (string.IsNullOrEmpty(_name))
_name = origin.ToString();
OriginFilterComboBox.Items.Add(new ComboBoxItem() { Content = _name, Tag = origin});
}
OriginFilterComboBox.SelectedIndex = 0;
}
private void OriginFilterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (OriginFilterComboBox.SelectedItem is ComboBoxItem selectedItem && selectedItem.Tag is enumDataHistoryOrigin selectedOrigin)
originFilter = selectedOrigin;
}
}
}

View File

@@ -75,13 +75,13 @@
</Border>
<Border Grid.Row="0">
<CheckBox x:Name="FilterCheckbox"
Style="{DynamicResource ToggleSwitch}"
Margin="0 7 50 129"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Cursor="Hand"
Visibility="Visible">
<CheckBox x:Name="FilterCheckbox"
Style="{DynamicResource ToggleSwitch}"
Margin="0 7 50 129"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Cursor="Hand"
Visibility="Visible">
</CheckBox>
</Border>
@@ -107,16 +107,27 @@
Visibility="Visible" />
</Border>
<Border Grid.Row="0">
<Label x:Name="TicketOverviewLabel"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Header}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
Margin="9 0 0 0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
FontWeight="Bold"
Visibility="Visible" />
</Border>
<Border Grid.Row="0">
<StackPanel Orientation="Horizontal"
Margin="9 0 0 0"
VerticalAlignment="Top"
HorizontalAlignment="Left">
<Label x:Name="TicketOverviewLabel"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Header}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
FontWeight="Bold"
Visibility="Visible" />
<buc:Badge Margin="6 0 0 0"
VerticalAlignment="Center"
Text="Beta">
<buc:Badge.LayoutTransform>
<ScaleTransform ScaleX="0.85" ScaleY="0.85" />
</buc:Badge.LayoutTransform>
</buc:Badge>
</StackPanel>
</Border>
</Grid>
<!--Grid Row 2 SearchResult + SearchHistory-->
@@ -154,8 +165,11 @@
CornerRadius="10"
VerticalAlignment="Bottom"
Visibility="Collapsed">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<buc:CustomSearchResultCollection x:Name="ResultMenu"
x:FieldModifier="private" />
x:FieldModifier="private"
PreviewMouseWheel="ResultMenu_PreviewMouseWheel"/>
</ScrollViewer>
</Border>
</Grid>

View File

@@ -21,6 +21,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
@@ -32,9 +33,12 @@ namespace FasdDesktopUi.Pages.SearchPage
{
public partial class SearchPageView : Window, ISearchUiProvider
{
private static SearchPageView _instance = null;
private const int WM_NCHITTEST = 0x0084;
private const int HTTRANSPARENT = -1;
private static SearchPageView _instance = null;
private const int WM_NCHITTEST = 0x0084;
private const int HTTRANSPARENT = -1;
private readonly HashSet<TileScope> _ticketOverviewNotificationScopesPrimed = new HashSet<TileScope>();
private bool _ticketOverviewFirstEventHandled;
private readonly HashSet<TileScope> _ticketOverviewInitWasEmptyScopes = new HashSet<TileScope>();
public static SearchPageView Instance
{
get
@@ -62,72 +66,155 @@ namespace FasdDesktopUi.Pages.SearchPage
public SupportCaseSearchService SearchService { get; } = new SupportCaseSearchService(new RelationService());
private SearchPageView()
{
try
{
InitializeComponent();
Visibility = Visibility.Visible;
_instance = this;
// FilterToggleCheckBox-Events registrieren
FilterCheckbox.Checked += (s, e) => FilterToggleCheckedChanged?.Invoke(this, true);
FilterCheckbox.Unchecked += (s, e) => FilterToggleCheckedChanged?.Invoke(this, false);
Loaded += (s, e) =>
{
Hide();
SearchBarUc.ActivateManualSearch();
};
AddCustomEventHandlers();
UiSettingsChanged(null, null);
if (TicketOverviewUpdateService.Instance != null)
{
TicketOverviewUpdateService.Instance.Start();
TicketOverviewUpdateService.Instance.OverviewCountsChanged += TicketOverviewUpdateService_OverviewCountsChanged;
}
}
catch (Exception E)
{
LogException(E);
}
private SearchPageView()
{
try
{
InitializeComponent();
Visibility = Visibility.Visible;
_instance = this;
GetPrimaryScreenSize();
// FilterToggleCheckBox-Events registrieren
FilterCheckbox.Checked += (s, e) => FilterToggleCheckedChanged?.Invoke(this, true);
FilterCheckbox.Unchecked += (s, e) => FilterToggleCheckedChanged?.Invoke(this, false);
Loaded += (s, e) =>
{
Hide();
SearchBarUc.ActivateManualSearch();
ScheduleSearchResultMaxHeightUpdate();
};
SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
SearchBarUc.SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
BodyStack_TicketOverview.SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
SearchHistoryBorder.SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
AddCustomEventHandlers();
if (TicketOverviewUpdateService.Instance != null)
{
TicketOverviewUpdateService.Instance.OverviewCountsChanged += TicketOverviewUpdateService_OverviewCountsChanged;
}
UiSettingsChanged(null, null);
}
catch (Exception E)
{
LogException(E);
}
}
private void SetSearchResultVisibility(bool isVisible)
{
SearchResultBorder.Visibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
BodyStack_SearchResults.Visibility = (isVisible || SearchResultBorder.IsVisible) ? Visibility.Visible : Visibility.Collapsed;
}
public void GetPrimaryScreenSize()
{
UpdateSearchResultMaxHeight();
}
private void ScheduleSearchResultMaxHeightUpdate()
{
if (Dispatcher == null || Dispatcher.HasShutdownStarted)
return;
Dispatcher.BeginInvoke((Action)UpdateSearchResultMaxHeight, DispatcherPriority.Loaded);
}
private void UpdateSearchResultMaxHeight()
{
if (SearchResultBorder == null)
return;
var workAreaHeight = ActualHeight > 0 ? ActualHeight : SystemParameters.WorkArea.Height;
var reservedHeight = 0.0;
reservedHeight += GetVisibleHeightWithMargin(SearchBarUc);
reservedHeight += GetVisibleHeightWithMargin(BodyStack_TicketOverview);
reservedHeight += GetVisibleHeightWithMargin(SearchHistoryBorder);
if (MainBorder != null)
{
reservedHeight += MainBorder.Padding.Top + MainBorder.Padding.Bottom;
}
var searchResultMargin = SearchResultBorder.Margin;
var availableHeight = workAreaHeight - reservedHeight - searchResultMargin.Top - searchResultMargin.Bottom;
availableHeight = Math.Max(0, availableHeight);
SearchResultBorder.MaxHeight = availableHeight;
}
private static double GetVisibleHeightWithMargin(FrameworkElement element)
{
if (element == null || element.Visibility != Visibility.Visible)
return 0;
var margin = element.Margin;
return element.ActualHeight + margin.Top + margin.Bottom;
}
private void SetSearchResultVisibility(bool isVisible)
{
SearchResultBorder.Visibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
BodyStack_SearchResults.Visibility = (isVisible || SearchResultBorder.IsVisible) ? Visibility.Visible : Visibility.Collapsed;
ScheduleSearchResultMaxHeightUpdate();
}
public void SetSearchHistoryVisibility(bool isVisible)
{
SearchHistoryBorder.Visibility = isVisible && !SearchHistory.IsEmpty() ? Visibility.Visible : Visibility.Collapsed;
BodyStack_SearchResults.Visibility = (isVisible || SearchResultBorder.IsVisible) ? Visibility.Visible : Visibility.Collapsed;
ScheduleSearchResultMaxHeightUpdate();
}
public void SetSearchHistoryVisibility(bool isVisible)
{
SearchHistoryBorder.Visibility = isVisible && !SearchHistory.IsEmpty() ? Visibility.Visible : Visibility.Collapsed;
BodyStack_SearchResults.Visibility = (isVisible || SearchResultBorder.IsVisible) ? Visibility.Visible : Visibility.Collapsed;
}
private bool CheckTicketOverviewAvailability()
{
return cFasdCockpitConfig.Instance?.Global?.TicketConfiguration?.ShowOverview == true;
}
private void UpdateTicketOverviewAvailability()
{
var enabled = CheckTicketOverviewAvailability();
var service = TicketOverviewUpdateService.Instance;
service?.UpdateAvailability(enabled);
if (enabled)
_ = service?.FetchAsync();
if (!enabled)
{
if (Dispatcher.CheckAccess())
{
ApplyTicketOverviewDisabledState();
}
else
{
Dispatcher.Invoke(ApplyTicketOverviewDisabledState);
}
}
}
private void ApplyTicketOverviewDisabledState()
{
_renderTicketOverviewUserNames = false;
_ticketOverviewNotificationScopesPrimed.Clear();
_ticketOverviewFirstEventHandled = false;
_ticketOverviewInitWasEmptyScopes.Clear();
SetTicketOverviewVisibility(false);
(Application.Current as App)?.ClearTicketOverviewTrayNotification();
}
private bool CheckTicketOverviewAvailability()
{
if (cFasdCockpitCommunicationBase.Instance.IsDemo())
return true;
return false;
}
private void SetTicketOverviewVisibility(bool isVisible)
{
var b = isVisible;
if (!CheckTicketOverviewAvailability())
b = false;
private void SetTicketOverviewVisibility(bool isVisible)
{
var b = isVisible;
if (!CheckTicketOverviewAvailability())
b = false;
BodyStack_TicketOverview.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
TicketOverviewBorder.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
FilterCheckbox.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
RoleLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
OwnTicketsLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
TicketOverviewLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
}
RoleLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
OwnTicketsLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
TicketOverviewLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
ScheduleSearchResultMaxHeightUpdate();
}
public void ShowLoadingTextItem(string itemText)
{
@@ -135,10 +222,10 @@ namespace FasdDesktopUi.Pages.SearchPage
ResultMenu.ShowLoadingTextItem(itemText);
}
public void ShowTicketOverviewPane()
{
Dispatcher.Invoke(() =>
{
public void ShowTicketOverviewPane()
{
Dispatcher.Invoke(() =>
{
bool overviewAlreadyVisible = TicketOverviewBorder.Visibility == Visibility.Visible;
SetTicketOverviewVisibility(true);
@@ -151,10 +238,28 @@ namespace FasdDesktopUi.Pages.SearchPage
}
TicketOverviewUc?.RefreshHighlightState(IsFilterChecked);
var app = Application.Current as FasdDesktopUi.App;
app?.ClearTicketOverviewTrayNotification();
});
}
var app = Application.Current as FasdDesktopUi.App;
app?.ClearTicketOverviewTrayNotification();
});
}
public void ShowTicketOverviewPaneForScope(TileScope? scope)
{
if (scope.HasValue)
{
Dispatcher.Invoke(() =>
{
if (TicketOverviewBorder.Visibility == Visibility.Visible)
return;
var useRoleScope = scope.Value == TileScope.Role;
if (FilterCheckbox != null && FilterCheckbox.IsChecked != useRoleScope)
FilterCheckbox.IsChecked = useRoleScope;
});
}
ShowTicketOverviewPane();
}
internal void CloseTicketOverviewResults()
{
@@ -192,7 +297,7 @@ namespace FasdDesktopUi.Pages.SearchPage
enumFasdInformationClass GetInformationClass(cF4sdApiSearchResultRelation relation) => cF4sdIdentityEntry.GetFromSearchResult(relation.Type);
cMenuDataBase GetMenuData(cF4sdApiSearchResultRelation relation, IRelationService trelationService)
cMenuDataBase GetMenuData(cF4sdApiSearchResultRelation relation, IRelationService subRelationService)
{
try
{
@@ -837,37 +942,178 @@ namespace FasdDesktopUi.Pages.SearchPage
}
}
private void TicketOverviewUpdateService_OverviewCountsChanged(object sender, TicketOverviewCountsChangedEventArgs e)
{
try
{
ApplyLatestCounts();
var positiveChanges = e.Changes?.Where(change => change.Delta > 0).ToList();
TicketOverviewUc?.SetHighlights(positiveChanges, IsFilterChecked);
var app = Application.Current as FasdDesktopUi.App;
if (positiveChanges == null || positiveChanges.Count == 0)
{
app?.ClearTicketOverviewTrayNotification();
return;
}
var message = BuildNotificationMessage(positiveChanges);
if (string.IsNullOrWhiteSpace(message))
{
app?.ClearTicketOverviewTrayNotification();
return;
}
app?.ShowTicketOverviewTrayNotification(message);
ShowTicketOverviewNotification(message);
}
catch (Exception ex)
{
LogException(ex);
}
}
private void TicketOverviewUpdateService_OverviewCountsChanged(object sender, TicketOverviewCountsChangedEventArgs e)
{
try
{
ApplyLatestCounts();
var positiveChanges = e.Changes?.Where(change => change.Delta > 0).ToList();
var app = Application.Current as FasdDesktopUi.App;
var service = TicketOverviewUpdateService.Instance;
if (!_ticketOverviewFirstEventHandled)
{
_ticketOverviewFirstEventHandled = true;
foreach (var scope in GetTicketOverviewEventScopes(e))
{
PrimeTicketOverviewScope(scope);
TrackEmptyInitScope(scope, e?.CurrentCounts);
}
app?.ClearTicketOverviewTrayNotification();
return;
}
if (e.InitializedScope.HasValue)
{
PrimeTicketOverviewScope(e.InitializedScope.Value);
TrackEmptyInitScope(e.InitializedScope.Value, e?.CurrentCounts);
app?.ClearTicketOverviewTrayNotification();
return;
}
if (positiveChanges == null || positiveChanges.Count == 0)
{
app?.ClearTicketOverviewTrayNotification();
return;
}
if (service != null && !service.AreAllScopesInitialized)
{
app?.ClearTicketOverviewTrayNotification();
return;
}
var filteredChanges = FilterChangesForPrimedScopes(positiveChanges);
if (filteredChanges.Count == 0)
{
app?.ClearTicketOverviewTrayNotification();
return;
}
TicketOverviewUc?.SetHighlights(filteredChanges, IsFilterChecked);
var pendingScope = ResolveSingleScope(filteredChanges);
app?.SetTicketOverviewNotificationScope(pendingScope);
var message = BuildNotificationMessage(filteredChanges);
if (string.IsNullOrWhiteSpace(message))
{
app?.ClearTicketOverviewTrayNotification();
return;
}
app?.ShowTicketOverviewTrayNotification(message);
ShowTicketOverviewNotification(message);
}
catch (Exception ex)
{
LogException(ex);
}
}
private void PrimeTicketOverviewScope(TileScope scope)
{
if (_ticketOverviewNotificationScopesPrimed.Add(scope))
{
TicketOverviewUc?.ClearHighlightsForScope(scope);
}
}
private IReadOnlyList<TileCountChange> FilterChangesForPrimedScopes(IReadOnlyList<TileCountChange> changes)
{
if (changes == null || changes.Count == 0)
return Array.Empty<TileCountChange>();
var filteredChanges = new List<TileCountChange>(changes.Count);
var unprimedScopes = new HashSet<TileScope>();
var silentInitScopes = new HashSet<TileScope>();
foreach (var change in changes)
{
if (_ticketOverviewInitWasEmptyScopes.Contains(change.Scope))
{
silentInitScopes.Add(change.Scope);
continue;
}
if (_ticketOverviewNotificationScopesPrimed.Contains(change.Scope))
{
filteredChanges.Add(change);
}
else
{
unprimedScopes.Add(change.Scope);
}
}
foreach (var scope in unprimedScopes)
{
PrimeTicketOverviewScope(scope);
}
if (silentInitScopes.Count > 0)
{
foreach (var scope in silentInitScopes)
{
_ticketOverviewInitWasEmptyScopes.Remove(scope);
PrimeTicketOverviewScope(scope);
}
}
return filteredChanges;
}
private void TrackEmptyInitScope(TileScope scope, IReadOnlyDictionary<string, TileCounts> counts)
{
if (IsScopeCountsEmpty(scope, counts))
{
_ticketOverviewInitWasEmptyScopes.Add(scope);
}
}
private static bool IsScopeCountsEmpty(TileScope scope, IReadOnlyDictionary<string, TileCounts> counts)
{
if (counts == null || counts.Count == 0)
return true;
foreach (var kvp in counts)
{
var value = scope == TileScope.Role ? kvp.Value.Role : kvp.Value.Personal;
if (value != 0)
return false;
}
return true;
}
private static IEnumerable<TileScope> GetTicketOverviewEventScopes(TicketOverviewCountsChangedEventArgs e)
{
if (e == null)
return Enumerable.Empty<TileScope>();
if (e.InitializedScope.HasValue)
return new[] { e.InitializedScope.Value };
if (e.Changes == null || e.Changes.Count == 0)
return Enumerable.Empty<TileScope>();
return e.Changes.Select(change => change.Scope).Distinct();
}
private static TileScope? ResolveSingleScope(IReadOnlyList<TileCountChange> changes)
{
if (changes == null || changes.Count == 0)
return null;
var scope = changes[0].Scope;
for (int i = 1; i < changes.Count; i++)
{
if (changes[i].Scope != scope)
return null;
}
return scope;
}
private void ApplyLatestCounts()
{
@@ -1082,11 +1328,12 @@ namespace FasdDesktopUi.Pages.SearchPage
SetPendingInformationClasses(new HashSet<enumFasdInformationClass> { enumFasdInformationClass.Ticket });
var relations = await LoadRelationsForTileAsync(e.Key, e.UseRoleScope, Math.Max(0, e.Count));
Debug.WriteLine($"[TicketOverview] Relations loaded: {relations?.Count ?? 0}");
var firstRelation = relations.FirstOrDefault();
string displayText = header;
if (firstRelation != null)
var relations = await LoadRelationsForTileAsync(e.Key, e.UseRoleScope, Math.Max(0, e.Count));
Debug.WriteLine($"[TicketOverview] Relations loaded: {relations?.Count ?? 0}");
var ticketOverviewRelationService = new RelationService();
var firstRelation = relations.FirstOrDefault();
string displayText = header;
if (firstRelation != null)
{
string firstSummary = null;
if (firstRelation.Infos != null && firstRelation.Infos.TryGetValue("Summary", out var summaryValue))
@@ -1130,16 +1377,16 @@ namespace FasdDesktopUi.Pages.SearchPage
{
trailingUser = userDisplayName;
}
return (cMenuDataBase)new cMenuDataSearchRelation(r)
{
MenuText = r.DisplayName,
TrailingText = trailingUser,
UiAction = new cUiProcessSearchRelationAction(entry, r, null, this)
{
DisplayType = isEnabled ? enumActionDisplayType.enabled : enumActionDisplayType.disabled,
Description = isEnabled ? string.Empty : disabledReason,
AlternativeDescription = isEnabled ? string.Empty : disabledReason
}
return (cMenuDataBase)new cMenuDataSearchRelation(r)
{
MenuText = r.DisplayName,
TrailingText = trailingUser,
UiAction = new cUiProcessSearchRelationAction(entry, r, ticketOverviewRelationService, this)
{
DisplayType = isEnabled ? enumActionDisplayType.enabled : enumActionDisplayType.disabled,
Description = isEnabled ? string.Empty : disabledReason,
AlternativeDescription = isEnabled ? string.Empty : disabledReason
}
};
}
);
@@ -1381,11 +1628,11 @@ namespace FasdDesktopUi.Pages.SearchPage
}
}
private void UiSettingsChanged(object sender, EventArgs e)
{
try
{
var positionAlignement = cFasdCockpitConfig.Instance.Global.SmallViewAlignment;
private void UiSettingsChanged(object sender, EventArgs e)
{
try
{
var positionAlignement = cFasdCockpitConfig.Instance.Global.SmallViewAlignment;
switch (positionAlignement)
{
@@ -1396,18 +1643,49 @@ namespace FasdDesktopUi.Pages.SearchPage
Dispatcher.Invoke(() => MainBorder.HorizontalAlignment = HorizontalAlignment.Right);
break;
default:
Dispatcher.Invoke(() => MainBorder.HorizontalAlignment = HorizontalAlignment.Left);
break;
}
}
catch (Exception E)
{
LogException(E);
}
Dispatcher.Invoke(() => MainBorder.HorizontalAlignment = HorizontalAlignment.Left);
break;
}
UpdateTicketOverviewAvailability();
}
catch (Exception E)
{
LogException(E);
}
}
public void SetPendingInformationClasses(HashSet<enumFasdInformationClass> informationClasses) => Dispatcher.Invoke(() => ResultMenu.SetPendingInformationClasses(informationClasses));
public void UpdatePendingInformationClasses(HashSet<enumFasdInformationClass> informationClasses) => Dispatcher.Invoke(() => ResultMenu.UpdatePendingInformationClasses(informationClasses));
private void ResultMenu_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
var scrollViewer = FindParent<ScrollViewer>((DependencyObject)sender);
if (scrollViewer != null)
{
if (e.Delta > 0)
scrollViewer.LineUp();
else
scrollViewer.LineDown();
e.Handled = true;
}
}
private T FindParent<T>(DependencyObject child) where T : DependencyObject
{
DependencyObject parent = VisualTreeHelper.GetParent(child);
while (parent != null)
{
if (parent is T typed)
return typed;
parent = VisualTreeHelper.GetParent(parent);
}
return null;
}
}
}

View File

@@ -9,7 +9,7 @@
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="PhoneSettingsPage"
Title="M42SettingsPage"
ResizeMode="NoResize"
WindowStyle="None"
AllowsTransparency="True"

View File

@@ -310,7 +310,7 @@ namespace FasdDesktopUi.Pages.SlimPage
return;
}
var data = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
var data = await _supportCaseController?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
//todo: check if there is a more performant way solving this
Dispatcher.Invoke(() => WidgetCollectionUc.HeadingData = data.HeadingData);
Dispatcher.Invoke(() => WidgetCollectionUc.WidgetData = data.WidgetData);
@@ -339,17 +339,17 @@ namespace FasdDesktopUi.Pages.SlimPage
{
try
{
var data = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
var data = await _supportCaseController?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
//todo: check if there is a more performant way solving this
Dispatcher.Invoke(() => WidgetCollectionUc.HeadingData = data.HeadingData);
Dispatcher.Invoke(() => WidgetCollectionUc.WidgetData = data.WidgetData);
Dispatcher.Invoke(() => MenuBarUc.MenuBarItemData = GetSlimpageMenuBarData(data.MenuBarData));
Dispatcher.Invoke(() => DataHistoryCollectionUc.UpdateHistory(data.DataHistoryList));
if (_supportCase != null)
if (_supportCaseController != null)
{
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
}
}
catch (Exception E)
@@ -364,7 +364,7 @@ namespace FasdDesktopUi.Pages.SlimPage
{
Dispatcher.Invoke(() =>
{
bool hasDirectConnection = _supportCase?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
bool hasDirectConnection = _supportCaseController?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
WidgetCollectionUc.HasDirectConnection = hasDirectConnection;
});
}
@@ -495,7 +495,7 @@ namespace FasdDesktopUi.Pages.SlimPage
break;
}
await e.UiAction?.RunUiActionAsync(e.OriginalSource, drawingArea, false, _supportCase?.SupportCaseDataProviderArtifact);
await e.UiAction?.RunUiActionAsync(e.OriginalSource, drawingArea, false, _supportCaseController?.SupportCaseDataProviderArtifact);
}
catch (Exception E)

View File

@@ -4,30 +4,30 @@ using System.Windows;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.SupportCase;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Pages
{
public class SupportCasePageBase : Window, IBlurrable
{
protected ISupportCase _supportCase;
protected SupportCaseController _supportCaseController;
internal bool isDataChangedEventRunning = false;
public virtual void SetSupportCase(ISupportCase supportCase)
internal virtual void SetSupportCaseController(SupportCaseController supportCase)
{
if (_supportCase != null)
if (_supportCaseController != null)
{
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
_supportCase.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged -= DirectConnectionHelper_DirectConnectionChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
_supportCaseController.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged -= DirectConnectionHelper_DirectConnectionChanged;
}
_supportCase = supportCase;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged += DataProvider_DataChanged;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded += DataProvider_DataFullyLoaded;
_supportCase.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged += DirectConnectionHelper_DirectConnectionChanged;
_supportCaseController = supportCase;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged += DataProvider_DataChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded += DataProvider_DataFullyLoaded;
_supportCaseController.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged += DirectConnectionHelper_DirectConnectionChanged;
}
internal async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)

View File

@@ -1,8 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ToggleSwitch"
TargetType="CheckBox">
<Style x:Key="ToggleSwitch"
TargetType="CheckBox">
<Setter Property="Height"
Value="15" />
<Setter Property="ToolTipService.ShowOnDisabled"
@@ -105,5 +105,6 @@
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Style>
</ResourceDictionary>

View File

@@ -8,7 +8,7 @@
<ResourceDictionary>
<!--Cursors-->
<Cursor x:Key="Cursor.Copy">../Resources/Cursors/Hand_Clipboard_Light.cur</Cursor>
<!--Common Styles-->
<SolidColorBrush x:Key="Color.AppBackground"

View File

@@ -73,6 +73,9 @@ namespace FasdDesktopUi
[RegConfig]
public string LastDownloadPath = "";
[RegConfig]
public bool ShowRawHealthcardValues = false;
[RegConfigSubItem]
public cFasdCockpitConfigPhoneSupport PhoneSupport = new cFasdCockpitConfigPhoneSupport();

View File

@@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="C4IT.F4SD.DisplayFormatting" version="0.0.1-preview-0.0.2" targetFramework="net472" />
<package id="C4IT.F4SD.DisplayFormatting" version="1.0.0" targetFramework="net472" />
<package id="C4IT.F4SD.SupportCaseProtocoll" version="1.0.0" targetFramework="net472" />
<package id="MaterialIcons" version="1.0.3" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="3.1.32" targetFramework="net472" />
<package id="Microsoft.Web.WebView2" version="1.0.3240.44" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Web.WebView2" version="1.0.3650.58" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
<package id="System.Buffers" version="4.6.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="10.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.6.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net472" />
<package id="WpfAnimatedGif" version="2.0.2" targetFramework="net472" />
</packages>