aktueller stand

This commit is contained in:
Meik
2026-02-19 13:22:30 +01:00
parent 610e479e69
commit e6968e29eb
11 changed files with 1406 additions and 1018 deletions

View File

@@ -0,0 +1,221 @@
<Window x:Class="FasdDesktopUi.Pages.DesktopWidgetPage.DesktopWidgetPageView"
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.DesktopWidgetPage"
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
Title="DesktopWidgetPageView"
AllowsTransparency="True"
WindowStyle="None"
Background="Transparent"
VerticalAlignment="Bottom"
ResizeMode="NoResize"
WindowState="Maximized"
ShowInTaskbar="False"
Topmost="True"
x:Name="DesktopWidgetWindow">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<Style x:Key="DesktopWidget.Grid"
TargetType="Grid">
<Setter Property="Visibility" Value="{Binding ElementName=DesktopWidgetWindow, Path=AreAllWidgetsVisible, Converter={StaticResource BoolToVisibility}}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=F4SDWidget}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="DesktopWidget.WidgetIcon"
TargetType="ico:AdaptableIcon">
<Setter Property="IconBackgroundColor" Value="{DynamicResource Color.AppBackground}"/>
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon}"/>
<Setter Property="IconWidth" Value="50"/>
<Setter Property="IconHeight" Value="50"/>
<Setter Property="IconCornerRadius" Value="25"/>
<Setter Property="BorderPadding" Value="10"/>
<Setter Property="Margin" Value="-1"/>
<Setter Property="Cursor" Value="Hand"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon.Hover}" />
<Setter Property="IconBackgroundColor" Value="{DynamicResource Background.Menu.Icon.Hover}" />
</Trigger>
</Style.Triggers>
<!--<Setter Property="BorderThickness" Value="10"/>
<Setter Property="BorderBrush" Value="{DynamicResource Color.Menu.Icon}"/>-->
</Style>
<Style x:Key="DesktopWidget.F4SDIcon"
TargetType="ico:AdaptableIcon">
<Setter Property="IconBackgroundColor" Value="{DynamicResource Color.AppBackground}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Margin" Value="-1"/>
<Setter Property="IconHeight" Value="70"/>
<Setter Property="IconWidth" Value="70"/>
<Setter Property="IconCornerRadius" Value="35"/>
<Setter Property="BorderPadding" Value="15"/>
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.F4SD}"/>
<Setter Property="SecondaryIconColor" Value="{DynamicResource Color.AppBackground}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon.Hover}" />
<Setter Property="IconBackgroundColor" Value="{DynamicResource Background.Menu.Icon.Hover}" />
<Setter Property="SecondaryIconColor" Value="{DynamicResource Background.Menu.Icon.Hover}" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Border x:Name="MainBorder"
Background="Transparent"
Padding="10"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Visibility="{Binding ElementName=DesktopWidgetWindow, Path=IsWindowVisible, Converter={StaticResource BoolToVisibility}}">
<Grid VerticalAlignment="Bottom"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid x:Name="RestartGrid"
Style="{DynamicResource DesktopWidget.Grid}"
Grid.Row="0">
<Border BorderBrush="{DynamicResource Color.Menu.Icon}"
BorderThickness="5"
CornerRadius="25"
Margin="0,10,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ico:AdaptableIcon x:Name="RestartWidget"
Style="{DynamicResource DesktopWidget.WidgetIcon}"
Grid.Row="0"
SelectedMaterialIcon="ic_power_settings_new"
MouseLeftButtonUp="RestartWidget_MouseLeftButtonUp"/>
</Border>
</Grid>
<Grid x:Name="SettingsGrid"
Style="{DynamicResource DesktopWidget.Grid}"
Grid.Row="1">
<Border BorderBrush="{DynamicResource Color.Menu.Icon}"
BorderThickness="5"
CornerRadius="25"
Margin="0,10,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ico:AdaptableIcon x:Name="SettingsWidget"
Style="{DynamicResource DesktopWidget.WidgetIcon}"
Grid.Row="0"
SelectedInternIcon="menuBar_settings"
MouseLeftButtonUp="SettingsWidget_MouseLeftButtonUp"/>
</Border>
</Grid>
<Grid x:Name="TicketNotifyGrid"
Grid.Row="2"
Style="{DynamicResource DesktopWidget.Grid}">
<Border BorderBrush="{DynamicResource Color.Menu.Icon}"
BorderThickness="5"
CornerRadius="25"
Margin="0,10,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ico:AdaptableIcon x:Name="TicketNotifyWidget"
Style="{DynamicResource DesktopWidget.WidgetIcon}"
Grid.Row="0"
SelectedInternIcon="misc_ticket"
MouseLeftButtonUp="TicketNotifyWidget_MouseLeftButtonUp"/>
</Border>
<Border Background="{DynamicResource Color.Red}"
Height="15"
Width="20"
CornerRadius="5"
Margin="0 -25 -35 0">
<TextBlock VerticalAlignment="Center"
HorizontalAlignment="Center">
1
</TextBlock>
</Border>
</Grid>
<Grid x:Name="SearchGrid"
Grid.Row="3"
Style="{DynamicResource DesktopWidget.Grid}">
<Border BorderBrush="{DynamicResource Color.Menu.Icon}"
BorderThickness="5"
CornerRadius="25"
Margin="0,10,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ico:AdaptableIcon x:Name="SearchWidget"
Style="{DynamicResource DesktopWidget.WidgetIcon}"
Grid.Row="1"
SelectedInternIcon="menuBar_search"
BorderPadding="5,5,12,12"
MouseLeftButtonUp="SearchWidget_MouseLeftButtonUp"/>
</Border>
</Grid>
<Grid Grid.Row="4">
<Border BorderBrush="{DynamicResource Color.Menu.Icon}"
BorderThickness="5"
CornerRadius="35"
Margin="0,10,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ico:AdaptableIcon x:Name="F4SDWidget"
Style="{DynamicResource DesktopWidget.F4SDIcon}"
SelectedInternIcon="f4sd"
MouseLeftButtonUp="F4SDWidget_MouseLeftButtonUp"/>
</Border>
<Border Background="{DynamicResource Color.Red}"
Height="15"
Width="20"
CornerRadius="5"
Margin="0 -35 -50 0"
Visibility="{Binding ElementName=DesktopWidgetWindow, Path=ShowMainNotification, Converter={StaticResource BoolToVisibility}}">
<TextBlock VerticalAlignment="Center"
HorizontalAlignment="Center">
1
</TextBlock>
</Border>
</Grid>
</Grid>
</Border>
</Window>

