337 lines
21 KiB
XML
337 lines
21 KiB
XML
<Window x:Class="GeekDesk.MainWindow"
|
|
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:GeekDesk"
|
|
xmlns:tp="clr-namespace:GeekDesk.EditTextBlock"
|
|
mc:Ignorable="d"
|
|
xmlns:util="clr-namespace:GeekDesk.Util"
|
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" x:Name="window"
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
Title="MainWindow" Height="500" Width="600"
|
|
WindowStyle="None"
|
|
AllowsTransparency="True"
|
|
Background="Transparent"
|
|
OpacityMask ="White"
|
|
>
|
|
<WindowChrome.WindowChrome>
|
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
|
|
</WindowChrome.WindowChrome>
|
|
<Window.Resources>
|
|
|
|
<!--左侧栏样式动画-->
|
|
<Style x:Key="menuStyle" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemBaseStyle}">
|
|
<Setter Property="FontSize" Value="15"/>
|
|
<Setter Property="Margin" Value="0,0,0,1"/>
|
|
<Setter Property="Background">
|
|
<Setter.Value>
|
|
<SolidColorBrush Opacity="0"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="False"/>
|
|
<Condition Property="IsSelected" Value="False"/>
|
|
</MultiTrigger.Conditions>
|
|
<MultiTrigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation To="15" Duration="0:0:0.5" Storyboard.TargetProperty="FontSize"/>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</MultiTrigger.EnterActions>
|
|
<MultiTrigger.ExitActions>
|
|
<BeginStoryboard>
|
|
<Storyboard Timeline.DesiredFrameRate="60">
|
|
<DoubleAnimation To="18" Duration="0:0:0.001" Storyboard.TargetProperty="FontSize"/>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</MultiTrigger.ExitActions>
|
|
</MultiTrigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#FFE4DBDB"/>
|
|
</Trigger>
|
|
<Trigger Property="IsSelected" Value="true">
|
|
<Setter Property="Background" Value="#FFECECEC"/>
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
|
|
<!--右侧栏样式动画-->
|
|
<Style x:Key="imageStyle" TargetType="Image">
|
|
<Setter Property="Width" Value="{Binding ImageWidth}"/>
|
|
<Setter Property="Height" Value="{Binding ImageHeight}"/>
|
|
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="True"/>
|
|
</MultiTrigger.Conditions>
|
|
<MultiTrigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Width"/>
|
|
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Height"/>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</MultiTrigger.EnterActions>
|
|
<MultiTrigger.ExitActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Width"/>
|
|
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Height"/>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</MultiTrigger.ExitActions>
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<util:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
|
|
|
</Window.Resources>
|
|
|
|
|
|
<Border CornerRadius="5" BorderThickness="0" Background="White" LostFocus="App_LostFocus">
|
|
<Border CornerRadius="5" BorderThickness="0">
|
|
<!--背景图片-->
|
|
<Border.Background>
|
|
<ImageBrush ImageSource="D:\壁纸\tmig.jpg" Opacity="1"></ImageBrush>
|
|
</Border.Background>
|
|
<Grid>
|
|
<!--<Grid.Background>
|
|
<VisualBrush Stretch="Uniform" Visual="{Binding ElementName=test}"/>
|
|
</Grid.Background>-->
|
|
<!--<Grid.Background>
|
|
<SolidColorBrush Color="Black" Opacity="0.5"/>
|
|
</Grid.Background>-->
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
|
<RowDefinition Height="*"></RowDefinition>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="165" MaxWidth="200"></ColumnDefinition>
|
|
<ColumnDefinition Width="45*"></ColumnDefinition>
|
|
<ColumnDefinition Width="382*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
|
<DockPanel.Background>
|
|
<SolidColorBrush Opacity="0.01"/>
|
|
</DockPanel.Background>
|
|
<Image Source="/Resource/Image/WindowLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
|
|
</DockPanel>
|
|
|
|
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
|
|
<DockPanel.Background>
|
|
<SolidColorBrush Opacity="0.01"/>
|
|
</DockPanel.Background>
|
|
<hc:UniformSpacingPanel Spacing="0" Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
|
|
<Button Background="Transparent"
|
|
BorderThickness="0"
|
|
hc:IconElement.Geometry="M917.930667 512c0-57.6 36.181333-106.496 86.869333-125.952a505.429333 505.429333 0 0 0-55.210667-133.461333A134.826667 134.826667 0 0 1 771.413333 74.410667 507.733333 507.733333 0 0 0 637.952 19.2 135.168 135.168 0 0 1 512 106.069333 134.912 134.912 0 0 1 386.048 19.2 505.429333 505.429333 0 0 0 252.586667 74.410667c22.186667 49.749333 13.141333 109.824-27.562667 150.528a135.168 135.168 0 0 1-150.528 27.648 502.016 502.016 0 0 0-55.296 133.461333c50.688 19.626667 86.869333 68.437333 86.869333 125.952 0 57.6-36.181333 106.496-86.869333 125.952 12.117333 47.530667 30.72 92.330667 55.210667 133.461333a134.826667 134.826667 0 0 1 178.090666 178.176 507.733333 507.733333 0 0 0 133.546667 55.210667A135.168 135.168 0 0 1 512 917.930667c57.6 0 106.496 36.181333 125.952 86.869333a505.429333 505.429333 0 0 0 133.461333-55.210667 134.912 134.912 0 0 1 27.562667-150.528 135.168 135.168 0 0 1 150.528-27.648 502.016 502.016 0 0 0 55.296-133.461333A134.912 134.912 0 0 1 917.930667 512zM512 647.338667a135.338667 135.338667 0 1 1 0.085333-270.762667A135.338667 135.338667 0 0 1 512 647.338667z"
|
|
hc:IconElement.Height="18"
|
|
hc:IconElement.Width="18"
|
|
HorizontalAlignment="Right"
|
|
Click="ConfigButtonClick"
|
|
Initialized="SettingButton_Initialized"
|
|
x:Name="SettingButton"
|
|
>
|
|
<!--<Button.ContextMenu>
|
|
<ContextMenu Width="200" x:Name="SettingMenu">
|
|
<MenuItem Header="设置" Click="ConfigApp"/>
|
|
</ContextMenu>
|
|
</Button.ContextMenu>-->
|
|
</Button>
|
|
<Button Background="Transparent"
|
|
BorderThickness="0"
|
|
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
|
hc:IconElement.Height="18"
|
|
hc:IconElement.Width="18"
|
|
HorizontalAlignment="Right"
|
|
Click="CloseButtonClick"
|
|
/>
|
|
</hc:UniformSpacingPanel>
|
|
|
|
</DockPanel>
|
|
|
|
<!--左侧栏-->
|
|
<hc:Card x:Name="leftCard" Grid.Row="1" Grid.Column="0"
|
|
BorderThickness="1"
|
|
Effect="{DynamicResource EffectShadow2}"
|
|
Margin="5,0,0,5"
|
|
>
|
|
<hc:Card.Background>
|
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0.5"/>
|
|
</hc:Card.Background>
|
|
<hc:Card.BorderBrush>
|
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
|
</hc:Card.BorderBrush>
|
|
<hc:Card.ContextMenu>
|
|
<ContextMenu Width="200">
|
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
|
</ContextMenu>
|
|
</hc:Card.ContextMenu>
|
|
<WrapPanel Orientation="Horizontal">
|
|
<ListBox x:Name="menus"
|
|
ItemsSource="{Binding MenuList}"
|
|
BorderThickness="0" Foreground="{x:Null}"
|
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
|
>
|
|
<ListBox.Resources>
|
|
<ContextMenu x:Key="menuDialog" Width="200">
|
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
|
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
|
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
|
</ContextMenu>
|
|
</ListBox.Resources>
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource menuStyle}">
|
|
<Setter Property="ContextMenu" Value="{StaticResource menuDialog}"/>
|
|
</Style>
|
|
</ListBox.ItemContainerStyle>
|
|
<ListBox.Background>
|
|
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
|
</ListBox.Background>
|
|
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="30" ItemsWidth="{Binding ElementName=LeftColumn, Path=Width, Converter={StaticResource MenuWidthConvert}}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand2, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"/>
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel MouseLeftButtonDown="MenuClick" Tag="{Binding}">
|
|
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
|
HorizontalAlignment="Left"
|
|
Width="{Binding ElementName=LeftColumn, Path=Width, Converter={StaticResource MenuWidthConvert}}"
|
|
FontSize="15"
|
|
TextAlignment="Left"
|
|
LostFocus="LostFocusOrEnterDown"
|
|
KeyDown="LostFocusOrEnterDown"
|
|
Tag="{Binding}"
|
|
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
|
Visibility="{Binding MenuEdit}"/>
|
|
<StackPanel Orientation="Horizontal">
|
|
<Button Background="Transparent"
|
|
BorderThickness="0"
|
|
hc:IconElement.Geometry="M438.857143 548.571429a36.571429 36.571429 0 0 1 36.571428 36.571428v256a36.571429 36.571429 0 0 1-36.571428 36.571429H182.857143a36.571429 36.571429 0 0 1-36.571429-36.571429v-256a36.571429 36.571429 0 0 1 36.571429-36.571428h256z m402.285714 0a36.571429 36.571429 0 0 1 36.571429 36.571428v256a36.571429 36.571429 0 0 1-36.571429 36.571429h-256a36.571429 36.571429 0 0 1-36.571428-36.571429v-256a36.571429 36.571429 0 0 1 36.571428-36.571428h256z m-438.857143 73.142857H219.428571v182.857143h182.857143v-182.857143z m402.285715 0h-182.857143v182.857143h182.857143v-182.857143zM438.857143 146.285714a36.571429 36.571429 0 0 1 36.571428 36.571429v256a36.571429 36.571429 0 0 1-36.571428 36.571428H182.857143a36.571429 36.571429 0 0 1-36.571429-36.571428V182.857143a36.571429 36.571429 0 0 1 36.571429-36.571429h256z m402.285714 0a36.571429 36.571429 0 0 1 36.571429 36.571429v256a36.571429 36.571429 0 0 1-36.571429 36.571428h-256a36.571429 36.571429 0 0 1-36.571428-36.571428V182.857143a36.571429 36.571429 0 0 1 36.571428-36.571429h256zM402.285714 219.428571H219.428571v182.857143h182.857143V219.428571z m402.285715 0h-182.857143v182.857143h182.857143V219.428571z"
|
|
hc:IconElement.Height="18"
|
|
hc:IconElement.Width="18"
|
|
/>
|
|
<TextBlock Text="{Binding MenuName}"
|
|
VerticalAlignment="Center"
|
|
IsVisibleChanged="MenuWhenVisibilityChanged"
|
|
Visibility="{Binding NotMenuEdit}"
|
|
/>
|
|
</StackPanel>
|
|
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</WrapPanel>
|
|
</hc:Card>
|
|
|
|
<!--分割线-->
|
|
<GridSplitter DragCompleted="LeftCardResize" Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
|
|
|
<!--右侧栏-->
|
|
<hc:Card AllowDrop="True"
|
|
Drop="Wrap_Drop"
|
|
x:Name="rightCard"
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
BorderThickness="1"
|
|
Effect="{DynamicResource EffectShadow2}"
|
|
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
|
<hc:Card.Background>
|
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0.5"/>
|
|
</hc:Card.Background>
|
|
<hc:Card.BorderBrush>
|
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
|
</hc:Card.BorderBrush>
|
|
<WrapPanel Orientation="Horizontal">
|
|
<ListBox x:Name="icons" ItemsSource="{Binding}"
|
|
BorderThickness="0"
|
|
SelectionChanged="IconSelectionChanged"
|
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
|
>
|
|
<ListBox.Background>
|
|
<SolidColorBrush Opacity="0"/>
|
|
</ListBox.Background>
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="115" ItemsWidth="100" HorizontalAlignment="Center" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"/>
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
|
|
<ListBox.Resources>
|
|
<ContextMenu x:Key="iconDialog" Width="200">
|
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
|
<MenuItem Header="资源管理器菜单" Click="MenuItem_Click" Tag="{Binding}"/>
|
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
|
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
|
</ContextMenu>
|
|
</ListBox.Resources>
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
<Style TargetType="ListBoxItem">
|
|
<Setter Property="ContextMenu" Value="{StaticResource iconDialog}"/>
|
|
</Style>
|
|
</ListBox.ItemContainerStyle>
|
|
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Tag="{Binding}"
|
|
MouseLeftButtonUp="IconClick"
|
|
HorizontalAlignment="Center"
|
|
Margin="5,5,5,5"
|
|
hc:Poptip.HitMode="None"
|
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
|
hc:Poptip.Content="{Binding Content}"
|
|
hc:Poptip.Placement="BottomLeft"
|
|
>
|
|
<Image Style="{StaticResource imageStyle}" />
|
|
<TextBlock MaxWidth="80"
|
|
MaxHeight="40"
|
|
TextWrapping="Wrap"
|
|
TextTrimming="WordEllipsis"
|
|
TextAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Text="{Binding Name}"/>
|
|
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</WrapPanel>
|
|
</hc:Card>
|
|
<hc:NotifyIcon Icon="/Resource/Image/Ico.png" Text="GeekDesk" Click="NotifyIcon_Click">
|
|
<hc:NotifyIcon.ContextMenu>
|
|
<ContextMenu Width="200">
|
|
<MenuItem Header="打开面板" Click="ShowApp"/>
|
|
<MenuItem Header="设置" Click="ConfigApp"/>
|
|
<MenuItem Header="退出" Click="ExitApp"/>
|
|
</ContextMenu>
|
|
</hc:NotifyIcon.ContextMenu>
|
|
|
|
</hc:NotifyIcon>
|
|
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
|
</Grid>
|
|
</Border>
|
|
</Border>
|
|
|
|
|
|
|
|
</Window>
|