diff --git a/App.config b/App.config index 11146c7..2ce48cf 100644 --- a/App.config +++ b/App.config @@ -46,6 +46,10 @@ + + + + diff --git a/App.xaml b/App.xaml index 1e6f819..4042ddb 100644 --- a/App.xaml +++ b/App.xaml @@ -13,6 +13,8 @@ + + diff --git a/Control/UserControls/PannelCard/LeftCardControl.xaml b/Control/UserControls/PannelCard/LeftCardControl.xaml index fb291ce..d78eb55 100644 --- a/Control/UserControls/PannelCard/LeftCardControl.xaml +++ b/Control/UserControls/PannelCard/LeftCardControl.xaml @@ -114,7 +114,7 @@ > - + diff --git a/Control/UserControls/PannelCard/LeftCardControl.xaml.cs b/Control/UserControls/PannelCard/LeftCardControl.xaml.cs index c09c371..0f3a227 100644 --- a/Control/UserControls/PannelCard/LeftCardControl.xaml.cs +++ b/Control/UserControls/PannelCard/LeftCardControl.xaml.cs @@ -313,7 +313,7 @@ namespace GeekDesk.Control.UserControls.PannelCard { if (IS_EDIT) return; - MainWindow.mainWindow.RightCard.WrapCard.Visibility = Visibility.Collapsed; + MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Collapsed; //设置对应菜单的图标列表 if (MenuListBox.SelectedIndex == -1) @@ -324,7 +324,7 @@ namespace GeekDesk.Control.UserControls.PannelCard { appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList; } - MainWindow.mainWindow.RightCard.WrapCard.Visibility = Visibility.Visible; + MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible; } diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml b/Control/UserControls/PannelCard/RightCardControl.xaml index 127886e..ef0637a 100644 --- a/Control/UserControls/PannelCard/RightCardControl.xaml +++ b/Control/UserControls/PannelCard/RightCardControl.xaml @@ -7,6 +7,7 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" + xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" > @@ -37,6 +38,25 @@ + + + + + + + + + @@ -53,7 +73,7 @@ - + @@ -93,12 +113,13 @@ VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True" > - - - + + + @@ -133,41 +154,42 @@ - - - - - + + + + + + - + - + @@ -194,12 +216,14 @@ VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True" > - - + + + BorderThickness="0" + Padding="0,10,0,0" + x:Name="SearchListBox" + SelectionChanged="SearchListBox_SelectionChanged" + > @@ -216,7 +240,7 @@ - @@ -231,36 +255,54 @@ + + + + + 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}, ConverterParameter=2}" + HorizontalAlignment="Left" + VerticalAlignment="Center" + 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,10,0,10" + > + 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}"/> + - + diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml.cs b/Control/UserControls/PannelCard/RightCardControl.xaml.cs index 9761c55..9d61057 100644 --- a/Control/UserControls/PannelCard/RightCardControl.xaml.cs +++ b/Control/UserControls/PannelCard/RightCardControl.xaml.cs @@ -13,6 +13,7 @@ using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Threading; @@ -723,5 +724,48 @@ namespace GeekDesk.Control.UserControls.PannelCard CardLockCM.Header = "锁定主面板"; } } + + public void SearchListBoxIndexAdd() + { + if (SearchListBox.Items.Count > 0) + { + if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1) + { + SearchListBox.SelectedIndex += 1; + } + } + } + + public void SearchListBoxIndexSub() + { + if (SearchListBox.Items.Count > 0) + { + if (SearchListBox.SelectedIndex > 0) + { + SearchListBox.SelectedIndex -= 1; + } + } + } + + public void StartupSelectionItem() + { + if (SearchListBox.SelectedItem != null) + { + IconInfo icon = SearchListBox.SelectedItem as IconInfo; + if (icon.AdminStartUp) + { + StartIconApp(icon, IconStartType.ADMIN_STARTUP); + } + else + { + StartIconApp(icon, IconStartType.DEFAULT_STARTUP); + } + } + } + + private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + SearchListBox.ScrollIntoView(SearchListBox.SelectedItem); + } } } diff --git a/Control/Windows/ConfigWindow.xaml b/Control/Windows/ConfigWindow.xaml index f3f62ef..b7318f4 100644 --- a/Control/Windows/ConfigWindow.xaml +++ b/Control/Windows/ConfigWindow.xaml @@ -4,6 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:hc="https://handyorg.github.io/handycontrol" + xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF" xmlns:local="clr-namespace:GeekDesk" Title="Setting" mc:Ignorable="d" @@ -109,14 +110,14 @@ - - + + - + diff --git a/Control/Windows/ConfigWindow.xaml.cs b/Control/Windows/ConfigWindow.xaml.cs index 8b20e93..636d6c9 100644 --- a/Control/Windows/ConfigWindow.xaml.cs +++ b/Control/Windows/ConfigWindow.xaml.cs @@ -36,6 +36,8 @@ namespace GeekDesk.Control.Windows RightCard.Content = about; this.Topmost = true; this.mainWindow = mainWindow; + UFG.Visibility = Visibility.Collapsed; + UFG.Visibility = Visibility.Visible; } diff --git a/GeekDesk.csproj b/GeekDesk.csproj index 0949584..ebee579 100644 --- a/GeekDesk.csproj +++ b/GeekDesk.csproj @@ -1,5 +1,8 @@  + + + Debug @@ -30,6 +33,8 @@ false false true + + AnyCPU @@ -113,12 +118,19 @@ packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + packages\System.Reactive.5.0.0\lib\net472\System.Reactive.dll + packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + @@ -132,6 +144,9 @@ + + packages\XamlFlair.WPF.1.2.13\lib\net472\XamlFlair.WPF.dll + @@ -245,6 +260,7 @@ + @@ -386,6 +402,11 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Always + @@ -480,4 +501,18 @@ + + + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + + + + + + + + \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml index 08f2153..74589af 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -5,6 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard" xmlns:cn="clr-namespace:GeekDesk.Constant" + xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF" mc:Ignorable="d" xmlns:cvt="clr-namespace:GeekDesk.Converts" x:Name="AppWindow" @@ -20,7 +21,7 @@ Opacity="0" Deactivated="AppWindow_Deactivated" SizeChanged="Window_SizeChanged" - KeyDown="OnKeyDown" + PreviewKeyDown="OnKeyDown" Focusable="True" MouseDown="MainWindow_MouseDown" MouseEnter="MainWindow_MouseEnter" @@ -55,7 +56,7 @@ RenderingBias="Quality" ShadowDepth="2"/> /// 显示搜索框 @@ -117,6 +121,10 @@ namespace GeekDesk { SearchIconList.IconList.Clear(); } + if (RightCard.SearchListBox.Items.Count > 0) + { + RightCard.SearchListBox.SelectedIndex = 0; + } RightCard.VerticalUFG.Visibility = Visibility.Visible; } @@ -677,16 +685,24 @@ namespace GeekDesk { HideApp(); } - //else if ( - // appData.AppConfig.SearchType == SearchType.KEY_DOWN && - // ( - // (e.Key >= Key.D0 && e.Key <= Key.Z) - // || (e.Key >= Key.NumPad0 && e.Key < Key.NumPad9) - // ) - // ) - //{ - // ShowSearchBox(); - //} + + if (RunTimeStatus.SEARCH_BOX_SHOW && (e.Key == Key.Up + || e.Key == Key.Down + || e.Key == Key.Tab + || e.Key == Key.Enter + )) + { + if (e.Key == Key.Down || e.Key == Key.Tab) + { + RightCard.SearchListBoxIndexAdd(); + } else if (e.Key == Key.Up) + { + RightCard.SearchListBoxIndexSub(); + } else if (e.Key == Key.Enter) + { + RightCard.StartupSelectionItem(); + } + } } diff --git a/Resource/Dictionary/XamlFlairSettings.xaml b/Resource/Dictionary/XamlFlairSettings.xaml new file mode 100644 index 0000000..bf7af56 --- /dev/null +++ b/Resource/Dictionary/XamlFlairSettings.xaml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/Util/BlurGlassUtil.cs b/Util/BlurGlassUtil.cs new file mode 100644 index 0000000..d2069dc --- /dev/null +++ b/Util/BlurGlassUtil.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Interop; + +namespace GeekDesk.Util +{ + public class BlurGlassUtil + { + internal enum AccentState + { + ACCENT_DISABLED = 1, + ACCENT_ENABLE_GRADIENT = 0, + ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, + ACCENT_ENABLE_BLURBEHIND = 3, + ACCENT_INVALID_STATE = 4 + } + + [StructLayout(LayoutKind.Sequential)] + internal struct AccentPolicy + { + public AccentState AccentState; + public int AccentFlags; + public int GradientColor; + public int AnimationId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct WindowCompositionAttributeData + { + public WindowCompositionAttribute Attribute; + public IntPtr Data; + public int SizeOfData; + } + + internal enum WindowCompositionAttribute + { + // ... + WCA_ACCENT_POLICY = 19 + // ... + } + + [DllImport("user32.dll")] + internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); + + + public static void EnableBlur(Window window) + { + var windowHelper = new WindowInteropHelper(window); + + var accent = new AccentPolicy(); + accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; + + var accentStructSize = Marshal.SizeOf(accent); + + var accentPtr = Marshal.AllocHGlobal(accentStructSize); + Marshal.StructureToPtr(accent, accentPtr, false); + + var data = new WindowCompositionAttributeData(); + data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY; + data.SizeOfData = accentStructSize; + data.Data = accentPtr; + + SetWindowCompositionAttribute(windowHelper.Handle, ref data); + + Marshal.FreeHGlobal(accentPtr); + } + } +} diff --git a/packages.config b/packages.config index e1764c0..f7b62a9 100644 --- a/packages.config +++ b/packages.config @@ -3,7 +3,10 @@ + + + @@ -13,5 +16,8 @@ + + + \ No newline at end of file