This commit is contained in:
Meik
2025-11-11 11:03:42 +01:00
commit dc3e8a2e4c
582 changed files with 191465 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<UserControl x:Class="F4SDicons.User_Controls.CopyTextBox"
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:F4SDicons.User_Controls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:Background="Moccasin" Name="TextUserControl">
<DockPanel>
<DockPanel.Resources>
<Style TargetType="ico:AdaptableIcon">
<Setter Property="PrimaryIconColor" Value="{DynamicResource color3D3C3C}"/>
<Setter Property="IconHeight" Value="40"/>
<Setter Property="IconWidth" Value="40"/>
<Setter Property="BorderPadding" Value="5"/>
<Setter Property="Margin" Value="10"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource color1F92EE}"/>
<Setter Property="IconBackgroundColor" Value="{DynamicResource colorF2F2F2}"/>
<Setter Property="Cursor" Value="Hand"/>
</Trigger>
</Style.Triggers>
</Style>
</DockPanel.Resources>
<ico:AdaptableIcon DockPanel.Dock="Right" x:Name="CopyBorder" MouseLeftButtonUp="currentNameButton_Click" ToolTip="{Binding ElementName=TextUserControl, Path=ToolTipText}" SelectedMaterialIcon="ic_content_copy">
</ico:AdaptableIcon>
<TextBlock Name="CopyBlock" Text="{Binding ElementName=TextUserControl, Path=TextContent}" Foreground="{DynamicResource color3D3C3C}" FontFamily="Calibri Light" TextWrapping="Wrap" Height="45" FontSize="14" Background="{DynamicResource colorF7FAFA}" Margin="10,0,0,0">
</TextBlock>
</DockPanel>
</UserControl>

View File

@@ -0,0 +1,87 @@
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
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 F4SDicons.User_Controls
{
public partial class CopyTextBox : UserControl
{
public CopyTextBox()
{
InitializeComponent();
}
#region Dependency Properties
public string TextContent
{
get { return (string)GetValue(TextContentProperty); }
set { SetValue(TextContentProperty, value); }
}
// Using a DependencyProperty as the backing store for TextContent. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TextContentProperty =
DependencyProperty.Register("TextContent", typeof(string), typeof(CopyTextBox), new PropertyMetadata(""));
public string ToolTipText
{
get { return (string)GetValue(ToolTipTextProperty); }
set { SetValue(ToolTipTextProperty, value); }
}
// Using a DependencyProperty as the backing store for ToolTipText. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ToolTipTextProperty =
DependencyProperty.Register("ToolTipText", typeof(string), typeof(CopyTextBox), new PropertyMetadata(""));
#endregion
#region Klick Event
private void currentNameButton_Click(object sender, MouseButtonEventArgs e)
{
System.Windows.Clipboard.SetText(CopyBlock.Text);
if (!(sender is AdaptableIcon senderIcon) )
{
return;
}
Dispatcher.Invoke(async ()=>
{
var currentMaterialIcon = senderIcon.SelectedMaterialIcon;
senderIcon.SelectedMaterialIcon = null;
senderIcon.SelectedInternIcon = F4SD_AdaptableIcon.Enums.enumInternIcons.misc_check;
Color ColorGreen = (Color)ColorConverter.ConvertFromString("#75B159");
senderIcon.PrimaryIconColor = new SolidColorBrush(ColorGreen);
await Task.Delay(500);
senderIcon.SelectedInternIcon = null;
senderIcon.SelectedMaterialIcon = currentMaterialIcon;
senderIcon.ClearValue(AdaptableIcon.PrimaryIconColorProperty);
});
}
#endregion
}
}

View File