View File

@@ -0,0 +1,179 @@
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Pages.SearchPage;
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.Forms;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ContextMenu = System.Windows.Controls.ContextMenu;
using MenuItem = System.Windows.Controls.MenuItem;
using MessageBox = System.Windows.MessageBox;
namespace FasdDesktopUi.Pages.DesktopWidgetPage
{
/// <summary>
/// Interaction logic for DesktopWidgetPageView.xaml
/// </summary>
public partial class DesktopWidgetPageView : Window
{
public bool IsWindowVisible
{
get { return (bool)GetValue(IsWindowVisibleProperty); }
set { SetValue(IsWindowVisibleProperty, value); }
}
// Using a DependencyProperty as the backing store for IsWindowVisible. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsWindowVisibleProperty =
DependencyProperty.Register(nameof(IsWindowVisible), typeof(bool), typeof(DesktopWidgetPageView), new PropertyMetadata(true));
public bool AreAllWidgetsVisible
{
get { return (bool)GetValue(AreAllWidgetsVisibleProperty); }
set { SetValue(AreAllWidgetsVisibleProperty, value); }
}
// Using a DependencyProperty as the backing store for AreAllWidgetsVisible. This enables animation, styling, binding, etc...
public static readonly DependencyProperty AreAllWidgetsVisibleProperty =
DependencyProperty.Register(nameof(AreAllWidgetsVisible), typeof(bool), typeof(DesktopWidgetPageView), new PropertyMetadata(false));
public bool ShowMainNotification
{
get { return (bool)GetValue(ShowMainNotificationProperty); }
set { SetValue(ShowMainNotificationProperty, value); }
}
// Using a DependencyProperty as the backing store for ShowMainNotification. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ShowMainNotificationProperty =
DependencyProperty.Register(nameof(ShowMainNotification), typeof(bool), typeof(DesktopWidgetPageView), new PropertyMetadata(true));
public DesktopWidgetPageView()
{
InitializeComponent();
SourceInitialized += (s, e) =>
{
IntPtr handle = new WindowInteropHelper(this).Handle;
HwndSource.FromHwnd(handle).AddHook(new HwndSourceHook(cUtility.WindowProc));
};
}
private bool IsAnyOtherVisible() => cSupportCaseDataProvider.detailsPage.IsVisible || SearchPageView.Instance.IsVisible;
protected override void OnInitialized(EventArgs e)
{
cSupportCaseDataProvider.detailsPage.IsVisibleChanged += (sender, args) =>
{
this.Visibility = IsAnyOtherVisible() ? Visibility.Collapsed : Visibility.Visible;
};
SearchPageView.Instance.IsVisibleChanged += (sender, args) =>
{
this.Visibility = IsAnyOtherVisible() ? Visibility.Collapsed : Visibility.Visible;
};
base.OnInitialized(e);
}
private void F4SDWidget_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
AreAllWidgetsVisible = !AreAllWidgetsVisible;
ShowMainNotification = !ShowMainNotification;
}
private void SearchWidget_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
SearchPageView.Instance.ActivateSearchView();
}
private void SettingsWidget_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
ContextMenu menu = SetupSettingsContextMenu();
SettingsWidget.ContextMenu = menu;
SettingsWidget.ContextMenu.IsOpen = true;
}
private ContextMenu SetupSettingsContextMenu()
{
ContextMenu menu = new ContextMenu();
MenuItem languageItem = new MenuItem();
languageItem.Header = cMultiLanguageSupport.GetItem("Menu.SelectLanguage");
languageItem.Items.Add(new MenuItem { Header = "DE" });
languageItem.Items.Add(new MenuItem { Header = "EN" });
menu.Items.Add(languageItem);
MenuItem optionsItem = new MenuItem();
optionsItem.Header = cMultiLanguageSupport.GetItem("Menu.Options");
optionsItem.Click += (s, e) => MessageBox.Show(cMultiLanguageSupport.GetItem("Menu.Options"));
menu.Items.Add(optionsItem);
MenuItem m42Item = new MenuItem();
m42Item.Header = cMultiLanguageSupport.GetItem("M42Settings.SystemTray");
m42Item.Click += (s, e) => MessageBox.Show(cMultiLanguageSupport.GetItem("M42Settings.SystemTray"));
menu.Items.Add(m42Item);
MenuItem phoneItem = new MenuItem();
phoneItem.Header = cMultiLanguageSupport.GetItem("PhoneSettings.SystemTray");
phoneItem.Click += (s, e) => MessageBox.Show(cMultiLanguageSupport.GetItem("PhoneSettings.SystemTray"));
menu.Items.Add(phoneItem);
return menu;
}
private void ShowMessageBox(string message)
{
MessageBox.Show(message);
}
private void RestartWidget_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
ContextMenu menu = SetupRestartContextMenu();
RestartWidget.ContextMenu = menu;
RestartWidget.ContextMenu.IsOpen = true;
}
private ContextMenu SetupRestartContextMenu()
{
ContextMenu menu = new ContextMenu();
MenuItem restartItem = new MenuItem();
restartItem.Header = cMultiLanguageSupport.GetItem("Menu.Restart");
restartItem.Click += (s, e) => MessageBox.Show(cMultiLanguageSupport.GetItem("Menu.Restart"));
menu.Items.Add(restartItem);
MenuItem quitItem = new MenuItem();
quitItem.Header = cMultiLanguageSupport.GetItem("Menu.Quit");
quitItem.Click += (s, e) => MessageBox.Show(cMultiLanguageSupport.GetItem("Menu.Quit"));
menu.Items.Add(quitItem);
return menu;
}
private void TicketNotifyWidget_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("Dies wurde leider noch nicht implementiert, sollte dich das stören setze es doch gerne selber um.");
}
}
}