增加搜索功能
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
@@ -12,6 +12,14 @@
|
|||||||
>
|
>
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<!--右侧栏样式动画-->
|
<!--右侧栏样式动画-->
|
||||||
|
<!--<Style x:Key="PanelStyle" TargetType="hc:SimpleStackPanel">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true">
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>-->
|
||||||
|
|
||||||
<Style x:Key="ImageStyle" TargetType="Image">
|
<Style x:Key="ImageStyle" TargetType="Image">
|
||||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||||
@@ -31,9 +39,14 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
|
<cvt:SearchResWidth x:Key="SearchResWidth"/>
|
||||||
|
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--右侧栏-->
|
<!--右侧栏-->
|
||||||
|
<Grid>
|
||||||
<hc:Card AllowDrop="True"
|
<hc:Card AllowDrop="True"
|
||||||
|
x:Name="WrapCard"
|
||||||
|
Visibility="Visible"
|
||||||
Drop="Wrap_Drop"
|
Drop="Wrap_Drop"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
@@ -50,6 +63,8 @@
|
|||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
||||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
@@ -86,12 +101,8 @@
|
|||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
<!--<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"/>
|
|
||||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"/>-->
|
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
<!--Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"-->
|
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -99,13 +110,9 @@
|
|||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
hc:Poptip.HitMode="None"
|
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
|
||||||
hc:Poptip.Content="{Binding Content}"
|
hc:Poptip.Content="{Binding Content}"
|
||||||
hc:Poptip.Placement="BottomLeft"
|
hc:Poptip.Placement="BottomLeft"
|
||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
|
||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
|
||||||
MouseEnter="StackPanel_MouseEnter"
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
>
|
>
|
||||||
@@ -126,5 +133,87 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
|
||||||
|
<hc:Card
|
||||||
|
x:Name="VerticalCard"
|
||||||
|
Visibility="Hidden"
|
||||||
|
BorderThickness="1"
|
||||||
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
|
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
||||||
|
<hc:Card.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||||
|
</hc:Card.Background>
|
||||||
|
<hc:Card.BorderBrush>
|
||||||
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
|
</hc:Card.BorderBrush>
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
||||||
|
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
|
>
|
||||||
|
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||||
|
BorderThickness="0"
|
||||||
|
Padding="0,10,0,0"
|
||||||
|
>
|
||||||
|
<ListBox.Background>
|
||||||
|
<SolidColorBrush Opacity="0"/>
|
||||||
|
</ListBox.Background>
|
||||||
|
|
||||||
|
<ListBox.Resources>
|
||||||
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.Resources>
|
||||||
|
|
||||||
|
<ListBox.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
|
</Style>
|
||||||
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<WrapPanel Tag="{Binding}"
|
||||||
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
||||||
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
hc:Poptip.HitMode="None"
|
||||||
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="{Binding Content}"
|
||||||
|
hc:Poptip.Placement="BottomLeft"
|
||||||
|
Background="#00FFFFFF"
|
||||||
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
|
Margin="25,20,0,0"
|
||||||
|
>
|
||||||
|
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
|
<TextBlock
|
||||||
|
Margin="10,5,0,0"
|
||||||
|
MaxHeight="40"
|
||||||
|
FontSize="13"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
TextTrimming="WordEllipsis"
|
||||||
|
TextAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
|
Text="{Binding Name}"/>
|
||||||
|
</WrapPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
</WrapPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</hc:Card>
|
||||||
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
|
private volatile static bool DROP_ICON = false;
|
||||||
|
private Thread dropCheckThread = null;
|
||||||
|
|
||||||
public RightCardControl()
|
public RightCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -42,6 +45,34 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
_swap = new DelegateCommand<int[]>(
|
_swap = new DelegateCommand<int[]>(
|
||||||
(indexes) =>
|
(indexes) =>
|
||||||
{
|
{
|
||||||
|
DROP_ICON = true;
|
||||||
|
if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
||||||
|
&& (dropCheckThread == null || !dropCheckThread.IsAlive))
|
||||||
|
{
|
||||||
|
dropCheckThread = new Thread(() =>
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
DROP_ICON = false;
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
} while (DROP_ICON);
|
||||||
|
|
||||||
|
MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
|
||||||
|
App.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
||||||
|
|| MainWindow.mainWindow.Opacity != 1)
|
||||||
|
{
|
||||||
|
Growl.WarningGlobal("已将图标排序规则重置为自定义!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
dropCheckThread.Start();
|
||||||
|
}
|
||||||
int fromS = indexes[0];
|
int fromS = indexes[0];
|
||||||
int to = indexes[1];
|
int to = indexes[1];
|
||||||
ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||||
@@ -165,9 +196,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
case IconStartType.ADMIN_STARTUP:
|
case IconStartType.ADMIN_STARTUP:
|
||||||
//p.StartInfo.Arguments = "1";//启动参数
|
//p.StartInfo.Arguments = "1";//启动参数
|
||||||
p.StartInfo.Verb = "runas";
|
p.StartInfo.Verb = "runas";
|
||||||
p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
||||||
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
|
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
|
||||||
p.StartInfo.ErrorDialog = false;
|
//p.StartInfo.ErrorDialog = false;
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
@@ -330,8 +361,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
string path = (string)obj;
|
string path = (string)obj;
|
||||||
IconInfo iconInfo = CommonCode.GetIconInfoByPath(path);
|
IconInfo iconInfo = CommonCode.GetIconInfoByPath(path);
|
||||||
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
|
||||||
}
|
}
|
||||||
|
CommonCode.SortIconList();
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -539,5 +571,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
SystemItemWindow.Show();
|
SystemItemWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void VisibilitySearchCard(Visibility vb)
|
||||||
|
{
|
||||||
|
VerticalCard.Visibility = vb;
|
||||||
|
if (vb == Visibility.Visible)
|
||||||
|
{
|
||||||
|
WrapCard.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WrapCard.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:GeekDesk"
|
|
||||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
|
||||||
x:Name="window"
|
x:Name="window"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||||
Title="GeekDesk"
|
Title="GeekDesk"
|
||||||
@@ -18,33 +16,42 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
Opacity="0"
|
Opacity="0"
|
||||||
Deactivated="Window_Deactivated"
|
Deactivated="App_LostFocus"
|
||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
KeyDown="OnKeyDown"
|
KeyDown="OnKeyDown"
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
|
MouseDown="MainWindow_MouseDown"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
||||||
</WindowChrome.WindowChrome>
|
</WindowChrome.WindowChrome>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
|
<RoutedUICommand x:Key="SearchItem" Text="SearchItem"/>
|
||||||
|
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
||||||
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
<Window.InputBindings>
|
||||||
|
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchItem}"/>
|
||||||
|
</Window.InputBindings>
|
||||||
|
<Window.CommandBindings>
|
||||||
|
<CommandBinding Command="{StaticResource SearchItem}" CanExecute="SearchItem"/>
|
||||||
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<Window.Effect>
|
<Window.Effect>
|
||||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
RenderingBias="Quality" ShadowDepth="2"/>
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
</Window.Effect>
|
</Window.Effect>
|
||||||
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
||||||
Background="AliceBlue" LostFocus="App_LostFocus"
|
Background="AliceBlue"
|
||||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
hc:Dialog.Token="IconInfoDialog"
|
hc:Dialog.Token="IconInfoDialog"
|
||||||
|
Focusable="True"
|
||||||
>
|
>
|
||||||
<hc:DialogContainer>
|
<hc:DialogContainer Focusable="True">
|
||||||
|
|
||||||
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
||||||
<!--背景图片-->
|
<!--背景图片-->
|
||||||
@@ -62,6 +69,7 @@
|
|||||||
</VisualBrush>
|
</VisualBrush>
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
@@ -69,9 +77,11 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
|
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!--获取焦点用-->
|
||||||
|
<TextBox x:Name="EmptyTextBox" Width="0"/>
|
||||||
|
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
||||||
@@ -123,7 +133,21 @@
|
|||||||
<!--分割线-->
|
<!--分割线-->
|
||||||
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
||||||
|
|
||||||
<uc:RightCardControl Grid.Row="1" Grid.Column="1"/>
|
<!--搜索输入框-->
|
||||||
|
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
|
||||||
|
x:Name="SearchBox"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
LostFocus="SearchBox_LostFocus"
|
||||||
|
Margin="-100,5,0,0"
|
||||||
|
Height="32"
|
||||||
|
FontSize="16"
|
||||||
|
Width="400"
|
||||||
|
BorderThickness="0"
|
||||||
|
TextChanged="SearchBox_TextChanged"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
|
||||||
|
|
||||||
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
|
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
|
||||||
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||||
|
|||||||
@@ -1,28 +1,22 @@
|
|||||||
using DraggAnimatedPanelExample;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Constant;
|
|
||||||
using GeekDesk.Control;
|
|
||||||
using GeekDesk.Control.UserControls.Config;
|
using GeekDesk.Control.UserControls.Config;
|
||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Interface;
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Task;
|
using GeekDesk.Task;
|
||||||
using GeekDesk.Thread;
|
using GeekDesk.MyThread;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Gma.System.MouseKeyHook;
|
|
||||||
using HandyControl.Data;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using NPinyin;
|
||||||
|
using GeekDesk.ViewModel.Temp;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
{
|
{
|
||||||
@@ -48,6 +42,7 @@ namespace GeekDesk
|
|||||||
this.SizeChanged += MainWindow_Resize;
|
this.SizeChanged += MainWindow_Resize;
|
||||||
ToDoTask.BackLogCheck();
|
ToDoTask.BackLogCheck();
|
||||||
|
|
||||||
|
|
||||||
////实例化隐藏 Hide类,进行时间timer设置
|
////实例化隐藏 Hide类,进行时间timer设置
|
||||||
MarginHide.ReadyHide(this);
|
MarginHide.ReadyHide(this);
|
||||||
if (appData.AppConfig.MarginHide)
|
if (appData.AppConfig.MarginHide)
|
||||||
@@ -56,6 +51,61 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示搜索框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SearchItem(object sender, CanExecuteRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
RightCard.VisibilitySearchCard(Visibility.Visible);
|
||||||
|
SearchBox.Visibility = Visibility.Visible;
|
||||||
|
SearchBox.Focus();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索开始
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
string inputText = SearchBox.Text.ToLower();
|
||||||
|
if (!string.IsNullOrEmpty(inputText))
|
||||||
|
{
|
||||||
|
SearchIconList.IconList.Clear();
|
||||||
|
ObservableCollection<MenuInfo> menuList = appData.MenuList;
|
||||||
|
foreach (MenuInfo menu in menuList)
|
||||||
|
{
|
||||||
|
ObservableCollection<IconInfo> iconList = menu.IconList;
|
||||||
|
foreach (IconInfo icon in iconList)
|
||||||
|
{
|
||||||
|
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
|
||||||
|
if (icon.Name.Contains(inputText) || pyName.Contains(inputText))
|
||||||
|
{
|
||||||
|
SearchIconList.IconList.Add(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SearchIconList.IconList.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏搜索框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SearchBox_LostFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SearchIconList.IconList.Clear();
|
||||||
|
RightCard.VisibilitySearchCard(Visibility.Collapsed);
|
||||||
|
SearchBox.Visibility = Visibility.Collapsed;
|
||||||
|
SearchBox.Text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载缓存数据
|
/// 加载缓存数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -302,13 +352,15 @@ namespace GeekDesk
|
|||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
//修改贴边隐藏状态为未隐藏
|
//修改贴边隐藏状态为未隐藏
|
||||||
|
mainWindow.Activate();
|
||||||
|
|
||||||
MarginHide.IS_HIDE = false;
|
MarginHide.IS_HIDE = false;
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
||||||
}
|
}
|
||||||
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
Keyboard.Focus(mainWindow);
|
mainWindow.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void HideApp()
|
public static void HideApp()
|
||||||
@@ -342,6 +394,7 @@ namespace GeekDesk
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWindow.Opacity = 0;
|
mainWindow.Opacity = 0;
|
||||||
|
CommonCode.SortIconList();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
|
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
|
||||||
@@ -352,6 +405,10 @@ namespace GeekDesk
|
|||||||
//防止关闭动画后 窗体仍是0透明度
|
//防止关闭动画后 窗体仍是0透明度
|
||||||
mainWindow.Opacity = 1;
|
mainWindow.Opacity = 1;
|
||||||
mainWindow.Visibility = visibility;
|
mainWindow.Visibility = visibility;
|
||||||
|
if (visibility == Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
CommonCode.SortIconList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,26 +497,19 @@ namespace GeekDesk
|
|||||||
SettingButton.ContextMenu = null;
|
SettingButton.ContextMenu = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void App_LostFocus(object sender, RoutedEventArgs e)
|
private void App_LostFocus(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS
|
||||||
|
&& this.Opacity == 1)
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
if (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE)
|
if (!appData.AppConfig.MarginHide || (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE))
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
HideApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Deactivated(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
|
||||||
{
|
|
||||||
this.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.DataContext != null)
|
if (this.DataContext != null)
|
||||||
@@ -523,9 +573,16 @@ namespace GeekDesk
|
|||||||
HideApp();
|
HideApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 为了让修改菜单的textBox失去焦点
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
EmptyTextBox.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user