@@ -0,0 +1,35 @@
<UserControl x:Class="F4SDicons.User_Controls.IconGrid"
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:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:local="clr-namespace:F4SDicons.User_Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibility"/>
</UserControl.Resources>
<StackPanel x:Name="GridCollection">
<ItemsControl ItemsSource="{Binding IconInformation}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ico:AdaptableIcon x:Name="adaptableIcon" ToolTip="{Binding IconName}" Tag="{Binding IconName}" SelectedInternIcon="{Binding InternIcon}" SelectedMaterialIcon="{Binding MaterialIcon}" MouseLeftButtonUp="adaptableIcon_MouseLeftButtonUp" TouchDown="adaptableIcon_TouchDown" Visibility="{Binding IsVisible, Converter = {StaticResource BooleanToVisibility}}" Style="{DynamicResource GridIconStyle}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,103 @@
using F4SD_AdaptableIcon.Enums;
using F4SDicons.Models;
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
using MaterialIcons;
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;
using static FasdDesktopUi.Basics.UserControls.AdaptableIcon.cIconPainter;
namespace F4SDicons.User_Controls
{
public partial class IconGrid : UserControl
{
public List<cAdvancedIconInformation> IconInformation
{
get { return (List<cAdvancedIconInformation>)GetValue(IconInformationProperty); }
set { SetValue(IconInformationProperty, value); }
}
// Using a DependencyProperty as the backing store for IconInformation. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IconInformationProperty =
DependencyProperty.Register("IconInformation", typeof(List<cAdvancedIconInformation>), typeof(IconGrid), new PropertyMetadata(null));
public IconGrid()
{
InitializeComponent();
}
#region Klick Event
#region Event
public event RoutedEventHandler IconSelected
{
add { AddHandler(IconCollectionUserControl.IconSelectedEvent, value); }
remove { RemoveHandler(IconCollectionUserControl.IconSelectedEvent, value); }
}
#endregion
#region Klick
private void adaptableIcon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
MaterialIconWasClicked(sender);
}
private void adaptableIcon_TouchDown(object sender, TouchEventArgs e)
{
MaterialIconWasClicked(sender);
}
#endregion
#region On Klick
private void MaterialIconWasClicked(object sender)
{
if (!(sender is FrameworkElement frameworkElement))
return;
enumIconTypes? iconType = null;
if (Enum.TryParse(frameworkElement.Tag.ToString(), out MaterialIconType _))
iconType = enumIconTypes.material;
else if (Enum.TryParse(frameworkElement.Tag.ToString(), out enumInternIcons _))
iconType = enumIconTypes.intern;
if (iconType is null)
return;
RoutedEventArgsIconInfo eventArgs = new RoutedEventArgsIconInfo(IconCollectionUserControl.IconSelectedEvent) { IconName = frameworkElement.Tag.ToString(), IconType = iconType.Value };
RaiseEvent(eventArgs);
}
#endregion
#endregion
}
}

View File

@@ -0,0 +1,34 @@
<UserControl x:Class="F4SDicons.User_Controls.IconList"
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:F4SDicons.User_Controls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibility"/>
</UserControl.Resources>
<StackPanel x:Name="collectionStackPanel">
<ItemsControl ItemsSource="{Binding IconInformation}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border x:Name="adaptableBorder" MouseLeftButtonUp="MaterialStackPanel_MouseLeftButtonUp" TouchDown="MaterialStackPanel_TouchDown" ToolTip="{Binding IconName}" Tag="{Binding IconName}" Visibility="{Binding IsVisible, Converter = {StaticResource BooleanToVisibility}}" Style="{DynamicResource ListBorderIconStyle}">
<StackPanel x:Name="adaptableStackPanel" Orientation="Horizontal">
<ico:AdaptableIcon Margin="0, 0, 10, 0" BorderPadding="2.5" IconHeight="25" IconWidth="25" SelectedInternIcon="{Binding InternIcon}" SelectedMaterialIcon="{Binding MaterialIcon}"/>
<Border x:Name="scrollBorder">
<TextBlock x:Name="adaptableBlock" FontFamily="Calibri Regular" FontSize="18" Text="{Binding IconName}"/>
</Border>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,92 @@
using F4SD_AdaptableIcon.Enums;
using F4SDicons.Models;
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
using MaterialIcons;
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;
using static FasdDesktopUi.Basics.UserControls.AdaptableIcon.cIconPainter;
namespace F4SDicons.User_Controls
{
public partial class IconList : UserControl
{
public List<cAdvancedIconInformation> IconInformation
{
get { return (List<cAdvancedIconInformation>)GetValue(IconInformationProperty); }
set { SetValue(IconInformationProperty, value); }
}
// Using a DependencyProperty as the backing store for IconInformation. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IconInformationProperty =
DependencyProperty.Register("IconInformation", typeof(List<cAdvancedIconInformation>), typeof(IconList), new PropertyMetadata(null));
public IconList()
{
InitializeComponent();
}
#region Klick
private void MaterialStackPanel_TouchDown(object sender, TouchEventArgs e)
{
MaterialStackPanelWasClicked(sender);
}
private void MaterialStackPanel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
MaterialStackPanelWasClicked(sender);
}
#endregion
#region Event
public event RoutedEventHandler IconSelected
{
add { AddHandler(IconCollectionUserControl.IconSelectedEvent, value); }
remove { RemoveHandler(IconCollectionUserControl.IconSelectedEvent, value); }
}
#endregion
private void MaterialStackPanelWasClicked(object sender)
{
if (!(sender is FrameworkElement frameworkElement))
return;
enumIconTypes? iconType = null;
if (Enum.TryParse(frameworkElement.Tag.ToString(), out MaterialIconType _))
iconType = enumIconTypes.material;
else if (Enum.TryParse(frameworkElement.Tag.ToString(), out enumInternIcons _))
iconType = enumIconTypes.intern;
if (iconType is null)
return;
RoutedEventArgsIconInfo eventArgs = new RoutedEventArgsIconInfo(IconCollectionUserControl.IconSelectedEvent) { IconName = frameworkElement.Tag.ToString(), IconType = iconType.Value };
RaiseEvent(eventArgs);
}
}
}

