增加搜索功能
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}"
|
||||||
@@ -88,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>
|
||||||
@@ -101,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"
|
||||||
>
|
>
|
||||||
@@ -131,4 +136,84 @@
|
|||||||
|
|
||||||
</Grid>
|
</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>
|
||||||
|
|||||||
@@ -196,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)
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
@@ -571,5 +571,17 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
Converts/SearchResWidth.cs
Normal file
25
Converts/SearchResWidth.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
class SearchResWidth : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
double menuLeftWidth = double.Parse(value.ToString());
|
||||||
|
return MainWindow.mainWindow.Width - menuLeftWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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"
|
||||||
@@ -28,12 +26,19 @@
|
|||||||
<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"
|
||||||
@@ -64,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>
|
||||||
@@ -71,11 +77,13 @@
|
|||||||
</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"/>
|
<TextBox x:Name="EmptyTextBox" Width="0"/>
|
||||||
|
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
||||||
<DockPanel.Background>
|
<DockPanel.Background>
|
||||||
<SolidColorBrush Opacity="0.01"/>
|
<SolidColorBrush Opacity="0.01"/>
|
||||||
@@ -125,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,6 +1,4 @@
|
|||||||
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;
|
||||||
@@ -8,21 +6,17 @@ using GeekDesk.Task;
|
|||||||
using GeekDesk.MyThread;
|
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,59 @@ 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>
|
||||||
@@ -533,5 +581,6 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
EmptyTextBox.Focus();
|
EmptyTextBox.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
ViewModel/Temp/SearchIconList.cs
Normal file
31
ViewModel/Temp/SearchIconList.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace GeekDesk.ViewModel.Temp
|
||||||
|
{
|
||||||
|
public class SearchIconList
|
||||||
|
{
|
||||||
|
|
||||||
|
private static ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
||||||
|
|
||||||
|
public static ObservableCollection<IconInfo> IconList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return iconList;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
iconList = value;
|
||||||
|
OnPropertyChanged("IconList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
private static void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user