feat: expand cockpit integrations and support workflows
Add Phoenix remote desktop, action connector, documentation engine, and gamification support. Refactor support-case processing and search/action UI, and update installer assets and dependencies.
This commit is contained in:
@@ -21,7 +21,8 @@
|
||||
MouseLeftButtonUp="MenuItemBorder_Click"
|
||||
TouchDown="MenuItemBorder_Click"
|
||||
MouseEnter="MenuItemBorder_MouseEnter"
|
||||
MouseLeave="MenuItemBorder_MouseLeave">
|
||||
MouseLeave="MenuItemBorder_MouseLeave"
|
||||
>
|
||||
|
||||
<Grid x:Name="MenuItemContent">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -31,12 +32,14 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ico:AdaptableIcon x:Name="MenuItemIcon"
|
||||
Grid.Column="0" />
|
||||
Grid.Column="0"
|
||||
/>
|
||||
|
||||
<ico:AdaptableIcon x:Name="MenuItemOverlayIcon"
|
||||
Grid.Column="0"
|
||||
BorderPadding="10 10 0 0"
|
||||
Margin="0 0 -5 -5"/>
|
||||
Visibility="Collapsed"
|
||||
IsHitTestVisible="False"
|
||||
/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Margin="15 0 15 0"
|
||||
|
||||
@@ -1,186 +1,207 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
using FasdDesktopUi.Basics.Converter;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
|
||||
using C4IT.FASD.Base;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using MaterialIcons;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
public partial class CustomMenuItem : UserControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
#region MenuData
|
||||
|
||||
private cMenuDataBase _menuData = new cMenuDataBase();
|
||||
|
||||
private readonly bool _isLean;
|
||||
|
||||
public cMenuDataBase MenuData
|
||||
{
|
||||
get { return _menuData; }
|
||||
set
|
||||
{
|
||||
if (_menuData != value)
|
||||
{
|
||||
_menuData = value;
|
||||
MenuDataChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuDataChanged()
|
||||
{
|
||||
if (MenuData.MenuIcon.Intern != null)
|
||||
MenuItemIcon.SelectedInternIcon = MenuData.MenuIcon.Intern;
|
||||
else if (MenuData.MenuIcon.Material != null)
|
||||
MenuItemIcon.SelectedMaterialIcon = MenuData.MenuIcon.Material;
|
||||
|
||||
MenuItemIcon.IconHeight = MenuData.MenuIconSize * MenuItemIcon.IconHeight;
|
||||
MenuItemIcon.IconWidth = MenuData.MenuIconSize * MenuItemIcon.IconWidth;
|
||||
|
||||
switch (MenuData.UiAction?.DisplayType)
|
||||
{
|
||||
case Enums.enumActionDisplayType.hidden:
|
||||
//todo: add hidden state
|
||||
break;
|
||||
case Enums.enumActionDisplayType.disabled:
|
||||
MenuItemContent.SetValue(OpacityProperty, 0.5);
|
||||
MenuItemBorder.SetResourceReference(StyleProperty, "Menu.MainCategory.NoHover");
|
||||
MenuItemBorder.SetValue(ToolTipProperty, string.IsNullOrWhiteSpace(MenuData.UiAction.AlternativeDescription) ? MenuData.UiAction.Description : MenuData.UiAction.AlternativeDescription);
|
||||
try
|
||||
{
|
||||
MenuItemBorder.MouseLeftButtonUp -= MenuItemBorder_Click;
|
||||
MenuItemBorder.TouchDown -= MenuItemBorder_Click;
|
||||
}
|
||||
catch { }
|
||||
break;
|
||||
case Enums.enumActionDisplayType.enabled:
|
||||
MenuItemContent.ClearValue(OpacityProperty);
|
||||
MenuItemBorder.ClearValue(IsHitTestVisibleProperty);
|
||||
break;
|
||||
}
|
||||
|
||||
MenuItemBorder.ToolTip = !string.IsNullOrEmpty(MenuData.UiAction?.Description) ? MenuData.UiAction?.Description : null;
|
||||
ToolTip = !string.IsNullOrEmpty(MenuData.UiAction?.Description) ? MenuData.UiAction?.Description : null;
|
||||
CustomTextBlock.Text = MenuData.MenuText;
|
||||
CustomTextBlockBottom.Text = MenuData.MenuText;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(MenuData.TrailingText))
|
||||
{
|
||||
CustomTrailingTextBlock.Text = string.Empty;
|
||||
CustomTrailingTextBlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomTrailingTextBlock.Text = MenuData.TrailingText;
|
||||
CustomTrailingTextBlock.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
DrawEnhancedMenuInformation();
|
||||
}
|
||||
|
||||
private void DrawEnhancedMenuInformation()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MenuData is cMenuDataContainer containerMenuData)
|
||||
DrawContainer(containerMenuData);
|
||||
else if (MenuData is cMenuDataSearchRelation searchRelationMenuData)
|
||||
DrawSearchRelation(searchRelationMenuData);
|
||||
else if (MenuData is cMenuDataLoading)
|
||||
LoadingIcon.Visibility = Visibility.Visible;
|
||||
else
|
||||
DrawDefault();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
void DrawContainer(cMenuDataContainer containerMenuData)
|
||||
{
|
||||
SubMenuCounterBorder.Visibility = Visibility.Visible;
|
||||
var count = 0;
|
||||
foreach (var entry in containerMenuData.SubMenuData)
|
||||
{
|
||||
if (entry.UiAction?.DisplayType == null || entry.UiAction?.DisplayType == Enums.enumActionDisplayType.enabled)
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
SubMenuCounterTextBlock.Text = "-";
|
||||
else
|
||||
SubMenuCounterTextBlock.Text = count.ToString();
|
||||
}
|
||||
|
||||
void DrawSearchRelation(cMenuDataSearchRelation searchRelationMenuData)
|
||||
{
|
||||
if (!(searchRelationMenuData.Data is cF4sdApiSearchResultRelation relationData))
|
||||
return;
|
||||
|
||||
if (searchRelationMenuData.IsMatchingRelation)
|
||||
{
|
||||
LoadingIcon.SelectedMaterialIcon = MaterialIconType.ic_link;
|
||||
LoadingIcon.ClearValue(StyleProperty);
|
||||
LoadingIcon.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
if (relationData.Type is enumF4sdSearchResultClass.Ticket)
|
||||
{
|
||||
if (relationData.Infos is null)
|
||||
return;
|
||||
|
||||
if (relationData.Infos.TryGetValue("Summary", out var ticketSummary))
|
||||
{
|
||||
CustomTextBlockBottom.Text = ticketSummary;
|
||||
CustomTextBlockBorderBottom.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (relationData.Infos.TryGetValue("StatusId", out var ticketStatusId))
|
||||
{
|
||||
Enum.TryParse(ticketStatusId, true, out enumTicketStatus ticketStatus);
|
||||
|
||||
switch (ticketStatus)
|
||||
{
|
||||
case enumTicketStatus.Unknown:
|
||||
break;
|
||||
case enumTicketStatus.New:
|
||||
case enumTicketStatus.InProgress:
|
||||
case enumTicketStatus.OnHold:
|
||||
MenuItemIcon.SelectedMaterialIcon = MaterialIconType.ic_drafts;
|
||||
break;
|
||||
case enumTicketStatus.Closed:
|
||||
MenuItemIcon.SelectedMaterialIcon = MaterialIconType.ic_mail;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRelationGrid.Visibility = Visibility.Visible;
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
using FasdDesktopUi.Basics.Converter;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
|
||||
using C4IT.FASD.Base;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using MaterialIcons;
|
||||
|
||||
using F4SD_AdaptableIcon;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
public partial class CustomMenuItem : UserControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
#region MenuData
|
||||
|
||||
private cMenuDataBase _menuData = new cMenuDataBase();
|
||||
|
||||
private readonly bool _isLean;
|
||||
|
||||
public cMenuDataBase MenuData
|
||||
{
|
||||
get { return _menuData; }
|
||||
set
|
||||
{
|
||||
if (_menuData != value)
|
||||
{
|
||||
_menuData = value;
|
||||
MenuDataChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setIcon(AdaptableIcon.AdaptableIcon icon, IconData data)
|
||||
{
|
||||
var _visibilty = Visibility.Visible;
|
||||
if (data.Intern != null)
|
||||
icon.SelectedInternIcon = data.Intern;
|
||||
else if (data.Material != null)
|
||||
icon.SelectedMaterialIcon = data.Material;
|
||||
else
|
||||
_visibilty = Visibility.Hidden;
|
||||
|
||||
icon.IconHeight = MenuData.MenuIconSize * icon.IconHeight;
|
||||
icon.IconWidth = MenuData.MenuIconSize * icon.IconWidth;
|
||||
|
||||
icon.Visibility = _visibilty;
|
||||
}
|
||||
|
||||
private void MenuDataChanged()
|
||||
{
|
||||
setIcon(MenuItemIcon, MenuData.MenuIcon?.Icon ?? new IconData());
|
||||
|
||||
|
||||
if (MenuData.MenuIcon?.Overlay != null)
|
||||
setIcon(MenuItemOverlayIcon, (IconData)MenuData.MenuIcon.Overlay);
|
||||
else
|
||||
MenuItemOverlayIcon.Visibility = Visibility.Collapsed;
|
||||
|
||||
if (MenuData.MenuIcon?.IsInactive == true)
|
||||
{
|
||||
MenuItemIcon.Opacity = 0.7;
|
||||
MenuItemOverlayIcon.Opacity = 0.7;
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuItemIcon.Opacity = 1.0;
|
||||
MenuItemOverlayIcon.Opacity = 1.0;
|
||||
}
|
||||
|
||||
if (MenuData.MenuIcon?.Description != null)
|
||||
{
|
||||
MenuItemIcon.ToolTip = new CustomMenuItemToolTipTemplate(MenuData.MenuIcon.Description);
|
||||
ToolTipService.SetInitialShowDelay(MenuItemIcon, 300);
|
||||
ToolTipService.SetBetweenShowDelay(MenuItemIcon, 600);
|
||||
ToolTipService.SetPlacement(MenuItemIcon, System.Windows.Controls.Primitives.PlacementMode.Top);
|
||||
ToolTipService.SetHorizontalOffset(MenuItemIcon, 20);
|
||||
ToolTipService.SetVerticalOffset(MenuItemIcon, 20);
|
||||
}
|
||||
|
||||
string toolTip = MenuData.UiAction?.Description;
|
||||
switch (MenuData.UiAction?.DisplayType)
|
||||
{
|
||||
case Enums.enumActionDisplayType.hidden:
|
||||
//todo: add hidden state
|
||||
break;
|
||||
case Enums.enumActionDisplayType.disabled:
|
||||
MenuItemContent.SetValue(OpacityProperty, 0.5);
|
||||
MenuItemBorder.SetResourceReference(StyleProperty, "Menu.MainCategory.NoHover");
|
||||
if (!string.IsNullOrWhiteSpace(MenuData.UiAction.AlternativeDescription))
|
||||
toolTip = MenuData.UiAction.AlternativeDescription;
|
||||
try
|
||||
{
|
||||
MenuItemBorder.MouseLeftButtonUp -= MenuItemBorder_Click;
|
||||
MenuItemBorder.TouchDown -= MenuItemBorder_Click;
|
||||
}
|
||||
catch { }
|
||||
break;
|
||||
case Enums.enumActionDisplayType.enabled:
|
||||
MenuItemContent.ClearValue(OpacityProperty);
|
||||
MenuItemBorder.ClearValue(IsHitTestVisibleProperty);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(toolTip))
|
||||
MenuItemBorder.ToolTip = toolTip;
|
||||
|
||||
CustomTextBlock.Text = MenuData.MenuText;
|
||||
CustomTextBlockBottom.Text = MenuData.MenuText;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(MenuData.TrailingText))
|
||||
{
|
||||
CustomTrailingTextBlock.Text = string.Empty;
|
||||
CustomTrailingTextBlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomTrailingTextBlock.Text = MenuData.TrailingText;
|
||||
CustomTrailingTextBlock.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
DrawEnhancedMenuInformation();
|
||||
}
|
||||
|
||||
private void DrawEnhancedMenuInformation()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MenuData is cMenuDataContainer containerMenuData)
|
||||
DrawContainer(containerMenuData);
|
||||
else if (MenuData is cMenuDataSearchRelation searchRelationMenuData)
|
||||
DrawSearchRelation(searchRelationMenuData);
|
||||
else if (MenuData is cMenuDataLoading)
|
||||
LoadingIcon.Visibility = Visibility.Visible;
|
||||
else
|
||||
DrawDefault();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
void DrawContainer(cMenuDataContainer containerMenuData)
|
||||
{
|
||||
SubMenuCounterBorder.Visibility = Visibility.Visible;
|
||||
var count = 0;
|
||||
foreach (var entry in containerMenuData.SubMenuData)
|
||||
{
|
||||
if (entry.UiAction?.DisplayType == null || entry.UiAction?.DisplayType == Enums.enumActionDisplayType.enabled)
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
SubMenuCounterTextBlock.Text = "-";
|
||||
else
|
||||
SubMenuCounterTextBlock.Text = count.ToString();
|
||||
}
|
||||
|
||||
void DrawSearchRelation(cMenuDataSearchRelation searchRelationMenuData)
|
||||
{
|
||||
if (!(searchRelationMenuData.Data is cF4sdApiSearchResultRelation relationData))
|
||||
return;
|
||||
|
||||
if (searchRelationMenuData.IsMatchingRelation)
|
||||
{
|
||||
LoadingIcon.SelectedMaterialIcon = MaterialIconType.ic_link;
|
||||
LoadingIcon.ClearValue(StyleProperty);
|
||||
LoadingIcon.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
if (relationData.Type is enumF4sdSearchResultClass.Ticket)
|
||||
{
|
||||
if (relationData.Infos is null)
|
||||
return;
|
||||
|
||||
if (relationData.Infos.TryGetValue("Summary", out var ticketSummary))
|
||||
{
|
||||
CustomTextBlockBottom.Text = ticketSummary;
|
||||
CustomTextBlockBorderBottom.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRelationGrid.Visibility = Visibility.Visible;
|
||||
|
||||
if (searchRelationMenuData.LastUsed == DateTime.MinValue)
|
||||
{
|
||||
LessThanTextBlock.Text= string.Empty;
|
||||
LessThanTextBlock.Text = string.Empty;
|
||||
LessThanTextBlock.Visibility = Visibility.Collapsed;
|
||||
LastSeenTextBox.Visibility = Visibility.Collapsed;
|
||||
|
||||
ActivityIndicator.Width = 0;
|
||||
ActivityIndicator.Visibility = Visibility.Collapsed;
|
||||
ActivityTextBlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
LastSeenTextBox.Visibility = Visibility.Collapsed;
|
||||
|
||||
ActivityIndicator.Width = 0;
|
||||
ActivityIndicator.Visibility = Visibility.Collapsed;
|
||||
ActivityTextBlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
var lastUsedTimeSpan = DateTime.UtcNow - searchRelationMenuData.LastUsed;
|
||||
LanguageDefinitionsConverter valueConverter = new LanguageDefinitionsConverter();
|
||||
string lastSeenText = null;
|
||||
@@ -194,86 +215,97 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
LessThanTextBlock.Text = lastSeenText;
|
||||
LessThanTextBlock.Visibility = Visibility.Visible;
|
||||
LastSeenTextBox.Visibility = Visibility.Visible;
|
||||
|
||||
ActivityIndicator.Width = Math.Max(ActivityIndicator.Width * relationData.UsingLevel, ActivityIndicator.Width * 0.1);
|
||||
ActivityIndicator.Visibility = Visibility.Visible;
|
||||
ActivityTextBlock.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DrawDefault()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(MenuData.SubMenuText))
|
||||
return;
|
||||
|
||||
CustomTextBlockBottom.Text = MenuData.SubMenuText;
|
||||
CustomTextBlockBorderBottom.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public CustomMenuItem(bool isLean)
|
||||
{
|
||||
_isLean = isLean;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
private void MenuItemBorder_Click(object sender, InputEventArgs e)
|
||||
{
|
||||
if (MenuData.UiAction == null)
|
||||
return;
|
||||
|
||||
cUiActionBase.RaiseEvent(MenuData.UiAction, this, this);
|
||||
}
|
||||
|
||||
#region Hover
|
||||
|
||||
private void MenuItemBorder_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
cUtility.SetTickerTextAnimation(CustomTextBlock, CustomTextBlockBorder);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(CustomTextBlockBottom.Text) is false)
|
||||
cUtility.SetTickerTextAnimation(CustomTextBlockBottom, CustomTextBlockBorderBottom);
|
||||
}
|
||||
|
||||
private void MenuItemBorder_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
CustomTextBlock.TextTrimming = TextTrimming.CharacterEllipsis;
|
||||
CustomTextBlock.BeginAnimation(MarginProperty, null);
|
||||
|
||||
CustomTextBlockBorder.ClearValue(WidthProperty);
|
||||
CustomTextBlockBorderBottom.ClearValue(WidthProperty);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(CustomTextBlockBottom.Text) is false)
|
||||
{
|
||||
CustomTextBlockBottom.TextTrimming = TextTrimming.CharacterEllipsis;
|
||||
CustomTextBlockBottom.BeginAnimation(MarginProperty, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public void ShowDetailHeadings(bool showDetails)
|
||||
{
|
||||
SearchRelationGrid.ColumnDefinitions[0].Width =
|
||||
showDetails ? new GridLength(1, GridUnitType.Auto) : new GridLength(0);
|
||||
}
|
||||
|
||||
private void CustomMenuItemUc_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
if (_isLean)
|
||||
MenuItemBorder.Height = 30;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
LastSeenTextBox.Visibility = Visibility.Visible;
|
||||
|
||||
ActivityIndicator.Width = Math.Max(ActivityIndicator.Width * relationData.UsingLevel, ActivityIndicator.Width * 0.1);
|
||||
ActivityIndicator.Visibility = Visibility.Visible;
|
||||
ActivityTextBlock.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DrawDefault()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(MenuData.SubMenuText))
|
||||
return;
|
||||
|
||||
CustomTextBlockBottom.Text = MenuData.SubMenuText;
|
||||
CustomTextBlockBorderBottom.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public CustomMenuItem(bool isLean)
|
||||
{
|
||||
_isLean = isLean;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
private void MenuItemBorder_Click(object sender, InputEventArgs e)
|
||||
{
|
||||
if (MenuData.UiAction == null)
|
||||
return;
|
||||
|
||||
if (MenuData.UiAction is cSubMenuAction subMenuAction)
|
||||
{
|
||||
bool useTempData = subMenuAction.UseTempData;
|
||||
|
||||
if (useTempData)
|
||||
{
|
||||
QuickActionSelector.Instance.Search.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
cUiActionBase.RaiseEvent(MenuData.UiAction, this, this);
|
||||
|
||||
}
|
||||
|
||||
#region Hover
|
||||
|
||||
private void MenuItemBorder_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
cUtility.SetTickerTextAnimation(CustomTextBlock, CustomTextBlockBorder);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(CustomTextBlockBottom.Text) is false)
|
||||
cUtility.SetTickerTextAnimation(CustomTextBlockBottom, CustomTextBlockBorderBottom);
|
||||
}
|
||||
|
||||
private void MenuItemBorder_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
CustomTextBlock.TextTrimming = TextTrimming.CharacterEllipsis;
|
||||
CustomTextBlock.BeginAnimation(MarginProperty, null);
|
||||
|
||||
CustomTextBlockBorder.ClearValue(WidthProperty);
|
||||
CustomTextBlockBorderBottom.ClearValue(WidthProperty);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(CustomTextBlockBottom.Text) is false)
|
||||
{
|
||||
CustomTextBlockBottom.TextTrimming = TextTrimming.CharacterEllipsis;
|
||||
CustomTextBlockBottom.BeginAnimation(MarginProperty, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public void ShowDetailHeadings(bool showDetails)
|
||||
{
|
||||
SearchRelationGrid.ColumnDefinitions[0].Width =
|
||||
showDetails ? new GridLength(1, GridUnitType.Auto) : new GridLength(0);
|
||||
}
|
||||
|
||||
private void CustomMenuItemUc_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
if (_isLean)
|
||||
MenuItemBorder.Height = 30;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<ToolTip x:Class="FasdDesktopUi.Basics.UserControls.CustomMenuItemToolTipTemplate"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<ToolTip.Template>
|
||||
<ControlTemplate>
|
||||
<Border BorderBrush="{DynamicResource FontColor.Menu.Categories}" BorderThickness="1" CornerRadius="5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
>
|
||||
<TextBlock Text="{Binding Text, RelativeSource={RelativeSource AncestorType=ToolTip}}"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||
TextWrapping="Wrap"
|
||||
MaxWidth="300"
|
||||
Margin="8,3,8,5"
|
||||
/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</ToolTip.Template>
|
||||
</ToolTip>
|
||||
@@ -0,0 +1,36 @@
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
public partial class CustomMenuItemToolTipTemplate : ToolTip
|
||||
{
|
||||
public static readonly DependencyProperty TextProperty =
|
||||
DependencyProperty.Register("Text", typeof(string), typeof(CustomMenuItemToolTipTemplate), new PropertyMetadata("This is a default popup text."));
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return (string)GetValue(TextProperty); }
|
||||
set { SetValue(TextProperty, value); }
|
||||
}
|
||||
|
||||
public CustomMenuItemToolTipTemplate(string content = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = content;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@
|
||||
Style="{DynamicResource SettingsPage.Close.Icon}"
|
||||
BorderPadding="5"
|
||||
SelectedMaterialIcon="ic_remove"
|
||||
MouseLeftButtonUp="CollapseButton_MouseLeftButtonUp"
|
||||
TouchDown="CollapseButton_TouchDown" />
|
||||
MouseLeftButtonUp="CollapseButton_Click"
|
||||
TouchDown="CollapseButton_Click" />
|
||||
|
||||
<TextBlock Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
|
||||
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickAction.Parameter}" />
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.Logging;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
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.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
@@ -104,13 +93,13 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
switch (parameterValue)
|
||||
{
|
||||
case cAdjustableParameterBoolean booleanParameter:
|
||||
AddBooleanParameter(parameter.Key, booleanParameter);
|
||||
AddBooleanParameter(booleanParameter);
|
||||
break;
|
||||
case cAdjustableParameterNumerical numericalParameter:
|
||||
AddNumericalParameter(parameter.Key, numericalParameter);
|
||||
AddNumericalParameter(numericalParameter);
|
||||
break;
|
||||
case cAdjustableParameterDropDown dropDownParameter:
|
||||
AddDropDownParameter(parameter.Key, dropDownParameter);
|
||||
AddDropDownParameter(dropDownParameter);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -140,7 +129,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
#region Helper
|
||||
|
||||
private void AddBooleanParameter(string parameterKey, cAdjustableParameterBoolean booleanParameter)
|
||||
private void AddBooleanParameter(cAdjustableParameterBoolean booleanParameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -157,7 +146,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
outerPanel.Children.Add(valueCheckBox);
|
||||
|
||||
TextBlock parameterNameTextBlock = new TextBlock() { Text = booleanParameter.Names.GetValue(), Margin = new Thickness(0, 0, 7.5, 0) };
|
||||
if(!string.IsNullOrEmpty(booleanParameter.Descriptions.GetValue()))
|
||||
if (!string.IsNullOrEmpty(booleanParameter.Descriptions.GetValue()))
|
||||
{
|
||||
parameterNameTextBlock.ToolTip = booleanParameter.Descriptions.GetValue();
|
||||
}
|
||||
@@ -172,7 +161,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
private void AddNumericalParameter(string parameterKey, cAdjustableParameterNumerical numericalParameter)
|
||||
private void AddNumericalParameter(cAdjustableParameterNumerical numericalParameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -185,20 +174,11 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
valueTextBox.SetResourceReference(BackgroundProperty, "BackgroundColor.DetailsPage.DataHistory.TitleColumn");
|
||||
valueTextBox.SetResourceReference(BorderBrushProperty, "BackgroundColor.DetailsPage.DataHistory.ValueColumn");
|
||||
|
||||
valueTextBox.PreviewKeyDown += ((sender, e) =>
|
||||
valueTextBox.TextChanged += (sender, e) =>
|
||||
{
|
||||
if (double.TryParse(valueTextBox.Text, out var parsedValue))
|
||||
ParameterValues[numericalParameter] = parsedValue;
|
||||
});
|
||||
|
||||
valueTextBox.PreviewTextInput += new TextCompositionEventHandler((sender, e) =>
|
||||
{
|
||||
var plannedValue = valueTextBox.Text.Insert(valueTextBox.CaretIndex, e.Text);
|
||||
if (double.TryParse(plannedValue, out var parsedValue))
|
||||
ParameterValues[numericalParameter] = parsedValue;
|
||||
else
|
||||
e.Handled = true;
|
||||
});
|
||||
};
|
||||
|
||||
DockPanel.SetDock(valueTextBox, Dock.Right);
|
||||
outerPanel.Children.Add(valueTextBox);
|
||||
@@ -219,7 +199,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
private void AddDropDownParameter(string parameterKey, cAdjustableParameterDropDown dropDownParameter)
|
||||
private void AddDropDownParameter(cAdjustableParameterDropDown dropDownParameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -227,8 +207,12 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
ParameterValues[dropDownParameter] = dropDownParameter.Default;
|
||||
|
||||
ComboBox valueComboBox = new ComboBox() { SelectedItem = dropDownParameter.Default, MinWidth = 125 };
|
||||
valueComboBox.Style = (Style)FindResource("DarkComboBox");
|
||||
ComboBox valueComboBox = new ComboBox
|
||||
{
|
||||
SelectedItem = dropDownParameter.Default,
|
||||
MinWidth = 125,
|
||||
Style = (Style)FindResource("DarkComboBox")
|
||||
};
|
||||
|
||||
valueComboBox.DropDownOpened += (sender, e) => cFocusInvoker.InvokeGotFocus(this, e);
|
||||
valueComboBox.DropDownClosed += (sender, e) => cFocusInvoker.InvokeLostFocus(this, e);
|
||||
@@ -346,9 +330,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
#region CollapseButton_Click
|
||||
|
||||
private void CollapseButton_Click()
|
||||
private void CollapseButton_Click(object sender, InputEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -360,17 +342,5 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void CollapseButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
CollapseButton_Click();
|
||||
}
|
||||
|
||||
private void CollapseButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
CollapseButton_Click();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
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"
|
||||
<local:DynamicChart x:Name="DynamicChartUc"
|
||||
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:DetailedRecommendation x:Name="RecommendationUc"
|
||||
Width="{Binding ElementName=DetailedDataUc, Path=ActualWidth, UpdateSourceTrigger=PropertyChanged}"
|
||||
MinWidth="300"
|
||||
|
||||
@@ -1,22 +1,9 @@
|
||||
using C4IT.Logging;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Pages.DetailsPage.Models;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
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.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
@@ -63,7 +50,9 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
_me.dataProvider.HealthCardDataHelper.LoadingHelper.DataRefreshed += _me.HealthCardDataHelper_DataRefreshed;
|
||||
}
|
||||
|
||||
_me.QuickActionStatusUc.CancelQuickAction();
|
||||
bool isSameQuickAction = oldData?.QuickActionStatusMonitorData?.QuickActionDefinition?.Id == newData?.QuickActionStatusMonitorData?.QuickActionDefinition?.Id;
|
||||
if (!isSameQuickAction && newData?.QuickActionStatusMonitorData?.QuickActionDefinition?.RunImmediate != true)
|
||||
_me.QuickActionStatusUc.CancelQuickAction();
|
||||
|
||||
_me.RecommendationUc.RecommendationData = _me.DataCanvasData.RecommendationData;
|
||||
_me.RecommendationUc.CloseButtonClickedAction = _me.CloseDataCanvas;
|
||||
|
||||
@@ -2,21 +2,10 @@
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics.Helper;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Pages.DetailsPage.Models;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
@@ -27,7 +16,18 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
#region RecommendationData
|
||||
|
||||
public static readonly DependencyProperty RecommendationDataProperty =
|
||||
DependencyProperty.Register("RecommendationData", typeof(cRecommendationDataModel), typeof(DetailedRecommendation), new PropertyMetadata(new cRecommendationDataModel()));
|
||||
DependencyProperty.Register("RecommendationData", typeof(cRecommendationDataModel), typeof(DetailedRecommendation), new PropertyMetadata(new cRecommendationDataModel(), new PropertyChangedCallback(HandleRecommendationDataChanged)));
|
||||
|
||||
private static void HandleRecommendationDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (!(d is DetailedRecommendation recommendationUc))
|
||||
return;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(recommendationUc.RecommendationData?.Recommendation))
|
||||
recommendationUc.Visibility = Visibility.Collapsed;
|
||||
else
|
||||
recommendationUc.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public cRecommendationDataModel RecommendationData
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (d is DetailedRecommendation recommendation && e.NewValue is IconData iconData)
|
||||
{
|
||||
IconHelper.SetIconValue(recommendation.RecommendationIcon, iconData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string PrimaryIconColorResourceName
|
||||
@@ -99,8 +99,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
private void CloseButton_Click()
|
||||
{
|
||||
if (CloseButtonClickedAction != null)
|
||||
CloseButtonClickedAction.Invoke();
|
||||
CloseButtonClickedAction?.Invoke();
|
||||
}
|
||||
|
||||
private void CloseButton_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
|
||||
@@ -3,6 +3,7 @@ using C4IT.F4SD.SupportCaseProtocoll.Models;
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.MultiLanguage;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using F4SD.Gamification;
|
||||
using FasdDesktopUi.Basics.Converter;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.Services.ProtocollService;
|
||||
@@ -21,6 +22,7 @@ using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using F4SD.Gamification.Services;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
@@ -30,6 +32,16 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
private bool secretsAreShown = false;
|
||||
private readonly IRawValueFormatter _rawValueFormatter = new RawValueFormatter();
|
||||
|
||||
private static object _currentQuickActionLock = new object();
|
||||
|
||||
private Guid _currentRunningQuickActionId;
|
||||
|
||||
public Guid CurrentRunningQuickActionId
|
||||
{
|
||||
get { lock (_currentQuickActionLock) { return _currentRunningQuickActionId; } }
|
||||
set { lock (_currentQuickActionLock) { _currentRunningQuickActionId = value; } }
|
||||
}
|
||||
|
||||
#region Helperclasses QuickAction Output
|
||||
|
||||
public abstract class cQuickActionOutput
|
||||
@@ -38,7 +50,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
public cQuickActionOutput(cF4sdQuickActionRevision.cOutput scriptOutput)
|
||||
{
|
||||
_rawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
|
||||
_rawValueFormatter.SetDefaultCulture(cFasdCockpitConfig.Instance.SelectedCulture);
|
||||
_rawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
|
||||
ErrorCode = scriptOutput.ErrorCode;
|
||||
ErrorDescription = scriptOutput.ErrorDescription;
|
||||
@@ -804,7 +816,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (measureValues?.Count <= 0)
|
||||
return;
|
||||
|
||||
_rawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
|
||||
_rawValueFormatter.SetDefaultCulture(cFasdCockpitConfig.Instance.SelectedCulture);
|
||||
_rawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
|
||||
|
||||
for (int i = 0; i < measureValues.Count; i++)
|
||||
@@ -1006,7 +1018,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
else if (QuickActionData.ActionSteps.All(step => step.Status == enumQuickActionRevisionStatus.finishedSuccessfull))
|
||||
status = enumQuickActionRevisionStatus.finishedSuccessfull;
|
||||
|
||||
RaiseEvent(new QuickActionEventArgs(QuickActionFinishedEvent, this) { QuickActionResult = result, QuickActionStatus = status, QuickAction = QuickActionData.QuickActionDefinition});
|
||||
RaiseEvent(new QuickActionEventArgs(QuickActionFinishedEvent, this) { QuickActionResult = result, QuickActionStatus = status, QuickAction = QuickActionData.QuickActionDefinition });
|
||||
|
||||
CopyButton.Visibility = Visibility.Visible;
|
||||
|
||||
@@ -1022,6 +1034,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
finally
|
||||
{
|
||||
VisualizeQuickActionFinish(status);
|
||||
GamificationService.TrackAction(CockpitAction.QuickActionExecuted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
40
FasdDesktopUi/Basics/UserControls/FooterButton.xaml
Normal file
40
FasdDesktopUi/Basics/UserControls/FooterButton.xaml
Normal file
@@ -0,0 +1,40 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.FooterButton"
|
||||
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"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="35"
|
||||
d:DesignWidth="230"
|
||||
x:Name="FooterBtn">
|
||||
|
||||
<UserControl.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="MainGrid"
|
||||
x:FieldModifier="private"
|
||||
Visibility="Collapsed">
|
||||
<Border x:Name="MainBorder"
|
||||
Style="{DynamicResource Menu.MainCategory}"
|
||||
CornerRadius="7.5"
|
||||
Height="35"
|
||||
MouseLeftButtonUp="Button_Click"
|
||||
TouchDown="Button_Click">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ico:AdaptableIcon x:Name="ButtonIcon"
|
||||
Margin="0 0 10 0" />
|
||||
<TextBlock x:Name="ButtonLabel"
|
||||
FontSize="16"
|
||||
Text="{Binding ElementName=FooterBtn, Path=LabelText}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<local:Badge Text="Beta"
|
||||
Margin="-12.5"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
84
FasdDesktopUi/Basics/UserControls/FooterButton.xaml.cs
Normal file
84
FasdDesktopUi/Basics/UserControls/FooterButton.xaml.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using C4IT.MultiLanguage;
|
||||
using F4SD_AdaptableIcon;
|
||||
using FasdDesktopUi.Basics.Converter;
|
||||
using FasdDesktopUi.Basics.Helper;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
public partial class FooterButton : UserControl
|
||||
{
|
||||
public string LabelText
|
||||
{
|
||||
get { return (string)GetValue(LabelTextProperty); }
|
||||
set { SetValue(LabelTextProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LabelTextProperty =
|
||||
DependencyProperty.Register(nameof(LabelText), typeof(string), typeof(FooterButton), new PropertyMetadata(string.Empty));
|
||||
|
||||
|
||||
public cUiQuickAction QuickAction
|
||||
{
|
||||
get { return (cUiQuickAction)GetValue(QuickActionProperty); }
|
||||
set { SetValue(QuickActionProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty QuickActionProperty =
|
||||
DependencyProperty.Register(nameof(QuickAction), typeof(cUiQuickAction), typeof(FooterButton), new PropertyMetadata(null, new PropertyChangedCallback(HandleQuickActionChanged)));
|
||||
|
||||
private static void HandleQuickActionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (!(d is FooterButton button))
|
||||
return;
|
||||
|
||||
button.UpdateButtonProperties();
|
||||
}
|
||||
|
||||
private void UpdateButtonProperties()
|
||||
{
|
||||
MainGrid.Visibility = QuickAction is null ? Visibility.Collapsed : Visibility.Visible;
|
||||
|
||||
string tooltip = QuickAction != null ? null : cMultiLanguageSupport.GetItem("RemoteConnection.Button.Disabled");
|
||||
SetEnableButton(QuickAction != null && QuickAction.DisplayType == Enums.enumActionDisplayType.enabled, tooltip);
|
||||
|
||||
IconData iconData = IconDataConverter.Convert(QuickAction.QuickActionConfig.Icon);
|
||||
IconHelper.SetIconValue(ButtonIcon, iconData);
|
||||
}
|
||||
|
||||
public FooterButton()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void Button_Click(object sender, InputEventArgs e)
|
||||
{
|
||||
if (QuickAction is null)
|
||||
return;
|
||||
|
||||
SetEnableButton(false);
|
||||
cUiActionBase.RaiseEvent(QuickAction, this, this);
|
||||
SetEnableButton(true);
|
||||
}
|
||||
|
||||
internal void SetEnableButton(bool isEnabled, string tooltip = null)
|
||||
{
|
||||
if (isEnabled)
|
||||
{
|
||||
MainBorder.SetResourceReference(StyleProperty, "Menu.MainCategory");
|
||||
MainBorder.ClearValue(OpacityProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainBorder.SetResourceReference(StyleProperty, "Menu.MainCategory.NoHover");
|
||||
MainBorder.Opacity = 0.5;
|
||||
}
|
||||
|
||||
MainBorder.ToolTip = tooltip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.Gamification.LevelTracker"
|
||||
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.Gamification"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.DetailsPage.DataHistory.TitleColumn.MainTitle}" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Grid Margin="10 0">
|
||||
<Border BorderBrush="{DynamicResource Color.FunctionMarker}"
|
||||
CornerRadius="50"
|
||||
BorderThickness="6"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="#01010101"
|
||||
Height="45"
|
||||
Width="45">
|
||||
</Border>
|
||||
|
||||
<TextBlock x:Name="LevelValueTextBlock"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
FontSize="20" />
|
||||
|
||||
<Ellipse x:Name="CoverEllipse"
|
||||
Stroke="{DynamicResource Color.AppBackground}"
|
||||
Opacity="0.5"
|
||||
StrokeThickness="7"
|
||||
Height="46"
|
||||
Width="46"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<Ellipse.RenderTransform>
|
||||
<RotateTransform Angle="-90" />
|
||||
</Ellipse.RenderTransform>
|
||||
</Ellipse>
|
||||
</Grid>
|
||||
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="StackPanel">
|
||||
<Setter Property="Visibility"
|
||||
Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=FrameworkElement}, Path=IsMouseOver}"
|
||||
Value="True">
|
||||
<Setter Property="Visibility"
|
||||
Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<TextBlock x:Name="LevelTitelTextBlock"
|
||||
FontWeight="Bold"
|
||||
FontSize="18" />
|
||||
<TextBlock x:Name="XpTextBlock"
|
||||
FontWeight="Light"
|
||||
FontSize="14" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,39 @@
|
||||
using F4SD.Gamification;
|
||||
using F4SD.Gamification.Services;
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls.Gamification
|
||||
{
|
||||
public partial class LevelTracker : UserControl
|
||||
{
|
||||
public LevelTracker()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private double GetCircumferenceOfCoverEllipse()
|
||||
{
|
||||
return (2 * Math.PI * (CoverEllipse.Height / 2.0 - CoverEllipse.StrokeThickness / 2.0)) / CoverEllipse.StrokeThickness;
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
{
|
||||
CoverEllipse.StrokeDashArray = new DoubleCollection() { GetCircumferenceOfCoverEllipse() };
|
||||
LevelService.ExperiencePointsChanged += UpdateExperiencePoints;
|
||||
|
||||
base.OnInitialized(e);
|
||||
}
|
||||
|
||||
private void UpdateExperiencePoints(object sender, LevelEventArgs e)
|
||||
{
|
||||
LevelValueTextBlock.Text = e.CurrentLevel.ToString();
|
||||
double relativeProgress = (double)e.CurrentXp / (double)e.XpRequiredForLevelUp;
|
||||
CoverEllipse.StrokeDashOffset = (GetCircumferenceOfCoverEllipse() * relativeProgress) * -1.0;
|
||||
|
||||
LevelTitelTextBlock.Text = e.LevelTitle;
|
||||
XpTextBlock.Text = $"{e.CurrentXp} / {e.XpRequiredForLevelUp} XP";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.InformationClassSearchBar"
|
||||
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"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Name="_this"
|
||||
IsVisibleChanged="BlurInvoker_IsActiveChanged">
|
||||
|
||||
<UserControl.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
CornerRadius="17.5"
|
||||
Margin="-2.5"
|
||||
Padding="2.5"
|
||||
VerticalAlignment="Bottom"
|
||||
x:Name="BackgroundBorder"
|
||||
x:FieldModifier="private">
|
||||
|
||||
<DockPanel>
|
||||
<ico:AdaptableIcon x:Name="PhoneCallIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
Visibility="Collapsed"
|
||||
SelectedMaterialIcon="ic_phone" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="ComputerCallIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
Visibility="Collapsed"
|
||||
SelectedInternIcon="misc_computer" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="UserCallIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
Visibility="Collapsed"
|
||||
SelectedInternIcon="misc_user" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="WarningIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
PrimaryIconColor="{DynamicResource HighlightColor.Orange}"
|
||||
Visibility="Collapsed"
|
||||
SelectedInternIcon="status_bad" />
|
||||
|
||||
<local:SearchBar x:Name="InnerSearchBar"
|
||||
x:FieldModifier="private"
|
||||
SearchButtonSize="{Binding SearchButtonSize, ElementName=_this}"
|
||||
CloseButtonSize="{Binding CloseButtonSize, ElementName=_this}"
|
||||
PlaceholderText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Searchbar.Placeholder.UserName}"
|
||||
ShowCloseButton="True"
|
||||
ShowSearchButton="True"
|
||||
SearchValueChanged="InnerSearchBar_SearchValueChanged"
|
||||
CancelledSearch="InnerSearchBar_CancelledSearch" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,287 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
using C4IT.Logging;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using C4IT.MultiLanguage;
|
||||
using C4IT.FASD.Base;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
public partial class InformationClassSearchBar : UserControl, IBlurInvoker
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public enum eSearchStatus { message, active, fixedResult }
|
||||
public eSearchStatus SearchStatus { get; private set; } = eSearchStatus.message;
|
||||
|
||||
private static CancellationTokenSource _currentSearchTaskToken = null;
|
||||
private static Guid? _currentSearchTaskId = null;
|
||||
private static readonly object _currentSearchTaskLock = new object();
|
||||
|
||||
private readonly Dictionary<enumF4sdSearchResultClass, UIElement> _searchIcons = null;
|
||||
|
||||
public delegate Task ChangedSearchValueDelegate(cFilteredResults results);
|
||||
public ChangedSearchValueDelegate ChangedSearchValue { get; set; } = null;
|
||||
|
||||
public Action CancledSearchAction { get; set; }
|
||||
|
||||
public bool BlurInvoker_IsActive => IsVisible;
|
||||
|
||||
public string SearchValue => InnerSearchBar.SearchValue;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dependency Properties
|
||||
|
||||
public static readonly DependencyProperty SearchButtonSizeProperty =
|
||||
DependencyProperty.Register(nameof(SearchButtonSize), typeof(double), typeof(InformationClassSearchBar), new PropertyMetadata(30.0));
|
||||
|
||||
public double SearchButtonSize
|
||||
{
|
||||
get => (double)GetValue(SearchButtonSizeProperty);
|
||||
set => SetValue(SearchButtonSizeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CloseButtonSizeProperty =
|
||||
DependencyProperty.Register(nameof(CloseButtonSize), typeof(double), typeof(InformationClassSearchBar), new PropertyMetadata(30.0));
|
||||
|
||||
public double CloseButtonSize
|
||||
{
|
||||
get => (double)GetValue(CloseButtonSizeProperty);
|
||||
set => SetValue(CloseButtonSizeProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public InformationClassSearchBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_searchIcons = new Dictionary<enumF4sdSearchResultClass, UIElement>
|
||||
{
|
||||
{ enumF4sdSearchResultClass.Phone, PhoneCallIndicator },
|
||||
{ enumF4sdSearchResultClass.User, UserCallIndicator },
|
||||
{ enumF4sdSearchResultClass.Computer, ComputerCallIndicator }
|
||||
};
|
||||
}
|
||||
|
||||
public void BlurInvoker_IsActiveChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
BlurInvoker.InvokeVisibilityChanged(this, new EventArgs());
|
||||
|
||||
if (e.NewValue is bool newVisible)
|
||||
{
|
||||
if (!newVisible)
|
||||
{
|
||||
InnerSearchBar.IsInputEnabled = true;
|
||||
InnerSearchBar.ShowSearchButton = true;
|
||||
WarningIndicator.Visibility = Visibility.Collapsed;
|
||||
TicketOverview.Instance?.ResetSelection();
|
||||
foreach (var entry in _searchIcons.Values)
|
||||
entry.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
SetApiStatus();
|
||||
}
|
||||
|
||||
if (Visibility == Visibility.Visible)
|
||||
Dispatcher.BeginInvoke((Action)(() => InnerSearchBar.FocusInput()), DispatcherPriority.Render);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
SearchStatus = eSearchStatus.message;
|
||||
InnerSearchBar.Clear();
|
||||
}
|
||||
|
||||
public void ActivateManualSearch()
|
||||
{
|
||||
SearchStatus = eSearchStatus.active;
|
||||
InnerSearchBar.ShowSearchButton = true;
|
||||
WarningIndicator.Visibility = Visibility.Collapsed;
|
||||
foreach (var entry in _searchIcons.Values)
|
||||
entry.Visibility = Visibility.Collapsed;
|
||||
|
||||
InnerSearchBar.Clear();
|
||||
InnerSearchBar.IsInputEnabled = true;
|
||||
InnerSearchBar.FocusInput();
|
||||
}
|
||||
|
||||
public void SetSearchText(string search)
|
||||
{
|
||||
SearchStatus = eSearchStatus.active;
|
||||
InnerSearchBar.SetSearchText(search);
|
||||
}
|
||||
|
||||
public void SetSpinnerVisibility(Visibility visibility)
|
||||
{
|
||||
InnerSearchBar.SetSpinnerVisibility(visibility);
|
||||
}
|
||||
|
||||
public async Task SetFixedSearchResultAsync(enumF4sdSearchResultClass resultClass, string search, cFilteredResults result)
|
||||
{
|
||||
SearchStatus = eSearchStatus.fixedResult;
|
||||
InnerSearchBar.IsInputEnabled = false;
|
||||
InnerSearchBar.ShowSearchButton = false;
|
||||
WarningIndicator.Visibility = Visibility.Collapsed;
|
||||
|
||||
foreach (var entryIcon in _searchIcons)
|
||||
entryIcon.Value.Visibility = entryIcon.Key == resultClass ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
InnerSearchBar.SetSearchText(search);
|
||||
|
||||
if (ChangedSearchValue != null)
|
||||
await ChangedSearchValue.Invoke(result);
|
||||
}
|
||||
|
||||
public void SetApiStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
var status = cConnectionStatusHelper.Instance?.ApiConnectionStatus;
|
||||
if (status == null)
|
||||
return;
|
||||
|
||||
bool isEnabled = false;
|
||||
string txt = null;
|
||||
switch (status)
|
||||
{
|
||||
case cConnectionStatusHelper.enumOnlineStatus.online:
|
||||
isEnabled = true;
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.connectionError:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.ConnectError");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.incompatibleServerVersion:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.IncompatibleVersion");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.serverStarting:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.ServerStarting");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.serverNotConfigured:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.ServerNotConfigured");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.illegalConfig:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.IllegalConfig");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.unauthorized:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.Unauthorized");
|
||||
break;
|
||||
default:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.Offline");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isEnabled)
|
||||
{
|
||||
SearchStatus = eSearchStatus.message;
|
||||
InnerSearchBar.SetSearchText(txt);
|
||||
InnerSearchBar.IsInputEnabled = false;
|
||||
WarningIndicator.Visibility = Visibility.Visible;
|
||||
InnerSearchBar.ShowSearchButton = false;
|
||||
foreach (var entry in _searchIcons.Values)
|
||||
entry.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CancelRunningSearchTaskAsync()
|
||||
{
|
||||
lock (_currentSearchTaskLock)
|
||||
{
|
||||
if (_currentSearchTaskToken != null)
|
||||
{
|
||||
LogEntry("Canceling current running search...");
|
||||
_currentSearchTaskToken.Cancel(true);
|
||||
_currentSearchTaskToken = null;
|
||||
}
|
||||
}
|
||||
|
||||
Guid? currentTaskId = null;
|
||||
lock (_currentSearchTaskLock)
|
||||
{
|
||||
if (_currentSearchTaskId != null)
|
||||
{
|
||||
currentTaskId = _currentSearchTaskId;
|
||||
_currentSearchTaskId = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentTaskId != null)
|
||||
{
|
||||
LogEntry("Sending a search stop...");
|
||||
await cFasdCockpitCommunicationBase.Instance.GetSearchResultsStop((Guid)currentTaskId, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
|
||||
private async void InnerSearchBar_SearchValueChanged(object sender, string searchValue)
|
||||
{
|
||||
MethodBase cm = null;
|
||||
if (cLogManager.DefaultLogger.IsDebug) { cm = MethodBase.GetCurrentMethod(); LogMethodBegin(cm); }
|
||||
|
||||
try
|
||||
{
|
||||
await CancelRunningSearchTaskAsync();
|
||||
|
||||
lock (_currentSearchTaskLock)
|
||||
{
|
||||
LogEntry("Start running new search...");
|
||||
SearchValueChanged?.Invoke(this, searchValue);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (cm != null) LogMethodEnd(cm);
|
||||
}
|
||||
}
|
||||
|
||||
private void InnerSearchBar_CancelledSearch(object sender, RoutedEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
RaiseCancledSearchEvent();
|
||||
|
||||
if (cConnectionStatusHelper.Instance?.ApiConnectionStatus == cConnectionStatusHelper.enumOnlineStatus.online)
|
||||
InnerSearchBar.Clear();
|
||||
|
||||
CancledSearchAction?.Invoke();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<string> SearchValueChanged;
|
||||
|
||||
public static readonly RoutedEvent CancledSearchEvent =
|
||||
EventManager.RegisterRoutedEvent(nameof(CancledSearch), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(InformationClassSearchBar));
|
||||
|
||||
public event RoutedEventHandler CancledSearch
|
||||
{
|
||||
add => AddHandler(CancledSearchEvent, value);
|
||||
remove => RemoveHandler(CancledSearchEvent, value);
|
||||
}
|
||||
|
||||
private void RaiseCancledSearchEvent()
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(CancledSearchEvent));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using C4IT.FASD.Base;
|
||||
using F4SD_AdaptableIcon;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
|
||||
using FasdDesktopUi.Basics.Helper;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.Services.SupportCase;
|
||||
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
using FasdDesktopUi.Pages;
|
||||
using FasdDesktopUi.Pages.SearchPage;
|
||||
|
||||
using C4IT.FASD.Base;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using F4SD_AdaptableIcon;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
@@ -26,6 +26,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
#region PopUpIsVisible
|
||||
|
||||
public SupportCaseController SupportCaseController { get; set; }
|
||||
|
||||
internal static readonly DependencyPropertyKey PopUpIsVisibleKey = DependencyProperty.RegisterReadOnly("PopUpIsVisible", typeof(bool), typeof(MenuBar), new PropertyMetadata(false));
|
||||
|
||||
public static readonly DependencyProperty PopUpIsVisibleProperty = PopUpIsVisibleKey.DependencyProperty;
|
||||
@@ -109,7 +111,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
AdaptableIcon.AdaptableIcon menuIcon = new AdaptableIcon.AdaptableIcon() { Style = menuPinnedIconStyle };
|
||||
|
||||
IconData icon = sortedMenuData[i].MenuIcon;
|
||||
IconData icon = sortedMenuData[i].MenuIcon.Icon;
|
||||
if (icon.Intern != null)
|
||||
menuIcon.SelectedInternIcon = icon.Intern;
|
||||
else if(icon.Material != null)
|
||||
@@ -142,17 +144,23 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (sortedMenuData[i].IconPositionIndex >= 0)
|
||||
MenuBarStackPanel.Children.Insert(MenuBarStackPanel.Children.Count - 1, menuIcon);
|
||||
}
|
||||
|
||||
if (cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates.DefaultTemplate != null)
|
||||
|
||||
cCopyTemplate defaultCopyTemplate = null;
|
||||
defaultCopyTemplate = SupportCaseController?.GetCopyTemplate();
|
||||
|
||||
|
||||
if (defaultCopyTemplate != null)
|
||||
{
|
||||
|
||||
|
||||
var copyIcon = new AdaptableIcon.AdaptableIcon()
|
||||
{
|
||||
Style = menuPinnedIconStyle,
|
||||
SelectedInternIcon = enumInternIcons.menuBar_copy,
|
||||
ToolTip = cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates.DefaultTemplate.Descriptions.GetValue(Default: null),
|
||||
ToolTip = defaultCopyTemplate?.Descriptions.GetValue(Default: null),
|
||||
};
|
||||
|
||||
copyIcon.Tag = new cMenuDataBase() { IconPositionIndex = 2, MenuIcon = new F4SD_AdaptableIcon.IconData(enumInternIcons.menuBar_copy), UiAction = new cUiCopyAction(cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates.DefaultTemplate) };
|
||||
copyIcon.Tag = new cMenuDataBase() { IconPositionIndex = 2, MenuIcon = new cMenuDataBase.MenuIconInfo(new F4SD_AdaptableIcon.IconData(enumInternIcons.menuBar_copy)), UiAction = new cUiCopyAction(defaultCopyTemplate) };
|
||||
|
||||
copyIcon.MouseLeftButtonUp += MenuItem_MouseUp;
|
||||
copyIcon.TouchDown += MenuItem_TouchDown;
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
TextChanged="NotepadRichTextBox_TextChanged"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.Widget}"
|
||||
Background="{DynamicResource BackgroundColor.DetailsPage.Widget.Title}"
|
||||
SpellCheck.IsEnabled="True"
|
||||
SelectionChanged="NotepadRichTextBox_SelectionChanged"
|
||||
IsVisibleChanged="NotepadRichTextBox_IsVisibleChanged"
|
||||
GotKeyboardFocus="NotepadRichTextBox_GotKeyboardFocus">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using C4IT.FASD.Base;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics.Helper;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -8,6 +9,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Threading;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
@@ -109,7 +111,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
|
||||
_me.LockNotepadIcon.SelectedInternIcon = _me.IsLocked ? F4SD_AdaptableIcon.Enums.enumInternIcons.lock_closed : F4SD_AdaptableIcon.Enums.enumInternIcons.lock_open;
|
||||
|
||||
|
||||
_me.CloseNotepadIcon.IsEnabled = _me.IsLocked ? false : true;
|
||||
|
||||
}
|
||||
@@ -147,9 +149,9 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch(Exception E)
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
@@ -172,8 +174,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
|
||||
|
||||
|
||||
private void NotepadRichTextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -309,7 +311,11 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (DataProvider is null)
|
||||
return;
|
||||
|
||||
Dispatcher.Invoke(() => DataProvider.SaveCaseNotes());
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
SetLanguageOfDocument();
|
||||
DataProvider.SaveCaseNotes();
|
||||
});
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -317,9 +323,19 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
private void SetLanguageOfDocument()
|
||||
{
|
||||
if (cF4SDCockpitXmlConfig.Instance.HealthCardConfig?.ProtocollLanguage != null)
|
||||
{
|
||||
var languageTag = XmlLanguage.GetLanguage(cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage);
|
||||
TextRange range = new TextRange(NotepadRichTextBox.Document.ContentStart, NotepadRichTextBox.Document.ContentEnd);
|
||||
range.ApplyPropertyValue(FrameworkElement.LanguageProperty, languageTag);
|
||||
}
|
||||
}
|
||||
|
||||
private void NotepadRichTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
saveTimer?.Stop();
|
||||
saveTimer?.Start();
|
||||
|
||||
@@ -734,7 +750,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
return;
|
||||
}
|
||||
NotepadVisibilityChanged?.Invoke(this, true);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<converter:NullValueToVisibilityConverter x:Key="NullToVisibility" />
|
||||
<converter:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border Padding="10"
|
||||
@@ -37,7 +38,7 @@
|
||||
Style="{DynamicResource Menu.Selector.Icon.Lock}"
|
||||
MouseUp="LockButton_MouseUp"
|
||||
TouchDown="LockButton_TouchDown"
|
||||
MouseLeave="LockButton_MouseLeave"/>
|
||||
MouseLeave="LockButton_MouseLeave" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="BackButton"
|
||||
DockPanel.Dock="Left"
|
||||
@@ -74,9 +75,22 @@
|
||||
|
||||
</DockPanel>
|
||||
|
||||
<local:SearchBar x:Name="Search"
|
||||
DockPanel.Dock="Top"
|
||||
PlaceholderText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Searchbar.Placeholder}"
|
||||
ShowCloseButton="False"
|
||||
SearchButtonSize="26"
|
||||
DebounceInterval="0"
|
||||
SearchBackground="{DynamicResource BackgroundColor.DetailsPage.Widget.Title}"
|
||||
SearchValueChanged="SearchBar_SearchValueChanged"
|
||||
Margin="0 0 0 10"
|
||||
Focusable="True"
|
||||
Height="26" />
|
||||
|
||||
<local:CustomMenu x:Name="SubMenuUc"
|
||||
DockPanel.Dock="Top"
|
||||
MenuDataList="{Binding ElementName=QuickActionSelectorUc, Path=QuickActionList}" />
|
||||
MenuDataList="{Binding ElementName=QuickActionSelectorUc, Path=QuickActionList}"
|
||||
Width="270"/>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
using System;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.Logging;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using static FasdDesktopUi.Basics.UserControls.InformationClassSearchBar;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
@@ -25,9 +15,12 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public event EventHandler<string> SearchValueChanged;
|
||||
public Action CloseButtonClickedAction { get; set; }
|
||||
public Action<bool> LockStatusChanged { get; set; }
|
||||
|
||||
public static QuickActionSelector Instance;
|
||||
|
||||
#region IsLocked DependencyProperty
|
||||
|
||||
public bool IsLocked
|
||||
@@ -49,7 +42,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
return;
|
||||
}
|
||||
|
||||
_me.CloseButton.IsEnabled = _me.IsLocked ? false : true;
|
||||
_me.CloseButton.IsEnabled = !_me.IsLocked;
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
@@ -110,10 +103,13 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
public QuickActionSelector()
|
||||
{
|
||||
InitializeComponent();
|
||||
Search.ActivateManualSearch();
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void BlurInvoker_IsActiveChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
Search.IsInputEnabled = this.Visibility == Visibility.Visible;
|
||||
BlurInvoker.InvokeVisibilityChanged(this, new EventArgs());
|
||||
}
|
||||
|
||||
@@ -178,7 +174,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
#region CloseButton
|
||||
|
||||
private void CloseButton_Click()
|
||||
public void CloseButton_Click()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -187,9 +183,16 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
QuickActionList = null;
|
||||
Visibility = Visibility.Collapsed;
|
||||
Search.IsEnabled = true;
|
||||
|
||||
if (CloseButtonClickedAction != null)
|
||||
CloseButtonClickedAction.Invoke();
|
||||
Window window = Window.GetWindow(this);
|
||||
if (window != null)
|
||||
{
|
||||
FocusManager.SetFocusedElement(window, window);
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
CloseButtonClickedAction?.Invoke();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -217,6 +220,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
TempQuickActionSelectorHeading = null;
|
||||
QuickActionList = TempQuickActionList;
|
||||
TempQuickActionList = null;
|
||||
Search.IsEnabled = true;
|
||||
Search.FocusInput();
|
||||
}
|
||||
|
||||
private void BackButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
@@ -230,5 +235,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SearchBar_SearchValueChanged(object sender, string e)
|
||||
=> SearchValueChanged?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
set { SetValue(QuickTipNameProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for QuickTipName. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty QuickTipNameProperty =
|
||||
DependencyProperty.Register("QuickTipName", typeof(string), typeof(QuickTipStatusMonitor), new PropertyMetadata("Quick Tip Name"));
|
||||
|
||||
@@ -44,7 +43,6 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
set { SetValue(QuickTipIconProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for QuickTipIcon. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty QuickTipIconProperty =
|
||||
DependencyProperty.Register("QuickTipIcon", typeof(IconData), typeof(QuickTipStatusMonitor), new PropertyMetadata(new IconData(enumInternIcons.none)));
|
||||
|
||||
@@ -58,7 +56,6 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
set { SetValue(QuickTipElementDataProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for QuickTipElementData. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty QuickTipElementDataProperty =
|
||||
DependencyProperty.Register("QuickTipElementData", typeof(List<cUiQuickTipElement>), typeof(QuickTipStatusMonitor), new PropertyMetadata(new List<cUiQuickTipElement>(), HandleQuickTipElementDataChanged));
|
||||
|
||||
@@ -94,20 +91,6 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
|
||||
#endregion
|
||||
|
||||
#region HasFocusIndex
|
||||
|
||||
public int HasFocusIndex
|
||||
{
|
||||
get { return (int)GetValue(HasFocusIndexProperty); }
|
||||
set { SetValue(HasFocusIndexProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for HasFocusIndex. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty HasFocusIndexProperty =
|
||||
DependencyProperty.Register("HasFocusIndex", typeof(int), typeof(QuickTipStatusMonitor), new PropertyMetadata(0));
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public QuickTipStatusMonitor()
|
||||
@@ -255,8 +238,14 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
return;
|
||||
|
||||
bool wasSuccessfull = step.SuccessState == enumQuickActionSuccess.finished || step.SuccessState == enumQuickActionSuccess.successfull;
|
||||
|
||||
string currentLanguage = cMultiLanguageSupport.CurrentLanguage;
|
||||
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage ?? currentLanguage;
|
||||
|
||||
ProtocollEntryBase protocollEntry = QuickTipStepProtocollEntryOutput.GetQuickTipStepProtocollEntry(step.StepData.QuickTipElementDefinition, wasSuccessfull);
|
||||
|
||||
cMultiLanguageSupport.CurrentLanguage = currentLanguage;
|
||||
|
||||
F4SDProtocoll.Instance.Add(protocollEntry);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -331,26 +320,40 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
QuickTipElementData = new List<cUiQuickTipElement>();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, InputEventArgs args) => CancelQuickTip();
|
||||
private void CancelButton_Click(object sender, InputEventArgs args) => TryCancelQuickTip();
|
||||
|
||||
private void CancelQuickTip()
|
||||
/// <returns>If QuickTip could be canceled</returns>
|
||||
internal bool TryCancelQuickTip()
|
||||
{
|
||||
if (_stepList.Any(step => step.SuccessState != enumQuickActionSuccess.unknown))
|
||||
if (CustomMessageBox.Show(cMultiLanguageSupport.GetItem("QuickTips.Dialog.Cancel"), "Quick Tip", enumHealthCardStateLevel.Warning, null, true) != true)
|
||||
return;
|
||||
return false;
|
||||
|
||||
Visibility = Visibility.Collapsed;
|
||||
|
||||
int finishedStepCount = _stepList.Count(step => step.SuccessState == enumQuickActionSuccess.finished);
|
||||
AddQuickTipEndToProtocoll(QuickTipName, finishedStepCount, _stepList.Count, true);
|
||||
QuickTipElementData = new List<cUiQuickTipElement>();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddQuickTipEndToProtocoll(string quickTipName, int finishedStepCount, int totalStepCount, bool wasCanceled)
|
||||
{
|
||||
string ascii = wasCanceled ? cMultiLanguageSupport.GetItem("QuickTips.Copy.Cancel") : cMultiLanguageSupport.GetItem("QuickTips.Copy.Finish");
|
||||
ascii = string.Format(ascii, quickTipName, finishedStepCount, totalStepCount);
|
||||
F4SDProtocoll.Instance.Add(new TextualProtocollEntry(ascii, ascii));
|
||||
string currentLanguage = cMultiLanguageSupport.CurrentLanguage;
|
||||
|
||||
try
|
||||
{
|
||||
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage ?? currentLanguage;
|
||||
|
||||
string ascii = wasCanceled ? cMultiLanguageSupport.GetItem("QuickTips.Copy.Cancel") : cMultiLanguageSupport.GetItem("QuickTips.Copy.Finish");
|
||||
ascii = string.Format(ascii, quickTipName, finishedStepCount, totalStepCount);
|
||||
|
||||
F4SDProtocoll.Instance.Add(new TextualProtocollEntry(ascii, ascii));
|
||||
}
|
||||
finally
|
||||
{
|
||||
cMultiLanguageSupport.CurrentLanguage = currentLanguage;
|
||||
}
|
||||
}
|
||||
|
||||
private void QuickTipStatusMonitorUc_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
@@ -358,9 +361,21 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
|
||||
if (!IsVisible)
|
||||
return;
|
||||
|
||||
string ascii = cMultiLanguageSupport.GetItem("QuickTips.Copy.Start");
|
||||
ascii = string.Format(ascii, QuickTipName);
|
||||
F4SDProtocoll.Instance.Add(new TextualProtocollEntry(ascii, ascii));
|
||||
string currentLanguage = cMultiLanguageSupport.CurrentLanguage;
|
||||
|
||||
try
|
||||
{
|
||||
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage ?? currentLanguage;
|
||||
|
||||
string ascii = cMultiLanguageSupport.GetItem("QuickTips.Copy.Start");
|
||||
ascii = string.Format(ascii, QuickTipName);
|
||||
|
||||
F4SDProtocoll.Instance.Add(new TextualProtocollEntry(ascii, ascii));
|
||||
}
|
||||
finally
|
||||
{
|
||||
cMultiLanguageSupport.CurrentLanguage = currentLanguage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,19 @@
|
||||
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"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Name="_this"
|
||||
IsVisibleChanged="BlurInvoker_IsActiveChanged"
|
||||
Name="Search"
|
||||
Loaded="SearchBar_Loaded">
|
||||
|
||||
<UserControl.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
<Border Background="{Binding ElementName=Search, Path=SearchBackground}"
|
||||
CornerRadius="17.5"
|
||||
Margin="-2.5"
|
||||
Padding="2.5"
|
||||
@@ -29,47 +27,15 @@
|
||||
<ico:AdaptableIcon x:Name="SearchButton"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Visibility="{Binding ShowSearchButton, ElementName=Search, Converter={StaticResource BoolToVisibility}}"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
MouseUp="SearchButton_Click"
|
||||
TouchDown="SearchButton_Click"
|
||||
IconBackgroundColor="Transparent"
|
||||
IconHeight="{Binding SearchButtonSize, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IconWidth="{Binding SearchButtonSize, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IconHeight="{Binding SearchButtonSize, ElementName=Search}"
|
||||
IconWidth="{Binding SearchButtonSize, ElementName=Search}"
|
||||
SelectedInternIcon="menuBar_search" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="PhoneCallIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
Visibility="Collapsed"
|
||||
SelectedMaterialIcon="ic_phone" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="ComputerCallIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
Visibility="Collapsed"
|
||||
SelectedInternIcon="misc_computer" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="UserCallIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
Visibility="Collapsed"
|
||||
SelectedInternIcon="misc_user" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="WarningIndicator"
|
||||
x:FieldModifier="private"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon}"
|
||||
IconBackgroundColor="Transparent"
|
||||
PrimaryIconColor="#FFFF8800"
|
||||
Visibility="Collapsed"
|
||||
SelectedInternIcon="status_bad" />
|
||||
|
||||
<Grid DockPanel.Dock="Left">
|
||||
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
@@ -83,7 +49,7 @@
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchTextBox}"
|
||||
Value="">
|
||||
<Setter Property="Text"
|
||||
Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Searchbar.Placeholder.UserName}" />
|
||||
Value="{Binding PlaceholderText, ElementName=Search}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -92,7 +58,8 @@
|
||||
|
||||
<TextBox x:Name="SearchTextBox"
|
||||
x:FieldModifier="private"
|
||||
Text="{Binding ElementName=_this, Path=SearchValue, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
|
||||
IsEnabled="{Binding IsInputEnabled, ElementName=Search}"
|
||||
Text="{Binding ElementName=Search, Path=SearchValue, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
|
||||
Style="{DynamicResource SearchBar.TextBox}" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
@@ -114,11 +81,13 @@
|
||||
</TransformGroup>
|
||||
</ico:AdaptableIcon.RenderTransform>
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
<ico:AdaptableIcon x:Name="CloseButton"
|
||||
x:FieldModifier="private"
|
||||
Visibility="{Binding ShowCloseButton, ElementName=Search, Converter={StaticResource BoolToVisibility}}"
|
||||
Style="{DynamicResource SettingsPage.Close.Icon}"
|
||||
IconHeight="{Binding CloseButtonSize, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IconWidth="{Binding CloseButtonSize, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IconHeight="{Binding CloseButtonSize, ElementName=Search}"
|
||||
IconWidth="{Binding CloseButtonSize, ElementName=Search}"
|
||||
Margin="-3 0 0 0"
|
||||
Padding="0"
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Close}"
|
||||
|
||||
@@ -1,38 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
using C4IT.Logging;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using C4IT.MultiLanguage;
|
||||
using C4IT.FASD.Base;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
public partial class SearchBar : UserControl, IBlurInvoker
|
||||
public partial class SearchBar : UserControl
|
||||
{
|
||||
private const int constTimeBetweenKeystrokes = 250;
|
||||
|
||||
#region Propeties
|
||||
public enum eSearchStatus { message, active, fixedResult };
|
||||
public eSearchStatus SearchStatus { get; private set; } = eSearchStatus.message;
|
||||
|
||||
#region Search Value Property
|
||||
|
||||
private readonly DispatcherTimer _searchTimer = new DispatcherTimer();
|
||||
|
||||
private static CancellationTokenSource _currentSearchTaskToken = null;
|
||||
private static Guid? _currentSearchTaskId = null;
|
||||
private static readonly object _currentSearchTaskLock = new object();
|
||||
#region Dependency Properties
|
||||
|
||||
public static readonly DependencyProperty SearchButtonSizeProperty =
|
||||
DependencyProperty.Register(nameof(SearchButtonSize), typeof(double), typeof(SearchBar), new PropertyMetadata(30.0));
|
||||
|
||||
public double SearchButtonSize
|
||||
{
|
||||
get => (double)GetValue(SearchButtonSizeProperty);
|
||||
set => SetValue(SearchButtonSizeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CloseButtonSizeProperty =
|
||||
DependencyProperty.Register(nameof(CloseButtonSize), typeof(double), typeof(SearchBar), new PropertyMetadata(30.0));
|
||||
|
||||
public double CloseButtonSize
|
||||
{
|
||||
get => (double)GetValue(CloseButtonSizeProperty);
|
||||
set => SetValue(CloseButtonSizeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty =
|
||||
DependencyProperty.Register(nameof(ShowCloseButton), typeof(bool), typeof(SearchBar), new PropertyMetadata(true));
|
||||
|
||||
public bool ShowCloseButton
|
||||
{
|
||||
get => (bool)GetValue(ShowCloseButtonProperty);
|
||||
set => SetValue(ShowCloseButtonProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowSearchButtonProperty =
|
||||
DependencyProperty.Register(nameof(ShowSearchButton), typeof(bool), typeof(SearchBar), new PropertyMetadata(true));
|
||||
|
||||
public bool ShowSearchButton
|
||||
{
|
||||
get => (bool)GetValue(ShowSearchButtonProperty);
|
||||
set => SetValue(ShowSearchButtonProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PlaceholderTextProperty =
|
||||
DependencyProperty.Register(nameof(PlaceholderText), typeof(string), typeof(SearchBar), new PropertyMetadata(string.Empty));
|
||||
|
||||
public string PlaceholderText
|
||||
{
|
||||
get => (string)GetValue(PlaceholderTextProperty);
|
||||
set => SetValue(PlaceholderTextProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DebounceIntervalProperty =
|
||||
DependencyProperty.Register(nameof(DebounceInterval), typeof(TimeSpan), typeof(SearchBar),
|
||||
new PropertyMetadata(TimeSpan.FromMilliseconds(250), OnDebounceIntervalChanged));
|
||||
|
||||
public TimeSpan DebounceInterval
|
||||
{
|
||||
get => (TimeSpan)GetValue(DebounceIntervalProperty);
|
||||
set => SetValue(DebounceIntervalProperty, value);
|
||||
}
|
||||
|
||||
private static void OnDebounceIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((SearchBar)d)._searchTimer.Interval = (TimeSpan)e.NewValue;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsInputEnabledProperty =
|
||||
DependencyProperty.Register(nameof(IsInputEnabled), typeof(bool), typeof(SearchBar), new PropertyMetadata(true));
|
||||
|
||||
public bool IsInputEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsInputEnabledProperty);
|
||||
set => SetValue(IsInputEnabledProperty, value);
|
||||
}
|
||||
|
||||
public SolidColorBrush SearchBackground
|
||||
{
|
||||
get { return (SolidColorBrush)GetValue(SearchBackgroundProperty); }
|
||||
set { SetValue(SearchBackgroundProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SearchBackgroundProperty =
|
||||
DependencyProperty.Register(nameof(SearchBackground), typeof(SolidColorBrush), typeof(SearchBar), new PropertyMetadata(null));
|
||||
|
||||
#endregion
|
||||
|
||||
#region SearchValue
|
||||
|
||||
private string _searchValue = null;
|
||||
public string SearchValue
|
||||
@@ -43,111 +104,49 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (value != _searchValue)
|
||||
{
|
||||
_searchValue = value;
|
||||
if (SearchStatus == eSearchStatus.active)
|
||||
if (IsInputEnabled)
|
||||
HandleSearchValueChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Dictionary<enumF4sdSearchResultClass, UIElement> _searchIcons = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<string> SearchValueChanged;
|
||||
|
||||
public delegate Task ChangedSearchValueDelegate(cFilteredResults results);
|
||||
public static readonly RoutedEvent CancelledSearchEvent =
|
||||
EventManager.RegisterRoutedEvent(nameof(CancelledSearch), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SearchBar));
|
||||
|
||||
public ChangedSearchValueDelegate ChangedSearchValue { get; set; } = null;
|
||||
|
||||
public Action CancledSearchAction { get; set; }
|
||||
|
||||
public bool BlurInvoker_IsActive => IsVisible;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dependency Propertys
|
||||
|
||||
public double SearchButtonSize
|
||||
public event RoutedEventHandler CancelledSearch
|
||||
{
|
||||
get { return (double)GetValue(SearchButtonSizeProperty); }
|
||||
set { SetValue(SearchButtonSizeProperty, value); }
|
||||
add => AddHandler(CancelledSearchEvent, value);
|
||||
remove => RemoveHandler(CancelledSearchEvent, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SearchButtonSizeProperty =
|
||||
DependencyProperty.Register("SearchButtonSize", typeof(double), typeof(SearchBar), new PropertyMetadata(30.0));
|
||||
|
||||
public double CloseButtonSize
|
||||
{
|
||||
get { return (double)GetValue(CloseButtonSizeProperty); }
|
||||
set { SetValue(CloseButtonSizeProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CloseButtonSizeProperty =
|
||||
DependencyProperty.Register("CloseButtonSize", typeof(double), typeof(SearchBar), new PropertyMetadata(30.0));
|
||||
#endregion
|
||||
|
||||
public SearchBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_searchIcons = new Dictionary<enumF4sdSearchResultClass, UIElement>()
|
||||
{
|
||||
{ enumF4sdSearchResultClass.Phone, PhoneCallIndicator },
|
||||
{ enumF4sdSearchResultClass.User, UserCallIndicator },
|
||||
{ enumF4sdSearchResultClass.Computer, ComputerCallIndicator }
|
||||
};
|
||||
}
|
||||
|
||||
public void BlurInvoker_IsActiveChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
BlurInvoker.InvokeVisibilityChanged(this, new EventArgs());
|
||||
|
||||
if (e.NewValue is bool newVisible)
|
||||
{
|
||||
if (newVisible == false)
|
||||
{
|
||||
SearchTextBox.IsEnabled = true;
|
||||
SearchButton.Visibility = Visibility.Visible;
|
||||
WarningIndicator.Visibility = Visibility.Collapsed;
|
||||
TicketOverview.Instance?.ResetSelection();
|
||||
foreach (var Entry in _searchIcons.Values)
|
||||
Entry.Visibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
SetApiStatus();
|
||||
}
|
||||
|
||||
if (Visibility == Visibility.Visible)
|
||||
{
|
||||
var _h = Dispatcher.BeginInvoke((Action)delegate { Keyboard.Focus(SearchTextBox); }, DispatcherPriority.Render);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
SearchStatus = eSearchStatus.message;
|
||||
SearchTextBox.Text = null;
|
||||
}
|
||||
|
||||
public void ActivateManualSearch()
|
||||
{
|
||||
SearchStatus = eSearchStatus.active;
|
||||
SearchButton.Visibility = Visibility.Visible;
|
||||
WarningIndicator.Visibility = Visibility.Collapsed;
|
||||
foreach (var Entry in _searchIcons.Values)
|
||||
Entry.Visibility = Visibility.Collapsed;
|
||||
|
||||
SearchTextBox.Text = null;
|
||||
SearchTextBox.IsEnabled = true;
|
||||
SearchTextBox.Focus();
|
||||
Keyboard.Focus(SearchTextBox);
|
||||
}
|
||||
|
||||
public void SetSearchText(string search)
|
||||
{
|
||||
SearchStatus = eSearchStatus.active;
|
||||
SearchTextBox.Text = search;
|
||||
SearchTextBox.CaretIndex = search.Length;
|
||||
SearchTextBox.CaretIndex = search?.Length ?? 0;
|
||||
SearchTextBox.Focus();
|
||||
Keyboard.Focus(SearchTextBox);
|
||||
}
|
||||
|
||||
public void FocusInput()
|
||||
{
|
||||
SearchTextBox.Focus();
|
||||
Keyboard.Focus(SearchTextBox);
|
||||
}
|
||||
@@ -157,165 +156,18 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
Dispatcher.Invoke(() => SearchSpinner.Visibility = visibility);
|
||||
}
|
||||
|
||||
public async Task SetFixedSearchResultAsync(enumF4sdSearchResultClass Class, string search, cFilteredResults result)
|
||||
{
|
||||
SearchStatus = eSearchStatus.fixedResult;
|
||||
SearchTextBox.IsEnabled = false;
|
||||
SearchButton.Visibility = Visibility.Collapsed;
|
||||
WarningIndicator.Visibility = Visibility.Collapsed;
|
||||
|
||||
foreach (var entryIcon in _searchIcons)
|
||||
{
|
||||
if (Class == entryIcon.Key)
|
||||
entryIcon.Value.Visibility = Visibility.Visible;
|
||||
else
|
||||
entryIcon.Value.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
SearchTextBox.Text = search;
|
||||
|
||||
if (ChangedSearchValue != null)
|
||||
await ChangedSearchValue.Invoke(result);
|
||||
}
|
||||
|
||||
public void SetApiStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
var Status = cConnectionStatusHelper.Instance?.ApiConnectionStatus;
|
||||
if (Status == null)
|
||||
return;
|
||||
|
||||
bool IsEnabled = false;
|
||||
string txt = null;
|
||||
switch (Status)
|
||||
{
|
||||
case cConnectionStatusHelper.enumOnlineStatus.online:
|
||||
IsEnabled = true;
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.connectionError:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.ConnectError");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.incompatibleServerVersion:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.IncompatibleVersion");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.serverStarting:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.ServerStarting");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.serverNotConfigured:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.ServerNotConfigured");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.illegalConfig:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.IllegalConfig");
|
||||
break;
|
||||
case cConnectionStatusHelper.enumOnlineStatus.unauthorized:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.Unauthorized");
|
||||
break;
|
||||
default:
|
||||
txt = cMultiLanguageSupport.GetItem("Searchbar.Status.Offline");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!IsEnabled)
|
||||
{
|
||||
SearchStatus = eSearchStatus.message;
|
||||
SearchTextBox.Text = txt;
|
||||
SearchTextBox.IsEnabled = false;
|
||||
WarningIndicator.Visibility = Visibility.Visible;
|
||||
SearchButton.Visibility = Visibility.Collapsed;
|
||||
foreach (var Entry in _searchIcons.Values)
|
||||
Entry.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CancelRunningSearchTaskAsync()
|
||||
{
|
||||
// cancel the search task, in case of a running search task
|
||||
lock (_currentSearchTaskLock)
|
||||
{
|
||||
if (_currentSearchTaskToken != null)
|
||||
{
|
||||
LogEntry("Canceling current running search...");
|
||||
_currentSearchTaskToken.Cancel(true);
|
||||
_currentSearchTaskToken = null;
|
||||
}
|
||||
}
|
||||
|
||||
// send a stop to the server, in case of a running search task
|
||||
Guid? currentTaskId = null;
|
||||
lock (_currentSearchTaskLock)
|
||||
{
|
||||
if (_currentSearchTaskId != null)
|
||||
{
|
||||
currentTaskId = _currentSearchTaskId;
|
||||
_currentSearchTaskId = null;
|
||||
}
|
||||
}
|
||||
if (currentTaskId != null)
|
||||
{
|
||||
LogEntry("Sending a search stop...");
|
||||
await cFasdCockpitCommunicationBase.Instance.GetSearchResultsStop((Guid)currentTaskId, CancellationToken.None);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async void UpdateSearchResultsTick(object sender, EventArgs e)
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
try
|
||||
{
|
||||
_searchTimer.Stop();
|
||||
|
||||
await CancelRunningSearchTaskAsync();
|
||||
|
||||
lock (_currentSearchTaskLock)
|
||||
{
|
||||
LogEntry("Start running new search...");
|
||||
SearchValueChanged?.Invoke(this, SearchValue);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSearchValueChanged()
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
if (_searchTimer.IsEnabled)
|
||||
_searchTimer.Stop();
|
||||
|
||||
try
|
||||
{
|
||||
if (!SearchTextBox.IsEnabled)
|
||||
return;
|
||||
_searchTimer.Start();
|
||||
}
|
||||
|
||||
if (_searchTimer.IsEnabled)
|
||||
_searchTimer.Stop();
|
||||
|
||||
_searchTimer.Start();
|
||||
|
||||
_ = Task.Run(async () => { await CancelRunningSearchTaskAsync(); });
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
private void SearchTimerTick(object sender, EventArgs e)
|
||||
{
|
||||
_searchTimer.Stop();
|
||||
SearchValueChanged?.Invoke(this, SearchValue);
|
||||
}
|
||||
|
||||
private void SearchButton_Click(object sender, InputEventArgs e)
|
||||
@@ -323,40 +175,28 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
SearchTextBox.Focus();
|
||||
}
|
||||
|
||||
#region CancledSearch Event
|
||||
|
||||
public static readonly RoutedEvent CancledSearchEvent = EventManager.RegisterRoutedEvent("CancledSearch", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SearchBar));
|
||||
|
||||
public event RoutedEventHandler CancledSearch
|
||||
{
|
||||
add { AddHandler(CancledSearchEvent, value); }
|
||||
remove { RemoveHandler(CancledSearchEvent, value); }
|
||||
}
|
||||
|
||||
private void RaiseCancledSearchEvent()
|
||||
{
|
||||
RoutedEventArgs newEventArgs = new RoutedEventArgs(CancledSearchEvent);
|
||||
RaiseEvent(newEventArgs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void CloseButton_Click(object sender, InputEventArgs e)
|
||||
{
|
||||
RaiseCancledSearchEvent();
|
||||
|
||||
if (cConnectionStatusHelper.Instance?.ApiConnectionStatus == cConnectionStatusHelper.enumOnlineStatus.online)
|
||||
SearchTextBox.Text = null;
|
||||
|
||||
CancledSearchAction?.Invoke();
|
||||
RaiseEvent(new RoutedEventArgs(CancelledSearchEvent));
|
||||
}
|
||||
|
||||
private void SearchBar_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_searchTimer.Stop();
|
||||
_searchTimer.Interval = TimeSpan.FromMilliseconds(constTimeBetweenKeystrokes);
|
||||
_searchTimer.Tick += UpdateSearchResultsTick;
|
||||
_searchTimer.Interval = DebounceInterval;
|
||||
_searchTimer.Tick += SearchTimerTick;
|
||||
BackgroundBorder.CornerRadius = new CornerRadius(BackgroundBorder.ActualHeight / 2.0);
|
||||
}
|
||||
|
||||
internal void ActivateManualSearch()
|
||||
{
|
||||
Search.Clear();
|
||||
Search.IsInputEnabled = true;
|
||||
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
Search.FocusInput();
|
||||
}), DispatcherPriority.Input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
MenuData = new cMenuDataBase()
|
||||
{
|
||||
MenuText = cMultiLanguageSupport.GetItem("SearchBar.NoResults"),
|
||||
MenuIcon = new IconData(enumInternIcons.menuBar_search_noResults)
|
||||
MenuIcon = new cMenuDataBase.MenuIconInfo(new IconData(enumInternIcons.menuBar_search_noResults))
|
||||
}
|
||||
};
|
||||
MainStackPanel.Children.Add(resultItemControl);
|
||||
@@ -236,7 +236,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
var menuData = new cMenuDataBase() { MenuText = historyEntry.DisplayText, UiAction = new cUiProcessSearchHistoryEntry(historyEntry) };
|
||||
if (historyEntry.isSeen)
|
||||
{
|
||||
menuData.MenuIcon = new IconData(MaterialIcons.MaterialIconType.ic_visibility);
|
||||
menuData.MenuIcon = new cMenuDataBase.MenuIconInfo(new IconData(MaterialIcons.MaterialIconType.ic_visibility));
|
||||
menuData.MenuIconSize = 0.75;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,31 +5,33 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Basics.UserControls"
|
||||
xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:vd="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
xmlns:vc="clr-namespace:C4IT.MultiLanguage;assembly=F4SD-Cockpit-Client-Base"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Initialized="UserControl_Initialized">
|
||||
Initialized="UserControl_Initialized">
|
||||
|
||||
<UserControl.Resources>
|
||||
<vd:LanguageDefinitionsConverter x:Key="LanguageConverter"/>
|
||||
|
||||
<!-- Style für den Hovereffekt -->
|
||||
<Style x:Key="PauseButtonHoverStyle" TargetType="Border">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<vd:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
|
||||
<Style x:Key="PauseButtonHoverStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource Background.Menu.Icon.Hover}"/>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource Background.Menu.Icon.Hover}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Padding="8"
|
||||
@@ -45,71 +47,72 @@
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TimerView.Time.ToolTip}"
|
||||
Foreground="{DynamicResource Color.Menu.Icon}" />
|
||||
</Border>
|
||||
|
||||
<Border Padding="20 5 5 5"
|
||||
|
||||
<Border Padding="20 5 5 5"
|
||||
Grid.Column="1"
|
||||
Width="Auto"
|
||||
Height="33"
|
||||
Cursor="Hand"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="5"
|
||||
CornerRadius="5"
|
||||
Margin="-5 0 0 0"
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TimerView.Pausebutton.ToolTip}"
|
||||
Style="{DynamicResource PauseButtonHoverStyle}"
|
||||
MouseLeftButtonUp="Border_MouseLeftButtonUp" TouchDown="Border_TouchDown"
|
||||
>
|
||||
MouseLeftButtonUp="Border_Click"
|
||||
TouchDown="Border_Click">
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
|
||||
<ico:AdaptableIcon Grid.Column="1"
|
||||
<ico:AdaptableIcon Grid.Column="1"
|
||||
x:Name="PauseButton"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="-15 0 5 0"
|
||||
Margin="-15 0 5 0"
|
||||
Panel.ZIndex="2"
|
||||
BorderPadding="0"
|
||||
IconHeight="22"
|
||||
IconWidth="22"
|
||||
SelectedMaterialIcon="ic_pause_circle_outline"
|
||||
SelectedMaterialIcon="ic_pause_circle_outline"
|
||||
IconBackgroundColor="Transparent">
|
||||
<ico:AdaptableIcon.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource Menu.MenuBar.PinnedIcon.Pinned}">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}"/>
|
||||
Value="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource FontColor.Menu.Categories.Hover}"/>
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.FunctionMarker}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ico:AdaptableIcon.Resources>
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
<TextBlock Grid.Column="2" Text="Pause">
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="Pause">
|
||||
<TextBlock.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment"
|
||||
Value="Center"/>
|
||||
Value="Center" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center"/>
|
||||
Value="Center" />
|
||||
<Setter Property="FontSize"
|
||||
Value="16"/>
|
||||
Value="16" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}"/>
|
||||
Value="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Setter Property="Margin"
|
||||
Value="0 0 0 2"/>
|
||||
Value="0 0 0 2" />
|
||||
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
|
||||
Value="True">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.Menu.Categories.Hover}"/>
|
||||
Value="{DynamicResource Color.FunctionMarker}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -15,18 +15,18 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
public event EventHandler<EventArgs> OnPauseStarted;
|
||||
|
||||
private static List<DateTime> startTimes = new List<DateTime>();
|
||||
private static List<DateTime> endTimes = new List<DateTime>();
|
||||
private static List<DateTime> pausedTimesStart = new List<DateTime>();
|
||||
private static List<DateTime> pausedTimesEnd = new List<DateTime>();
|
||||
private static readonly List<DateTime> _startTimes = new List<DateTime>();
|
||||
private static readonly List<DateTime> _endTimes = new List<DateTime>();
|
||||
private static readonly List<DateTime> _pausedTimesStart = new List<DateTime>();
|
||||
private static readonly List<DateTime> _pausedTimesEnd = new List<DateTime>();
|
||||
|
||||
public static List<cF4SDCaseTime> caseTimes = new List<cF4SDCaseTime>();
|
||||
private static Dictionary<string, object> finalWorkingTimes = new Dictionary<string, object>();
|
||||
public static List<cF4SDCaseTime> CaseTimes = new List<cF4SDCaseTime>();
|
||||
private static Dictionary<string, object> _finalWorkingTimes = new Dictionary<string, object>();
|
||||
|
||||
private static DispatcherTimer timer;
|
||||
private static TimeSpan elapsedTime;
|
||||
private static TimeSpan totalPausedTime = TimeSpan.Zero;
|
||||
private static TimeSpan pauseDuration;
|
||||
private static DispatcherTimer _timer;
|
||||
private static TimeSpan _elapsedTime;
|
||||
private static TimeSpan _totalPausedTime = TimeSpan.Zero;
|
||||
private static TimeSpan _pauseDuration;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -39,13 +39,13 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
public static void ResetTimer()
|
||||
{
|
||||
startTimes.Clear();
|
||||
endTimes.Clear();
|
||||
pausedTimesEnd.Clear();
|
||||
pausedTimesStart.Clear();
|
||||
finalWorkingTimes.Clear();
|
||||
elapsedTime = TimeSpan.Zero;
|
||||
caseTimes.Clear();
|
||||
_startTimes.Clear();
|
||||
_endTimes.Clear();
|
||||
_pausedTimesEnd.Clear();
|
||||
_pausedTimesStart.Clear();
|
||||
_finalWorkingTimes.Clear();
|
||||
_elapsedTime = TimeSpan.Zero;
|
||||
CaseTimes.Clear();
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
@@ -54,8 +54,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
try
|
||||
{
|
||||
startTimes?.Add(DateTime.UtcNow);
|
||||
timer?.Start();
|
||||
_startTimes?.Add(DateTime.UtcNow);
|
||||
_timer?.Start();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -67,8 +67,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
try
|
||||
{
|
||||
endTimes?.Add(DateTime.UtcNow);
|
||||
timer?.Stop();
|
||||
_endTimes?.Add(DateTime.UtcNow);
|
||||
_timer?.Stop();
|
||||
UpdateTimerControl();
|
||||
}
|
||||
catch (Exception E)
|
||||
@@ -83,7 +83,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
ResetTimer();
|
||||
|
||||
timer = new DispatcherTimer(TimeSpan.FromSeconds(1.0), DispatcherPriority.Loaded, new EventHandler((s, args) =>
|
||||
_timer = new DispatcherTimer(TimeSpan.FromSeconds(1.0), DispatcherPriority.Loaded, new EventHandler((s, args) =>
|
||||
{
|
||||
try { UpdateTimerControl(); }
|
||||
catch { }
|
||||
@@ -100,8 +100,8 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
try
|
||||
{
|
||||
TimerControl.Text = elapsedTime.ToString(@"hh\:mm\:ss");
|
||||
elapsedTime = elapsedTime.Add(TimeSpan.FromSeconds(1.0));
|
||||
TimerControl.Text = _elapsedTime.ToString(@"hh\:mm\:ss");
|
||||
_elapsedTime = _elapsedTime.Add(TimeSpan.FromSeconds(1.0));
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -113,44 +113,44 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentDate = DateTime.Now.Date.ToString("d");
|
||||
var startDateTime = startTimes.First();
|
||||
var currentDate = DateTime.UtcNow.Date.ToString("d");
|
||||
var startDateTime = _startTimes.First();
|
||||
var endDateTime = DateTime.UtcNow;
|
||||
var bruttoWorkingTime = TimeSpan.Zero;
|
||||
var nettoWorkingTime = TimeSpan.Zero;
|
||||
|
||||
if (pausedTimesStart.Count == 0)
|
||||
if (_pausedTimesStart.Count == 0)
|
||||
{
|
||||
totalPausedTime = TimeSpan.Zero;
|
||||
_totalPausedTime = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
if (pausedTimesEnd.Count > 0)
|
||||
if (_pausedTimesEnd.Count > 0)
|
||||
{
|
||||
totalPausedTime = TimeSpan.Zero;
|
||||
_totalPausedTime = TimeSpan.Zero;
|
||||
|
||||
for (int i = 0; i < pausedTimesStart.Count; i++)
|
||||
for (int i = 0; i < _pausedTimesStart.Count; i++)
|
||||
{
|
||||
var start = pausedTimesStart[i];
|
||||
var end = pausedTimesEnd[i];
|
||||
var start = _pausedTimesStart[i];
|
||||
var end = _pausedTimesEnd[i];
|
||||
|
||||
pauseDuration = end - start;
|
||||
_pauseDuration = end - start;
|
||||
|
||||
totalPausedTime += pauseDuration;
|
||||
_totalPausedTime += _pauseDuration;
|
||||
}
|
||||
}
|
||||
|
||||
bruttoWorkingTime = endDateTime - startDateTime;
|
||||
|
||||
nettoWorkingTime = bruttoWorkingTime - totalPausedTime;
|
||||
nettoWorkingTime = bruttoWorkingTime - _totalPausedTime;
|
||||
|
||||
finalWorkingTimes = new Dictionary<string, object>()
|
||||
_finalWorkingTimes = new Dictionary<string, object>()
|
||||
{
|
||||
{"CurrentDate", currentDate},
|
||||
{"StartTime", startTimes.First()},
|
||||
{"StartTime", _startTimes.First()},
|
||||
{"EndTime", endDateTime },
|
||||
{"BruttoWorkingTime", bruttoWorkingTime },
|
||||
{"NettoWorkingTime", nettoWorkingTime.TotalSeconds },
|
||||
{"TotalPausedTime", totalPausedTime }
|
||||
{"TotalPausedTime", _totalPausedTime }
|
||||
};
|
||||
}
|
||||
catch (Exception E)
|
||||
@@ -158,7 +158,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
return finalWorkingTimes;
|
||||
return _finalWorkingTimes;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -169,13 +169,13 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
try
|
||||
{
|
||||
if (timer?.IsEnabled == true)
|
||||
if (_timer?.IsEnabled == true)
|
||||
return;
|
||||
|
||||
timer?.Start();
|
||||
pausedTimesEnd?.Add(DateTime.UtcNow);
|
||||
_timer?.Start();
|
||||
_pausedTimesEnd?.Add(DateTime.UtcNow);
|
||||
|
||||
caseTimes.Add(new cF4SDCaseTime()
|
||||
CaseTimes.Add(new cF4SDCaseTime()
|
||||
{
|
||||
StatusId = CaseStatus.InProgress,
|
||||
CaseTime = DateTime.UtcNow
|
||||
@@ -191,10 +191,10 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
try
|
||||
{
|
||||
timer?.Stop();
|
||||
pausedTimesStart?.Add(DateTime.UtcNow);
|
||||
_timer?.Stop();
|
||||
_pausedTimesStart?.Add(DateTime.UtcNow);
|
||||
|
||||
caseTimes.Add(new cF4SDCaseTime()
|
||||
CaseTimes.Add(new cF4SDCaseTime()
|
||||
{
|
||||
StatusId = CaseStatus.OnHold,
|
||||
CaseTime = DateTime.UtcNow
|
||||
@@ -209,17 +209,9 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
PauseButton_Click();
|
||||
}
|
||||
private void Border_Click(object sender, InputEventArgs e)
|
||||
=> PauseButton_Click();
|
||||
|
||||
#endregion
|
||||
|
||||
private void Border_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
PauseButton_Click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user