inital
This commit is contained in:
30
FasdDesktopUi/Pages/SlimPage/Models/SlimPageBase.cs
Normal file
30
FasdDesktopUi/Pages/SlimPage/Models/SlimPageBase.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FasdDesktopUi.Basics;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Pages.DetailsPage.Models;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage.Models
|
||||
{
|
||||
public class cSlimPageData
|
||||
{
|
||||
public cSupportCaseDataProvider DataProvider { get; set; }
|
||||
|
||||
//Header
|
||||
public List<cHeadingDataModel> HeadingData { get; set; }
|
||||
|
||||
//Widget
|
||||
public List<List<cWidgetValueModel>> WidgetData { get; set; }
|
||||
|
||||
//Details
|
||||
public List<cSlimPageDataHistoryModel> DataHistoryList { get; set; }
|
||||
|
||||
//Menu
|
||||
public List<cMenuDataBase> MenuBarData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage.Models
|
||||
{
|
||||
public class cSlimPageDataHistoryModel : cDataHistoryValueModel
|
||||
{
|
||||
public List<cDataHistoryValueModel> ValueColumns { get; set; } = new List<cDataHistoryValueModel>();
|
||||
}
|
||||
}
|
||||
114
FasdDesktopUi/Pages/SlimPage/SlimPageView.xaml
Normal file
114
FasdDesktopUi/Pages/SlimPage/SlimPageView.xaml
Normal file
@@ -0,0 +1,114 @@
|
||||
<detailspagebase:SupportCasePageBase
|
||||
xmlns:detailspagebase="clr-namespace:FasdDesktopUi.Pages"
|
||||
x:Class="FasdDesktopUi.Pages.SlimPage.SlimPageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Pages.SlimPage"
|
||||
xmlns:uc="clr-namespace:FasdDesktopUi.Pages.SlimPage.UserControls"
|
||||
xmlns:buc="clr-namespace:FasdDesktopUi.Basics.UserControls"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
mc:Ignorable="d"
|
||||
Title="FASD Slim"
|
||||
x:Name="SlimPage"
|
||||
PreviewKeyDown="Window_PreviewKeyDown"
|
||||
Closing="Window_Closing"
|
||||
AllowsTransparency="True"
|
||||
WindowStyle="None"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Bottom"
|
||||
ResizeMode="CanMinimize"
|
||||
WindowState="Maximized"
|
||||
ShowInTaskbar="False"
|
||||
Topmost="True" Loaded="SlimPage_Loaded">
|
||||
<Window.DataContext>
|
||||
<local:SlimPageViewModel />
|
||||
</Window.DataContext>
|
||||
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
<vc:NullValueToVisibilityConverter x:Key="NullToVisibility" />
|
||||
<vc:PercentToDecimalConverter x:Key="PercentToDecimal" />
|
||||
</Window.Resources>
|
||||
|
||||
<Border x:Name="MainBorder"
|
||||
Background="#01000000"
|
||||
MinWidth="360"
|
||||
Padding="10"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom">
|
||||
<Border.LayoutTransform>
|
||||
<ScaleTransform ScaleX="{Binding ZoomInPercent, Converter={StaticResource PercentToDecimal}}"
|
||||
ScaleY="{Binding ZoomInPercent, Converter={StaticResource PercentToDecimal}}"
|
||||
CenterX="0"
|
||||
CenterY="0" />
|
||||
</Border.LayoutTransform>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border x:Name="Header"
|
||||
Grid.Row="0">
|
||||
<uc:SlimPageWindowStateBar ClickedClose="WindowStateBarUc_ClickedClose"
|
||||
ClickedMaximize="WindowStateBarUc_ClickedMaximize"
|
||||
ShowFullStateBar="True"
|
||||
Visibility="{Binding ElementName=MainBorder, Path=IsMouseOver, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Border>
|
||||
|
||||
<Border x:Name="Body"
|
||||
Grid.Row="1">
|
||||
<Grid x:Name="BodyGrid">
|
||||
|
||||
<Border x:Name="StaticBodyParts"
|
||||
VerticalAlignment="Bottom"
|
||||
Panel.ZIndex="0">
|
||||
<StackPanel>
|
||||
<uc:SlimPageDataHistoryCollection x:Name="DataHistoryCollectionUc" />
|
||||
<uc:SlimPageWidgetCollection x:Name="WidgetCollectionUc"
|
||||
HeadingData="{Binding HeadingData}"
|
||||
WidgetData="{Binding WidgetData}"
|
||||
Width="{Binding ElementName=BodyGrid, Path=ActualWidth}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="BlurBorderBody"
|
||||
Background="Transparent"
|
||||
Panel.ZIndex="1"
|
||||
Visibility="{Binding ElementName=SlimPage, Path=IsBlurred, Converter={StaticResource BoolToVisibility}}"
|
||||
MouseUp="BlurBorder_MouseUp"
|
||||
TouchDown="BlurBorder_TouchDown" />
|
||||
|
||||
<Border x:Name="DynamicBodyParts" x:FieldModifier="private"
|
||||
Width="{Binding ElementName=StaticBodyParts, Path=ActualWidth}"
|
||||
Panel.ZIndex="2"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0 2.5 0 0"
|
||||
CornerRadius="10 10 0 0"
|
||||
Background="{DynamicResource BackgroundColor.Menu.Categories}" />
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="Footer" x:FieldModifier="private"
|
||||
Grid.Row="2"
|
||||
Background="{DynamicResource BackgroundColor.SlimPage.MenuBar}"
|
||||
CornerRadius="0 0 7.5 7.5"
|
||||
Padding="10">
|
||||
<Grid>
|
||||
<buc:MenuBar x:Name="MenuBarUc" x:FieldModifier="private" />
|
||||
<buc:SearchBar x:Name="SearchBarUserControl" x:FieldModifier="private"
|
||||
Visibility="Collapsed"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</detailspagebase:SupportCasePageBase>
|
||||
580
FasdDesktopUi/Pages/SlimPage/SlimPageView.xaml.cs
Normal file
580
FasdDesktopUi/Pages/SlimPage/SlimPageView.xaml.cs
Normal file
@@ -0,0 +1,580 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
|
||||
using FasdDesktopUi.Basics;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
using FasdDesktopUi.Basics.UserControls;
|
||||
using FasdDesktopUi.Pages.SlimPage.Models;
|
||||
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.MultiLanguage;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage
|
||||
{
|
||||
public partial class SlimPageView : SupportCasePageBase, IBlurrable
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private bool shouldReRunDataChangedEvent = false;
|
||||
|
||||
private const int MaxItemCountMenuBar = 5;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Blurring
|
||||
|
||||
internal override void DoBlurredChanged(bool isBlured)
|
||||
{
|
||||
DataHistoryCollectionUc.IsBlurred = isBlured;
|
||||
WidgetCollectionUc.IsBlurred = isBlured;
|
||||
}
|
||||
|
||||
internal override bool CheckBlurInvoker(IBlurInvoker invoker)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (invoker)
|
||||
{
|
||||
case SearchBar searchBar:
|
||||
if (!searchBar.IsVisible || searchBar.SearchStatus != SearchBar.eSearchStatus.message)
|
||||
return true;
|
||||
break;
|
||||
case QuickActionSelector _:
|
||||
case QuickActionStatusMonitor _:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public SlimPageView()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AddCustomHandlers();
|
||||
|
||||
SourceInitialized += (s, e) =>
|
||||
{
|
||||
IntPtr handle = new WindowInteropHelper(this).Handle;
|
||||
HwndSource.FromHwnd(handle).AddHook(new HwndSourceHook(cUtility.WindowProc));
|
||||
};
|
||||
|
||||
UiSettingsChanged(null, null);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void SlimPage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MenuBarUc.SetSlimPage();
|
||||
}
|
||||
|
||||
private void AddCustomHandlers()
|
||||
{
|
||||
try
|
||||
{
|
||||
AddHandler(cUiActionBase.UiActionClickedEvent, new cUiActionBase.UiActionEventHandlerDelegate(UiActionWasTriggered));
|
||||
AddHandler(DataCanvas.DataCanvasWasClosedEvent, new RoutedEventHandler(DataCanvasWasClosed));
|
||||
|
||||
BlurInvoker.BlurInvokerVisibilityChanged += (obj, e) => UpdateBlurStatus(obj);
|
||||
|
||||
MenuBarUc.SearchButtonClickedAction = SearchButtonClickedAction;
|
||||
MenuBarUc.MoreButtonClickedAction = MoreButtonClickedAction;
|
||||
|
||||
SearchBarUserControl.ChangedSearchValue = EnteredSearchValueAsync;
|
||||
SearchBarUserControl.CancledSearchAction = BlurBorder_Click;
|
||||
|
||||
cFasdCockpitConfig.Instance.UiSettingsChanged += UiSettingsChanged;
|
||||
cConnectionStatusHelper.ApiConnectionStatusChanged += ApiConnectionStatusChanged;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void UiSettingsChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var positionAlignement = cFasdCockpitConfig.Instance.Global.SmallViewAlignment;
|
||||
|
||||
switch (positionAlignement)
|
||||
{
|
||||
case enumF4sdHorizontalAlignment.Center:
|
||||
MainBorder.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
break;
|
||||
case enumF4sdHorizontalAlignment.Right:
|
||||
MainBorder.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
break;
|
||||
default:
|
||||
MainBorder.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApiConnectionStatusChanged(cConnectionStatusHelper.enumOnlineStatus? Status)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (Status == cConnectionStatusHelper.enumOnlineStatus.online)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
Footer.ClearValue(IsHitTestVisibleProperty);
|
||||
Footer.ClearValue(OpacityProperty);
|
||||
DynamicBodyParts.ClearValue(IsHitTestVisibleProperty);
|
||||
DynamicBodyParts.ClearValue(OpacityProperty);
|
||||
if (MenuBarUc.Visibility != Visibility.Visible)
|
||||
{
|
||||
SearchBarUserControl.Visibility = Visibility.Collapsed;
|
||||
MenuBarUc.Visibility = Visibility.Visible;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
Footer.IsHitTestVisible = false;
|
||||
DynamicBodyParts.IsHitTestVisible = false;
|
||||
DynamicBodyParts.Opacity = 0.6;
|
||||
if (SearchBarUserControl.Visibility != Visibility.Visible)
|
||||
{
|
||||
MenuBarUc.Visibility = Visibility.Collapsed;
|
||||
SearchBarUserControl.Visibility = Visibility.Visible;
|
||||
}
|
||||
SearchBarUserControl.SetApiStatus();
|
||||
|
||||
IsBlurred = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region Delegate Actions
|
||||
|
||||
private void SearchButtonClickedAction()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
MenuBarUc.MenuBarUc.Visibility = Visibility.Collapsed;
|
||||
SearchBarUserControl.Visibility = Visibility.Visible;
|
||||
SearchBarUserControl.ActivateManualSearch();
|
||||
|
||||
DynamicBodyParts.Child = null;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task EnteredSearchValueAsync(cFilteredResults filteredResults)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
//try
|
||||
//{
|
||||
// if (filteredResults?.Results == null)
|
||||
// {
|
||||
// DynamicBodyParts.Child = null;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (DynamicBodyParts.Child is CustomSearchResultCollection customSearchResultCollection)
|
||||
// {
|
||||
// customSearchResultCollection.ShowSearchResults(filteredResults,null);
|
||||
// customSearchResultCollection.IndexOfSelectedResultItem = filteredResults?.Results?.Count - 1 ?? -1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var _searchResultCollection = new CustomSearchResultCollection(true) { IndexOfSelectedResultItem = filteredResults?.Results?.Count - 1 ?? -1 };
|
||||
// _searchResultCollection.ShowSearchResults(filteredResults,null);
|
||||
// DynamicBodyParts.Child = _searchResultCollection;
|
||||
// }
|
||||
//}
|
||||
//catch (Exception E)
|
||||
//{
|
||||
// LogException(E);
|
||||
//}
|
||||
}
|
||||
|
||||
private void MoreButtonClickedAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(DataContext is SlimPageViewModel viewModel))
|
||||
return;
|
||||
|
||||
var tempMoreQuickActionList = viewModel.MenuDrawerData;
|
||||
|
||||
if (cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates != null)
|
||||
{
|
||||
var tempSubMenuList = new List<cMenuDataBase>();
|
||||
|
||||
foreach (var copyTemplate in cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates.CopyTemplates)
|
||||
{
|
||||
tempSubMenuList.Add(new cMenuDataBase(copyTemplate.Value));
|
||||
}
|
||||
|
||||
tempMoreQuickActionList.Insert(0, new cMenuDataContainer() { MenuText = cMultiLanguageSupport.GetItem("QuickAction.CopyContent"), MenuIcon = new F4SD_AdaptableIcon.IconData(enumInternIcons.menuBar_copy), UiAction = new cSubMenuAction(true) { Name = cMultiLanguageSupport.GetItem("QuickAction.CopyContent"), SubMenuData = tempSubMenuList }, SubMenuData = tempSubMenuList });
|
||||
}
|
||||
|
||||
var quickActionSelector = new QuickActionSelector()
|
||||
{
|
||||
Visibility = Visibility.Visible,
|
||||
QuickActionList = tempMoreQuickActionList,
|
||||
QuickActionSelectorHeading = "Quick Actions",
|
||||
TempQuickActionList = null,
|
||||
CloseButtonClickedAction = BlurBorder_Click
|
||||
};
|
||||
|
||||
quickActionSelector.LockButton.Visibility = Visibility.Collapsed;
|
||||
DynamicBodyParts.Child = quickActionSelector;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void SetPropertyValues(cSlimPageData slimPageData)
|
||||
{
|
||||
try
|
||||
{
|
||||
BlurBorder_Click();
|
||||
|
||||
if (DataContext is SlimPageViewModel viewModel)
|
||||
viewModel.InitializeProperties(slimPageData);
|
||||
|
||||
//todo: replace binding with following schema due to performance issues:
|
||||
WidgetCollectionUc.HeadingData = slimPageData.HeadingData;
|
||||
WidgetCollectionUc.WidgetData = slimPageData.WidgetData;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region Update Data
|
||||
|
||||
internal override async void DataProvider_DataChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isDataChangedEventRunning)
|
||||
{
|
||||
shouldReRunDataChangedEvent = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var data = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.GetSlimPageDataAsync();
|
||||
//todo: check if there is a more performant way solving this
|
||||
Dispatcher.Invoke(() => WidgetCollectionUc.HeadingData = data.HeadingData);
|
||||
Dispatcher.Invoke(() => WidgetCollectionUc.WidgetData = data.WidgetData);
|
||||
Dispatcher.Invoke(() => MenuBarUc.MenuBarItemData = GetSlimpageMenuBarData(data.MenuBarData));
|
||||
Dispatcher.Invoke(() => DataHistoryCollectionUc.UpdateHistory(data.DataHistoryList));
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (DataContext is SlimPageViewModel viewModel)
|
||||
viewModel.InitializeProperties(data);
|
||||
});
|
||||
|
||||
if (shouldReRunDataChangedEvent)
|
||||
{
|
||||
shouldReRunDataChangedEvent = false;
|
||||
DataProvider_DataChanged(sender, e);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
internal override async void DataProvider_DataFullyLoaded(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.GetSlimPageDataAsync();
|
||||
//todo: check if there is a more performant way solving this
|
||||
Dispatcher.Invoke(() => WidgetCollectionUc.HeadingData = data.HeadingData);
|
||||
Dispatcher.Invoke(() => WidgetCollectionUc.WidgetData = data.WidgetData);
|
||||
Dispatcher.Invoke(() => MenuBarUc.MenuBarItemData = GetSlimpageMenuBarData(data.MenuBarData));
|
||||
Dispatcher.Invoke(() => DataHistoryCollectionUc.UpdateHistory(data.DataHistoryList));
|
||||
|
||||
if (_supportCase != null)
|
||||
{
|
||||
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DataChanged -= DataProvider_DataChanged;
|
||||
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
internal override void DirectConnectionHelper_DirectConnectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
bool hasDirectConnection = _supportCase?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
|
||||
WidgetCollectionUc.HasDirectConnection = hasDirectConnection;
|
||||
});
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private List<cMenuDataBase> GetSlimpageMenuBarData(List<cMenuDataBase> list)
|
||||
{
|
||||
try
|
||||
{
|
||||
list.Where(data => data.IconPositionIndex > -1)
|
||||
.OrderBy(data => data.IconPositionIndex)
|
||||
.Skip(MaxItemCountMenuBar)
|
||||
.ToList()
|
||||
.ForEach(data => data.IconPositionIndex = -1);
|
||||
return list;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return new List<cMenuDataBase>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BlurBorder_Click
|
||||
|
||||
private void BlurBorder_Click()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(DataContext is SlimPageViewModel viewModel))
|
||||
return;
|
||||
|
||||
if (SearchBarUserControl.SearchStatus != SearchBar.eSearchStatus.message)
|
||||
{
|
||||
SearchBarUserControl.Visibility = Visibility.Collapsed;
|
||||
MenuBarUc.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
IsBlurred = false;
|
||||
|
||||
DynamicBodyParts.Child = null;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void BlurBorder_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
BlurBorder_Click();
|
||||
}
|
||||
|
||||
private void BlurBorder_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
BlurBorder_Click();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Search Events
|
||||
|
||||
private void SearchBar_DidSearch(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BlurBorder_Click();
|
||||
}
|
||||
|
||||
private void SearchBar_CancledSearch(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BlurBorder_Click();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WindowStateBar Events
|
||||
|
||||
private void WindowStateBarUc_ClickedClose(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BlurBorder_Click();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void WindowStateBarUc_ClickedMaximize(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var detailsPage = cSupportCaseDataProvider.detailsPage;
|
||||
|
||||
if (detailsPage != null)
|
||||
{
|
||||
Hide();
|
||||
App.HideAllSettingViews();
|
||||
detailsPage.Show();
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async void UiActionWasTriggered(object sender, UiActionEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// define drawing area
|
||||
UIElement drawingArea = null;
|
||||
|
||||
switch (e.UiAction)
|
||||
{
|
||||
case cUiQuickAction _:
|
||||
drawingArea = DynamicBodyParts.Child is Decorator decorator ? decorator : new Decorator();
|
||||
if (!(DynamicBodyParts.Child is Decorator))
|
||||
DynamicBodyParts.Child = drawingArea;
|
||||
break;
|
||||
case cSubMenuAction _:
|
||||
drawingArea = DynamicBodyParts.Child is QuickActionSelector quickActionSelector ? quickActionSelector : new QuickActionSelector();
|
||||
if (!(DynamicBodyParts.Child is QuickActionSelector))
|
||||
DynamicBodyParts.Child = drawingArea;
|
||||
break;
|
||||
}
|
||||
|
||||
await e.UiAction?.RunUiActionAsync(e.OriginalSource, drawingArea, false, _supportCase?.SupportCaseDataProviderArtifact);
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataCanvasWasClosed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BlurBorder_Click();
|
||||
}
|
||||
|
||||
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SearchBarUserControl.Visibility == Visibility.Visible && DynamicBodyParts.Child is CustomSearchResultCollection resultMenu)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Up:
|
||||
if (resultMenu.IndexOfSelectedResultItem > 0)
|
||||
resultMenu.IndexOfSelectedResultItem--;
|
||||
break;
|
||||
case Key.Down:
|
||||
resultMenu.IndexOfSelectedResultItem++;
|
||||
break;
|
||||
case Key.Enter:
|
||||
resultMenu.SelectCurrentResultItem();
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Key.Escape:
|
||||
BlurBorder_Click();
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Enter:
|
||||
if (SearchBarUserControl.Visibility == Visibility.Visible)
|
||||
break;
|
||||
|
||||
var detailsPage = cSupportCaseDataProvider.detailsPage;
|
||||
if (detailsPage != null)
|
||||
{
|
||||
Hide();
|
||||
App.HideAllSettingViews();
|
||||
detailsPage.Show();
|
||||
}
|
||||
break;
|
||||
case Key.F3:
|
||||
if (Keyboard.Modifiers == ModifierKeys.Control)
|
||||
SearchButtonClickedAction();
|
||||
break;
|
||||
}
|
||||
} //todo: add QuickAction Navigation
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetZoomValue(int zoomInPercent)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DataContext is SlimPageViewModel viewModel)
|
||||
viewModel.ZoomInPercent = zoomInPercent;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
152
FasdDesktopUi/Pages/SlimPage/SlimPageViewModel.cs
Normal file
152
FasdDesktopUi/Pages/SlimPage/SlimPageViewModel.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using FasdDesktopUi.Pages.SlimPage.Models;
|
||||
using FasdDesktopUi.Basics;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage
|
||||
{
|
||||
public class SlimPageViewModel : BaseViewModel
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public cSupportCaseDataProvider DataProvider { get; set; }
|
||||
|
||||
#region ZoomInPercent
|
||||
|
||||
private int zoomInPercent;
|
||||
|
||||
public int ZoomInPercent
|
||||
{
|
||||
get { return zoomInPercent; }
|
||||
set
|
||||
{
|
||||
if (value < 50)
|
||||
value = 50;
|
||||
else if (value > 250)
|
||||
value = 250;
|
||||
|
||||
zoomInPercent = value;
|
||||
cFasdCockpitConfig.Instance.SetSlimPageZoom(value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cockpit Properties
|
||||
|
||||
#region HeadingData Property
|
||||
|
||||
private List<cHeadingDataModel> headingData;
|
||||
|
||||
public List<cHeadingDataModel> HeadingData
|
||||
{
|
||||
get { return headingData; }
|
||||
set
|
||||
{
|
||||
headingData = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Widget Property
|
||||
|
||||
private List<List<cWidgetValueModel>> widgetData;
|
||||
|
||||
public List<List<cWidgetValueModel>> WidgetData
|
||||
{
|
||||
get { return widgetData; }
|
||||
set
|
||||
{
|
||||
widgetData = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MenuBarData property
|
||||
|
||||
private List<cMenuDataBase> menuBarData;
|
||||
|
||||
public List<cMenuDataBase> MenuBarData
|
||||
{
|
||||
get { return menuBarData; }
|
||||
set
|
||||
{
|
||||
menuBarData = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(MenuDrawerData));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MenuDrawerData property
|
||||
|
||||
public List<cMenuDataBase> MenuDrawerData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MenuBarData != null)
|
||||
return MenuBarData.Where(x => x.IconPositionIndex < 0).ToList();
|
||||
|
||||
return new List<cMenuDataBase>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region DataHistory Properties
|
||||
|
||||
private List<cSlimPageDataHistoryModel> dataHistoryList;
|
||||
|
||||
public List<cSlimPageDataHistoryModel> DataHistoryList
|
||||
{
|
||||
get { return dataHistoryList; }
|
||||
set
|
||||
{
|
||||
dataHistoryList = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public SlimPageViewModel()
|
||||
{
|
||||
cFasdCockpitConfig.Instance.UiSettingsChanged += CockpitConfig_UiSettingsChanged;
|
||||
}
|
||||
|
||||
private void CockpitConfig_UiSettingsChanged(object sender, EventArgs e)
|
||||
{
|
||||
ZoomInPercent = cFasdCockpitConfig.Instance.SlimPageZoom;
|
||||
}
|
||||
|
||||
public void InitializeProperties(cSlimPageData slimPageData)
|
||||
{
|
||||
DataProvider = slimPageData.DataProvider;
|
||||
HeadingData = slimPageData.HeadingData;
|
||||
WidgetData = slimPageData.WidgetData;
|
||||
DataHistoryList = slimPageData.DataHistoryList;
|
||||
MenuBarData = slimPageData.MenuBarData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Pages.SlimPage.UserControls.SlimPageDataHistory"
|
||||
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.Pages.SlimPage.UserControls"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
mc:Ignorable="d"
|
||||
Name="DataHistoryUc"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Cursor="Hand">
|
||||
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Border x:Name="ValueBorder"
|
||||
CornerRadius="7.5"
|
||||
Padding="10">
|
||||
<Border.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource BackgroundColor.SlimPage.DataHistory}" />
|
||||
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=IsMouseOver}"
|
||||
Value="True">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource BackgroundColor.SlimPage.DataHistory.Hover}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding ElementName=DataHistoryUc, Path=HistoryData.Content}"
|
||||
Style="{DynamicResource SlimPage.DataHistory.OverviewTitle}" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="LoadingIcon"
|
||||
IconHeight="15"
|
||||
IconWidth="15"
|
||||
BorderPadding="2.5"
|
||||
Margin="10 0"
|
||||
SelectedInternGif="loadingSpinner" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="MainStack"
|
||||
Orientation="Horizontal"
|
||||
Margin="-7.5 0"
|
||||
Height="Auto"
|
||||
Width="Auto">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="TextBlock"
|
||||
BasedOn="{StaticResource SlimPage.DataHistory.ColumnHeader}">
|
||||
<Setter Property="Height"
|
||||
Value="15" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="StackPanel">
|
||||
|
||||
<Setter Property="Height"
|
||||
Value="45" />
|
||||
<Setter Property="Width"
|
||||
Value="35" />
|
||||
<Setter Property="Margin"
|
||||
Value="2.5" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ico:AdaptableIcon">
|
||||
<Setter Property="BorderPadding"
|
||||
Value="2.5" />
|
||||
<Setter Property="IconHeight"
|
||||
Value="30" />
|
||||
<Setter Property="IconWidth"
|
||||
Value="30" />
|
||||
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IconName}"
|
||||
Value="status_empty">
|
||||
<Setter Property="BorderPadding"
|
||||
Value="8" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
</Border>
|
||||
|
||||
<Border x:Name="BlurBorder"
|
||||
Opacity="0.7"
|
||||
Visibility="{Binding IsBlurred, ElementName=DataHistoryUc, Converter={StaticResource BoolToVisibility}}"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource Color.BlurBorder}"
|
||||
Height="{Binding ActualHeight, ElementName=ValueBorder}"
|
||||
Width="{Binding ActualWidth, ElementName=ValueBorder}" />
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Effects;
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.Logging;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
|
||||
using FasdDesktopUi.Pages.SlimPage.Models;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage.UserControls
|
||||
{
|
||||
public partial class SlimPageDataHistory : UserControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
#region IsBlurred
|
||||
|
||||
private static void IsBlurredChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is SlimPageDataHistory _me && e.NewValue is bool isBlurred)
|
||||
_me.ValueBorder.Child.Effect = isBlurred ? new BlurEffect() { Radius = 5, KernelType = KernelType.Gaussian } : null;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsBlurredProperty =
|
||||
DependencyProperty.Register("IsBlurred", typeof(bool), typeof(SlimPageDataHistory), new PropertyMetadata(false, new PropertyChangedCallback(IsBlurredChangedCallback)));
|
||||
|
||||
public bool IsBlurred
|
||||
{
|
||||
get { return (bool)GetValue(IsBlurredProperty); }
|
||||
set { SetValue(IsBlurredProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HistoryData Dependeny Property
|
||||
|
||||
private static void HistoryDataChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is SlimPageDataHistory slimPageDataHistory)
|
||||
slimPageDataHistory.InitializeHistoryData();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HistoryDataProperty =
|
||||
DependencyProperty.Register("HistoryData", typeof(cSlimPageDataHistoryModel), typeof(SlimPageDataHistory), new PropertyMetadata(new cSlimPageDataHistoryModel(), new PropertyChangedCallback(HistoryDataChangedCallback)));
|
||||
|
||||
public cSlimPageDataHistoryModel HistoryData
|
||||
{
|
||||
get { return (cSlimPageDataHistoryModel)GetValue(HistoryDataProperty); }
|
||||
set { SetValue(HistoryDataProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public SlimPageDataHistory()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeHistoryData()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HistoryData == null)
|
||||
return;
|
||||
|
||||
MainStack.Children.Clear();
|
||||
|
||||
var tempHistoryDataColumns = HistoryData.ValueColumns.Take(7);
|
||||
|
||||
foreach (var historyColumn in tempHistoryDataColumns)
|
||||
{
|
||||
StackPanel stackPanel = new StackPanel();
|
||||
stackPanel.Children.Add(new TextBlock() { TextAlignment = TextAlignment.Center, Text = historyColumn.Content });
|
||||
AdaptableIcon adaptableIcon = new AdaptableIcon();
|
||||
|
||||
switch (historyColumn.HighlightColor)
|
||||
{
|
||||
case enumHighlightColor.none:
|
||||
adaptableIcon.SelectedInternIcon = enumInternIcons.status_empty;
|
||||
adaptableIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.SoftContrast");
|
||||
break;
|
||||
case enumHighlightColor.blue:
|
||||
adaptableIcon.SelectedInternIcon = enumInternIcons.status_info;
|
||||
adaptableIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Blue");
|
||||
break;
|
||||
case enumHighlightColor.green:
|
||||
adaptableIcon.SelectedInternIcon = enumInternIcons.status_good;
|
||||
adaptableIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Green");
|
||||
break;
|
||||
case enumHighlightColor.orange:
|
||||
adaptableIcon.SelectedInternIcon = enumInternIcons.status_danger;
|
||||
adaptableIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Orange");
|
||||
break;
|
||||
case enumHighlightColor.red:
|
||||
adaptableIcon.SelectedInternIcon = enumInternIcons.status_bad;
|
||||
adaptableIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Red");
|
||||
break;
|
||||
}
|
||||
|
||||
if (historyColumn.IsLoading && historyColumn.HighlightColor != enumHighlightColor.red)
|
||||
{
|
||||
//todo: replace loading icon
|
||||
adaptableIcon.SelectedInternIcon = enumInternIcons.menuBar_more;
|
||||
adaptableIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Menu.Icon");
|
||||
}
|
||||
|
||||
stackPanel.Children.Add(adaptableIcon);
|
||||
MainStack.Children.Add(stackPanel);
|
||||
}
|
||||
|
||||
if (tempHistoryDataColumns.Any(data => data.IsLoading))
|
||||
LoadingIcon.Visibility = Visibility.Visible;
|
||||
else
|
||||
LoadingIcon.Visibility = Visibility.Collapsed;
|
||||
|
||||
(MainStack.Children[0] as FrameworkElement).Margin = new Thickness(5, 2.5, 2.5, 2.5);
|
||||
(MainStack.Children[MainStack.Children.Count - 1] as FrameworkElement).Width = 75;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void UpdateHistoryData(cSlimPageDataHistoryModel newHistoryData)
|
||||
{
|
||||
HistoryData = newHistoryData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Pages.SlimPage.UserControls.SlimPageDataHistoryCollection"
|
||||
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.Pages.SlimPage.UserControls"
|
||||
mc:Ignorable="d"
|
||||
Name="DataHistoryCollectionUc"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer.Resources>
|
||||
<Style TargetType="ScrollViewer">
|
||||
<Setter Property="Padding"
|
||||
Value="0 0 0 2.5" />
|
||||
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ComputedVerticalScrollBarVisibility}"
|
||||
Value="Visible">
|
||||
<Setter Property="Padding"
|
||||
Value="0 0 5 5" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ScrollViewer.Resources>
|
||||
|
||||
<StackPanel x:Name="MainStack"
|
||||
VerticalAlignment="Bottom">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="local:SlimPageDataHistory">
|
||||
<EventSetter Event="MouseUp"
|
||||
Handler="DataHistoryUc_MouseUp" />
|
||||
<EventSetter Event="TouchDown"
|
||||
Handler="DataHistoryUc_TouchDown" />
|
||||
</Style>
|
||||
|
||||
</StackPanel.Resources>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,192 @@
|
||||
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.Logging;
|
||||
|
||||
using FasdDesktopUi.Basics;
|
||||
using FasdDesktopUi.Pages.DetailsPage;
|
||||
using FasdDesktopUi.Pages.SettingsPage;
|
||||
using FasdDesktopUi.Pages.SlimPage.Models;
|
||||
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage.UserControls
|
||||
{
|
||||
public partial class SlimPageDataHistoryCollection : UserControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
#region IsBlurred
|
||||
|
||||
private bool isBlurred;
|
||||
|
||||
public bool IsBlurred
|
||||
{
|
||||
get { return isBlurred; }
|
||||
set
|
||||
{
|
||||
isBlurred = value;
|
||||
foreach (var child in MainStack.Children)
|
||||
{
|
||||
if (child is SlimPageDataHistory dataHistory)
|
||||
{
|
||||
dataHistory.IsBlurred = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HistoryDataList Dependency Property
|
||||
|
||||
private static void HistoryDataCollectionChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is SlimPageDataHistoryCollection _me)
|
||||
_me.InitializeDataHistoryCollection();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HistoryDataListProperty =
|
||||
DependencyProperty.Register("HistoryDataList", typeof(List<cSlimPageDataHistoryModel>), typeof(SlimPageDataHistoryCollection), new PropertyMetadata(new List<cSlimPageDataHistoryModel>(), new PropertyChangedCallback(HistoryDataCollectionChangedCallback)));
|
||||
|
||||
public List<cSlimPageDataHistoryModel> HistoryDataList
|
||||
{
|
||||
get { return (List<cSlimPageDataHistoryModel>)GetValue(HistoryDataListProperty); }
|
||||
set { SetValue(HistoryDataListProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public SlimPageDataHistoryCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region DataHistoryClicked
|
||||
|
||||
private void DataHistoryUc_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
var detailsPage = cSupportCaseDataProvider.detailsPage;
|
||||
if (detailsPage != null)
|
||||
{
|
||||
detailsPage.OpenDataHistory(MainStack.Children.IndexOf(sender as FrameworkElement));
|
||||
Window.GetWindow(this).Hide();
|
||||
|
||||
App.HideAllSettingViews();
|
||||
detailsPage.Show();
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataHistoryUc_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
DataHistoryUc_Click(sender);
|
||||
}
|
||||
|
||||
private void DataHistoryUc_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
DataHistoryUc_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void InitializeDataHistoryCollection()
|
||||
{
|
||||
if (HistoryDataList == null)
|
||||
return;
|
||||
|
||||
MainStack.Children.Clear();
|
||||
|
||||
foreach (var historyData in HistoryDataList)
|
||||
{
|
||||
MainStack.Children.Add(new SlimPageDataHistory() { Margin = new Thickness(0, 2.5, 0, 2.5), HistoryData = historyData });
|
||||
}
|
||||
}
|
||||
|
||||
private bool DidHistoryCategoryChange(cSlimPageDataHistoryModel oldValue, cSlimPageDataHistoryModel newValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (oldValue.IsLoading != newValue.IsLoading)
|
||||
return true;
|
||||
|
||||
if (oldValue.ValueColumns.Count != newValue.ValueColumns.Count)
|
||||
return true;
|
||||
|
||||
var newValueColumnEnumeator = newValue.ValueColumns.GetEnumerator();
|
||||
|
||||
foreach (var oldValueColumn in oldValue.ValueColumns)
|
||||
{
|
||||
if (!newValueColumnEnumeator.MoveNext())
|
||||
continue;
|
||||
|
||||
var currentNewValueColumn = newValueColumnEnumeator.Current;
|
||||
|
||||
if (oldValueColumn.HighlightColor != currentNewValueColumn.HighlightColor)
|
||||
return true;
|
||||
|
||||
if (oldValueColumn.IsLoading != currentNewValueColumn.IsLoading)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void UpdateHistory(List<cSlimPageDataHistoryModel> historyData)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HistoryDataList is null)
|
||||
return;
|
||||
|
||||
var historyDataEnumerator = HistoryDataList.GetEnumerator();
|
||||
foreach (var historyCategory in historyData)
|
||||
{
|
||||
if (!historyDataEnumerator.MoveNext())
|
||||
continue;
|
||||
|
||||
var currentHistoryData = historyDataEnumerator.Current;
|
||||
|
||||
if (DidHistoryCategoryChange(currentHistoryData, historyCategory))
|
||||
{
|
||||
var indexOfCurrentHistoryData = HistoryDataList.IndexOf(currentHistoryData);
|
||||
|
||||
if (MainStack.Children[indexOfCurrentHistoryData] is SlimPageDataHistory dataHistoryControl)
|
||||
dataHistoryControl.UpdateHistoryData(historyCategory);
|
||||
}
|
||||
}
|
||||
|
||||
HistoryDataList = historyData;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Pages.SlimPage.UserControls.SlimPageWidgetCollection"
|
||||
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.Pages.SlimPage.UserControls"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:converter="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
mc:Ignorable="d"
|
||||
x:Name="WidgetCollection"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Initialized="WidgetCollection_Initialized"
|
||||
Loaded="WidgetCollection_Loaded"
|
||||
MouseUp="WidgetCollection_MouseUp"
|
||||
TouchDown="WidgetCollection_TouchDown">
|
||||
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
|
||||
<Border x:Name="ValueBorder"
|
||||
CornerRadius="7.5 7.5 0 0"
|
||||
Background="{DynamicResource BackgroundColor.SlimPage.WidgetCollection}"
|
||||
Padding="10"
|
||||
Cursor="Hand">
|
||||
|
||||
<StackPanel>
|
||||
<Grid x:Name="HeaderGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel x:Name="UserStack"
|
||||
Orientation="Horizontal">
|
||||
<ico:AdaptableIcon x:Name="UserIcon"
|
||||
Style="{DynamicResource SlimPage.Widget.Header.Icon}"
|
||||
SelectedInternIcon="misc_user" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="ComputerStack"
|
||||
Orientation="Horizontal"
|
||||
Grid.Column="1">
|
||||
<ico:AdaptableIcon x:Name="ComputerIcon"
|
||||
Style="{DynamicResource SlimPage.Widget.Header.Icon}"
|
||||
SecondaryIconColor="{DynamicResource Color.FunctionMarker}"
|
||||
SelectedInternIcon="misc_computer" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="WidgetGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" />
|
||||
<StackPanel Grid.Column="1" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="BlurBorder"
|
||||
CornerRadius="7.5 7.5 0 0"
|
||||
Background="{DynamicResource Color.BlurBorder}"
|
||||
Opacity="0.7"
|
||||
Height="{Binding ActualHeight, ElementName=ValueBorder}"
|
||||
Width="{Binding ActualWidth, ElementName=ValueBorder}"
|
||||
Visibility="{Binding IsBlurred, ElementName=WidgetCollection, Converter={StaticResource BoolToVisibility}}" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,393 @@
|
||||
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.Input;
|
||||
using System.Windows.Media.Effects;
|
||||
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Pages.DetailsPage.Models;
|
||||
using FasdDesktopUi.Pages.DetailsPage;
|
||||
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.MultiLanguage;
|
||||
using FasdDesktopUi.Basics;
|
||||
using System.Reflection;
|
||||
using C4IT.Logging;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using FasdDesktopUi.Pages.SettingsPage;
|
||||
using FasdDesktopUi.Pages.DetailsPage.UserControls;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage.UserControls
|
||||
{
|
||||
public partial class SlimPageWidgetCollection : UserControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
#region IsBlurred
|
||||
|
||||
private static void IsBlurredChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is SlimPageWidgetCollection _me && e.NewValue is bool isBlurred)
|
||||
_me.ValueBorder.Child.Effect = isBlurred ? new BlurEffect() { Radius = 5, KernelType = KernelType.Gaussian } : null;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsBlurredProperty =
|
||||
DependencyProperty.Register("IsBlurred", typeof(bool), typeof(SlimPageWidgetCollection), new PropertyMetadata(false, new PropertyChangedCallback(IsBlurredChangedCallback)));
|
||||
|
||||
public bool IsBlurred
|
||||
{
|
||||
get { return (bool)GetValue(IsBlurredProperty); }
|
||||
set { SetValue(IsBlurredProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool HasDirectConnection
|
||||
{
|
||||
get { return (bool)GetValue(HasDirectConnectionProperty); }
|
||||
set { SetValue(HasDirectConnectionProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HasDirectConnectionProperty =
|
||||
DependencyProperty.Register("HasDirectConnection", typeof(bool), typeof(SlimPageWidgetCollection), new PropertyMetadata(false, new PropertyChangedCallback(DirectConnectionStatusChanged)));
|
||||
|
||||
private static void DirectConnectionStatusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (!(d is SlimPageWidgetCollection _me))
|
||||
return;
|
||||
|
||||
_me.UpdateDirectConnectionIcon();
|
||||
}
|
||||
|
||||
#region HeadingData DependencyProperty
|
||||
private static void HeadingDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (!(d is SlimPageWidgetCollection _me))
|
||||
return;
|
||||
|
||||
if (!(e.NewValue is List<cHeadingDataModel> data))
|
||||
return;
|
||||
|
||||
_me.UserStack.Children.RemoveRange(1, int.MaxValue);
|
||||
_me.ComputerStack.Children.RemoveRange(1, int.MaxValue);
|
||||
|
||||
data = data.Where(heading =>
|
||||
heading.InformationClass is enumFasdInformationClass.User || heading.InformationClass is enumFasdInformationClass.Computer)
|
||||
.ToList();
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var currentData = data[i];
|
||||
|
||||
StackPanel stackPanel = null;
|
||||
AdaptableIcon icon = null;
|
||||
|
||||
switch (currentData.InformationClass)
|
||||
{
|
||||
case enumFasdInformationClass.Computer:
|
||||
stackPanel = _me.ComputerStack;
|
||||
icon = _me.ComputerIcon;
|
||||
break;
|
||||
case enumFasdInformationClass.User:
|
||||
stackPanel = _me.UserStack;
|
||||
icon = _me.UserIcon;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentData.IsOnline)
|
||||
{
|
||||
icon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Green");
|
||||
icon.ToolTip = cMultiLanguageSupport.GetItem("Header.IsOnline");
|
||||
}
|
||||
else
|
||||
{
|
||||
icon.ClearValue(AdaptableIcon.PrimaryIconColorProperty);
|
||||
icon.ToolTip = cMultiLanguageSupport.GetItem("Header.IsOffline");
|
||||
}
|
||||
|
||||
TextBlock textBlock = new TextBlock();
|
||||
textBlock.SetResourceReference(StyleProperty, "SlimPage.Widget.Header");
|
||||
textBlock.Text = currentData.HeadingText;
|
||||
textBlock.MouseLeftButtonUp += _me.Heading_MouseLeftButtonUp;
|
||||
textBlock.TouchDown += _me.Heading_TouchDown;
|
||||
|
||||
stackPanel.Children.Add(textBlock);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Heading_Click(object originalSource) //todo: bring in separate function? same procedure in widget values and in DetailsPage
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(originalSource is TextBlock clickedTextBlock))
|
||||
return;
|
||||
|
||||
System.Windows.Forms.Clipboard.SetText(clickedTextBlock.Text);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void Heading_TouchDown(object sender, System.Windows.Input.TouchEventArgs e)
|
||||
{
|
||||
Heading_Click(e.OriginalSource);
|
||||
}
|
||||
|
||||
private void Heading_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
Heading_Click(e.OriginalSource);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HeadingDataProperty =
|
||||
DependencyProperty.Register("HeadingData", typeof(List<cHeadingDataModel>), typeof(SlimPageWidgetCollection), new PropertyMetadata(new List<cHeadingDataModel>() {
|
||||
new cHeadingDataModel() { HeadingText = "UserName", InformationClass = enumFasdInformationClass.User },
|
||||
new cHeadingDataModel() { HeadingText = "ComputerName", InformationClass = enumFasdInformationClass.Computer }
|
||||
}, new PropertyChangedCallback(HeadingDataChanged)));
|
||||
|
||||
|
||||
public List<cHeadingDataModel> HeadingData
|
||||
{
|
||||
get { return (List<cHeadingDataModel>)GetValue(HeadingDataProperty); }
|
||||
set { SetValue(HeadingDataProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WidgetData DependencyProperty
|
||||
|
||||
private static void WidgetDataChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is SlimPageWidgetCollection _me)
|
||||
_me.InitializeWidgetData();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty WidgetDataProperty =
|
||||
DependencyProperty.Register("WidgetData", typeof(List<List<cWidgetValueModel>>), typeof(SlimPageWidgetCollection), new PropertyMetadata(new List<List<cWidgetValueModel>>(), new PropertyChangedCallback(WidgetDataChangedCallback)));
|
||||
|
||||
public List<List<cWidgetValueModel>> WidgetData
|
||||
{
|
||||
get { return (List<List<cWidgetValueModel>>)GetValue(WidgetDataProperty); }
|
||||
set { SetValue(WidgetDataProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public SlimPageWidgetCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region InitializeWidgetData
|
||||
|
||||
private void InitializeWidgetData()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (WidgetData == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (WidgetGrid.Children.Count <= i)
|
||||
continue;
|
||||
|
||||
if (WidgetGrid.Children[i] is Panel widgetPanel)
|
||||
{
|
||||
widgetPanel.Children.Clear();
|
||||
WidgetGrid.ColumnDefinitions[i].Width = new GridLength(1, GridUnitType.Auto);
|
||||
|
||||
if (WidgetData.Count <= i)
|
||||
continue;
|
||||
|
||||
WidgetGrid.ColumnDefinitions[i].Width = new GridLength(1, GridUnitType.Star);
|
||||
|
||||
foreach (var widgetValue in WidgetData[i].OrderBy(x => x.ValueIndex))
|
||||
{
|
||||
if (string.IsNullOrEmpty(widgetValue.Title))
|
||||
{
|
||||
Border noTitleValueBorder = new Border() { ClipToBounds = true };
|
||||
var noTitleValueTextBlock = new TextBlock() { Text = widgetValue.Value, Style = widgetNoTitleValueStyle };
|
||||
noTitleValueTextBlock.MouseEnter += WidgetValue_MouseEnter;
|
||||
noTitleValueTextBlock.MouseLeave += WidgetValue_MouseLeave;
|
||||
|
||||
noTitleValueBorder.Child = noTitleValueTextBlock;
|
||||
|
||||
widgetPanel.Children.Add(noTitleValueBorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
//todo: add ticker text animation to values with title
|
||||
StackPanel valueStackPanel = new StackPanel() { Orientation = Orientation.Horizontal };
|
||||
valueStackPanel.Children.Add(new TextBlock() { Text = String.Format("{0}: ", widgetValue.Title), Style = widgetTitleStyle });
|
||||
|
||||
TextBlock valueTextBlock = new TextBlock() { Text = widgetValue.Value, Style = widgetValueStyle };
|
||||
|
||||
switch (widgetValue.HighlightIn)
|
||||
{
|
||||
case enumHighlightColor.none:
|
||||
break;
|
||||
case enumHighlightColor.blue:
|
||||
valueTextBlock.SetResourceReference(ForegroundProperty, "Color.Blue");
|
||||
break;
|
||||
case enumHighlightColor.green:
|
||||
valueTextBlock.SetResourceReference(ForegroundProperty, "Color.Green");
|
||||
break;
|
||||
case enumHighlightColor.orange:
|
||||
valueTextBlock.SetResourceReference(ForegroundProperty, "Color.Orange");
|
||||
break;
|
||||
case enumHighlightColor.red:
|
||||
valueTextBlock.SetResourceReference(ForegroundProperty, "Color.Red");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
valueStackPanel.Children.Add(valueTextBlock);
|
||||
widgetPanel.Children.Add(valueStackPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
private void WidgetValue_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
|
||||
if (!(senderElement.Parent is FrameworkElement senderParent))
|
||||
return;
|
||||
|
||||
cUtility.SetTickerTextAnimation(senderElement, senderParent);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void WidgetValue_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
|
||||
senderElement.BeginAnimation(MarginProperty, null);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private void UpdateDirectConnectionIcon()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HasDirectConnection)
|
||||
{
|
||||
ComputerIcon.SelectedInternIcon = enumInternIcons.misc_directConnection;
|
||||
ComputerIcon.BorderPadding = new Thickness(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ComputerIcon.SelectedInternIcon = enumInternIcons.misc_computer;
|
||||
ComputerIcon.ClearValue(AdaptableIcon.BorderPaddingProperty);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region Styles
|
||||
|
||||
private Style widgetNoTitleValueStyle;
|
||||
private Style widgetTitleStyle;
|
||||
private Style widgetValueStyle;
|
||||
|
||||
private void SetStyles()
|
||||
{
|
||||
widgetNoTitleValueStyle = (Style)FindResource("SlimPage.Widget.NoTitleValue");
|
||||
widgetTitleStyle = (Style)FindResource("SlimPage.Widget.Title");
|
||||
widgetValueStyle = (Style)FindResource("SlimPage.Widget.Value");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void WidgetCollection_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
SetStyles();
|
||||
}
|
||||
|
||||
private void WidgetCollection_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
InitializeWidgetData();
|
||||
}
|
||||
|
||||
#region WidgetCollection_Click
|
||||
|
||||
private void WidgetCollection_Click(object originalSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (originalSource is TextBlock clickedTextBlock)
|
||||
{
|
||||
System.Windows.Forms.Clipboard.SetText(clickedTextBlock.Text);
|
||||
return;
|
||||
}
|
||||
else if (originalSource == ValueBorder)
|
||||
{
|
||||
var detailsPage = cSupportCaseDataProvider.detailsPage;
|
||||
if (detailsPage != null)
|
||||
{
|
||||
Window.GetWindow(this).Hide();
|
||||
App.HideAllSettingViews();
|
||||
detailsPage.Show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void WidgetCollection_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
WidgetCollection_Click(e.OriginalSource);
|
||||
}
|
||||
|
||||
private void WidgetCollection_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
WidgetCollection_Click(e.OriginalSource);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Pages.SlimPage.UserControls.SlimPageWindowStateBar"
|
||||
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.Pages.SlimPage.UserControls"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
x:Name="WindowStateBarUc"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="30"
|
||||
d:DesignWidth="300">
|
||||
|
||||
<UserControl.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource SettingsPage.Close.Icon}">
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource BackgroundColor.SlimPage.WidgetCollection}" />
|
||||
<Setter Property="IconCornerRadius"
|
||||
Value="15" />
|
||||
<Setter Property="IconHeight"
|
||||
Value="30" />
|
||||
<Setter Property="IconWidth"
|
||||
Value="30" />
|
||||
<Setter Property="BorderPadding"
|
||||
Value="10" />
|
||||
<Setter Property="Margin"
|
||||
Value="7.5 0 0 0" />
|
||||
</Style>
|
||||
|
||||
</StackPanel.Resources>
|
||||
|
||||
<ico:AdaptableIcon MouseUp="WindowButton_MouseUp"
|
||||
TouchDown="WindowButton_TouchDown"
|
||||
Tag="maximize"
|
||||
Visibility="{Binding ElementName=WindowStateBarUc, Path=ShowFullStateBar, Converter={StaticResource BoolToVisibility}}"
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Maximize}"
|
||||
SelectedInternIcon="window_fullscreen" />
|
||||
|
||||
<ico:AdaptableIcon MouseUp="WindowButton_MouseUp"
|
||||
TouchDown="WindowButton_TouchDown"
|
||||
Tag="close"
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Close}"
|
||||
SelectedInternIcon="window_close" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,99 @@
|
||||
using C4IT.Logging;
|
||||
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 static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SlimPage.UserControls
|
||||
{
|
||||
public partial class SlimPageWindowStateBar : UserControl
|
||||
{
|
||||
public bool ShowFullStateBar
|
||||
{
|
||||
get { return (bool)GetValue(ShowFullStateBarProperty); }
|
||||
set { SetValue(ShowFullStateBarProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowFullStateBarProperty =
|
||||
DependencyProperty.Register("ShowFullStateBar", typeof(bool), typeof(SlimPageWindowStateBar), new PropertyMetadata(false));
|
||||
|
||||
public SlimPageWindowStateBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region ClickedMaximize Event
|
||||
|
||||
public static readonly RoutedEvent ClickedMaximizeEvent = EventManager.RegisterRoutedEvent("ClickedMaximize", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SlimPageWindowStateBar));
|
||||
|
||||
public event RoutedEventHandler ClickedMaximize
|
||||
{
|
||||
add { AddHandler(ClickedMaximizeEvent, value); }
|
||||
remove { RemoveHandler(ClickedMaximizeEvent, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ClickedClose Event
|
||||
|
||||
public static readonly RoutedEvent ClickedCloseEvent = EventManager.RegisterRoutedEvent("ClickedClose", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SlimPageWindowStateBar));
|
||||
|
||||
public event RoutedEventHandler ClickedClose
|
||||
{
|
||||
add { AddHandler(ClickedCloseEvent, value); }
|
||||
remove { RemoveHandler(ClickedCloseEvent, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void WindowButton_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
RoutedEventArgs newEventArgs = null;
|
||||
switch (senderElement.Tag)
|
||||
{
|
||||
case "maximize":
|
||||
newEventArgs = new RoutedEventArgs(ClickedMaximizeEvent);
|
||||
break;
|
||||
case "close":
|
||||
newEventArgs = new RoutedEventArgs(ClickedCloseEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (newEventArgs != null)
|
||||
RaiseEvent(newEventArgs);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void WindowButton_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
WindowButton_Click(sender);
|
||||
}
|
||||
|
||||
private void WindowButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
WindowButton_Click(sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user