View File

@@ -0,0 +1,54 @@
<UserControl x:Class="F4SDicons.User_Controls.SearchBar"
x:Name="_this"
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:F4SDicons.User_Controls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="500">
<Border Grid.Row="0" Background="{DynamicResource colorF7FAFA}" CornerRadius="17.5" VerticalAlignment="Center" Margin="10,0,15,5" Height="35">
<Border.Resources>
<Style TargetType="ico:AdaptableIcon">
<Setter Property="PrimaryIconColor" Value="{DynamicResource color3D3C3C}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource color1F92EE}"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Resources>
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<ico:AdaptableIcon Grid.Column="1" x:Name="SearchIcon" BorderPadding="0" IconHeight="20" IconWidth="20" SelectedInternIcon="menuBar_search">
</ico:AdaptableIcon>
<TextBlock Grid.Column="2" Name="previewTextBlock" Foreground="{DynamicResource color3D3C3C}" Background="Transparent" VerticalAlignment="Center" Margin="10,0,0,0">
Suchbegriff eingeben...
</TextBlock>
<TextBox Name="bindingTextBox" Grid.Column="2" Foreground="{DynamicResource color3D3C3C}" Background="Transparent" BorderThickness="0" VerticalAlignment="Center" GotFocus="TextBoxGotFocus" LostFocus="TextBoxLostFocus" Margin="10,0,0,0"
Text = "{Binding SearchValue, Mode = OneWayToSource, UpdateSourceTrigger = PropertyChanged}" Grid.ColumnSpan="2">
</TextBox>
<ico:AdaptableIcon Grid.Column="3" x:Name="clearSearchIcon" BorderPadding="0" IconHeight="12" IconWidth="12" MouseLeftButtonUp="ClearSearchButtonUp" Cursor="Hand" ToolTip="Eingabe löschen" SelectedInternIcon="window_close">
</ico:AdaptableIcon>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,57 @@
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 F4SDicons.User_Controls
{
public partial class SearchBar : UserControl
{
public SearchBar()
{
InitializeComponent();
}
#region Default Suchtext
private void TextBoxGotFocus(object sender, EventArgs e)
{
//previewTextBlock.Text = "";
previewTextBlock.Visibility = Visibility.Hidden;
}
private void TextBoxLostFocus(object sender, EventArgs e)
{
if (bindingTextBox.Text == "")
{
//previewTextBlock.Text = "Suchbegriff eingeben...";
previewTextBlock.Visibility = Visibility.Visible;
}
}
#endregion
#region TextBox
private void ClearSearchButtonUp(object sender, MouseButtonEventArgs e)
{
bindingTextBox.Text = String.Empty;
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(bindingTextBox), null);
Keyboard.ClearFocus();
TextBoxLostFocus(null, null);
}
#endregion
}
}

View File

