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

@@ -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)