@@ -0,0 +1,80 @@
<UserControl x:Class="F4SDicons.User_Controls.WindowStateBar"
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:F4SDicons.User_Controls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="60" d:DesignWidth="215"
Name="StateBar">
<!-- TODO: WindowChrome-->
<Grid Grid.Row="0" Name="StateGrid" Margin="0,10,0,0" Background="{DynamicResource colorE9E9E9}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style TargetType="Border">
<Setter Property="Background" Value="{DynamicResource colorE9E9E9}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="CornerRadius" Value="5"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource colorF2F2F2}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="ico:AdaptableIcon">
<Setter Property="PrimaryIconColor" Value="{DynamicResource color3D3C3C}"/>
<Setter Property="IconHeight" Value="35"/>
<Setter Property="IconWidth" Value="35"/>
<Setter Property="BorderPadding" Value="5"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource color1F92EE}"/>
<Setter Property="IconBackgroundColor" Value="{DynamicResource colorF2F2F2}"/>
<Setter Property="Cursor" Value="Hand"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<ico:AdaptableIcon MouseLeftButtonUp="WindowToTopLeftCorner" Grid.Column="0" ToolTip="Fenster links anheften" SelectedInternIcon="window_dock_left">
</ico:AdaptableIcon>
<ico:AdaptableIcon MouseLeftButtonUp="WindowToTopRightCorner" Grid.Column="1" ToolTip="Fenster rechts anheften" SelectedInternIcon="window_dock_right">
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="minimizeIcon" Grid.Column="2" MouseLeftButtonUp="minimizeWindow_ButtonUp" ToolTip="Anwendung minimieren" SelectedInternIcon="window_minimize">
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="resizeIcon" Grid.Column="3" ToolTip="Anwendung ist bereits im Fenster-Modus" PrimaryIconColor="{DynamicResource color9A9B9B}" SelectedInternIcon="window_fullscreenExit">
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="resizeIcon2" Grid.Column="3" Visibility="Collapsed" MouseLeftButtonUp="resizeWindow2_ButtonUp" ToolTip="Fenster verkleinern" SelectedInternIcon="window_fullscreenExit">
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="closeIcon" Grid.Column="4" MouseLeftButtonUp="closeWindow_ButtonUp" ToolTip="Anwendung beenden" SelectedInternIcon="window_close">
</ico:AdaptableIcon>
</Grid>
</UserControl>

View File

@@ -0,0 +1,166 @@
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 F4SDicons.User_Controls
{
public partial class WindowStateBar : UserControl
{
public WindowStateBar()
{
InitializeComponent();
}
public bool isWindowRight = false;
#region DockWindow
//TopLeft Position of Screen
public static void TopLeftCorner(System.Windows.Window window)
{
var screen = System.Windows.Forms.Screen.FromPoint(new System.Drawing.Point((int)window.Left, (int)window.Top));
window.Top = screen.WorkingArea.Top;
window.Left = screen.WorkingArea.Left;
}
//TopRight Position of Screen
public static void TopRightCorner(System.Windows.Window window)
{
var screen = System.Windows.Forms.Screen.FromPoint(new System.Drawing.Point((int)window.Left, (int)window.Top));
window.Top = screen.WorkingArea.Top;
window.Left = screen.WorkingArea.Left + window.ActualWidth + window.ActualWidth;
}
public static void TopRightCorner2(System.Windows.Window window)
{
var screen = System.Windows.Forms.Screen.FromPoint(new System.Drawing.Point((int)window.Left, (int)window.Top));
window.Top = screen.WorkingArea.Top;
window.Left = screen.WorkingArea.Right - window.ActualWidth;
}
private void WindowToTopLeftCorner(object sender, MouseButtonEventArgs e)
{
resizeWindow();
TopLeftCorner(Window.GetWindow(this));
isWindowRight = false;
}
private void WindowToTopRightCorner(object sender, MouseButtonEventArgs e)
{
resizeWindow();
TopLeftCorner(Window.GetWindow(this));
isWindowRight = false;
TopRightCorner(Window.GetWindow(this));
isWindowRight = true;
}
#endregion
#region Minimize
//Minimize Window
private void minimizeWindow_ButtonUp(object sender, MouseButtonEventArgs e)
{
Window.GetWindow(this).WindowState = WindowState.Minimized;
}
#endregion
#region Resize
//Resize Window
private void resizeWindow2_ButtonUp(object sender, MouseButtonEventArgs e)
{
resizeWindow2();
if (isWindowRight == false)
{
TopLeftCorner(Window.GetWindow(this));
}
else
{
TopRightCorner2(Window.GetWindow(this));
}
resizeIcon.Visibility = Visibility.Visible;
resizeIcon2.Visibility = Visibility.Collapsed;
}
private void resizeWindow()
{
Rect rectangle = GetCurrentScreenWorkArea(Window.GetWindow(this));
double wHeight = rectangle.Height;
double wWidth = rectangle.Width;
wWidth = wWidth / 3;
Window.GetWindow(this).Height = wHeight;
Window.GetWindow(this).Width = wWidth;
resizeIcon2.Visibility = Visibility.Visible;
resizeIcon.Visibility = Visibility.Collapsed;
}
private void resizeWindow2()
{
Window.GetWindow(this).Height = 600;
Window.GetWindow(this).Width = 880;
}
#endregion
#region Display
public static Rect GetCurrentScreenWorkArea(System.Windows.Window window)
{
var screen = System.Windows.Forms.Screen.FromPoint(new System.Drawing.Point((int)window.Left, (int)window.Top));
var dpiScale = VisualTreeHelper.GetDpi(window);
return new Rect { Width = screen.WorkingArea.Width / dpiScale.DpiScaleX, Height = screen.WorkingArea.Height / dpiScale.DpiScaleY };
}
#endregion
#region Close Window
private void closeWindow_ButtonUp(object sender, MouseButtonEventArgs e)
{
Window.GetWindow(this).Close();
}
#endregion
#region Drag Move
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Window.GetWindow(this).DragMove();
}
#endregion
}
}

View File

@@ -0,0 +1,29 @@
<UserControl x:Class="F4SDicons.User_Controls.ZoomViewer"
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:F4SDicons.User_Controls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="450">
<Grid Name="currentIconGrid" Background="{DynamicResource colorE9E9E9}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ico:AdaptableIcon Grid.Row="0" x:Name="currentIcon" PrimaryIconColor="{DynamicResource color3D3C3C}" SecondaryIconColor="{DynamicResource colorF7FAFA}" IconHeight="100" IconWidth="100" Grid.RowSpan="2" RenderTransformOrigin="0.5, 0.5" VerticalAlignment="Center" HorizontalAlignment="Center">
<ico:AdaptableIcon.RenderTransform>
<RotateTransform/>
</ico:AdaptableIcon.RenderTransform>
</ico:AdaptableIcon>
<Slider Name="ZoomSlider" Grid.Row="1" Width="250" Minimum="50" Maximum="200" PreviewMouseLeftButtonUp="ZoomSlider_ButtonUp" PreviewMouseLeftButtonDown="ZoomSlider_ButtonUp" ValueChanged="Slider_ValueChanged" Value="100">
</Slider>
</Grid>
</UserControl>

View File

@@ -0,0 +1,84 @@
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace F4SDicons.User_Controls
{
public partial class ZoomViewer : UserControl
{
public ZoomViewer()
{
InitializeComponent();
}
#region Variables
bool zoomReachedMinimum = false;
#endregion
#region Value
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
double iconZoom = e.NewValue / 100;
currentIcon.IconHeight = 100 * iconZoom;
currentIcon.IconWidth = 100 * iconZoom;
if (iconZoom == 0.5)
{
zoomReachedMinimum = true;
}
if (zoomReachedMinimum == true && iconZoom == 2.0)
{
RotateEasterEgg();
zoomReachedMinimum = false;
}
}
#endregion
#region RotateIcon
private void RotateEasterEgg()
{
Storyboard storyboard = new Storyboard();
DoubleAnimation animation = new DoubleAnimation();
animation.From = 0;
animation.To = 360;
animation.Duration = new Duration(TimeSpan.FromSeconds(1));
storyboard.Children.Add(animation);
Storyboard.SetTarget(animation, currentIcon);
Storyboard.SetTargetProperty(animation, new PropertyPath("(Control.RenderTransform).(RotateTransform.Angle)"));
storyboard.Begin();
}
internal void ZoomSlider_ButtonUp(object sender, MouseButtonEventArgs e)
{
zoomReachedMinimum = false;
}
#endregion
}
}