MainWindow.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <Window x:Class="GeekDesk.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
  7. xmlns:cn="clr-namespace:GeekDesk.Constant"
  8. xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
  9. xmlns:local="clr-namespace:GeekDesk"
  10. mc:Ignorable="d"
  11. xmlns:cvt="clr-namespace:GeekDesk.Converts"
  12. x:Name="AppWindow"
  13. xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
  14. d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
  15. Title="GeekDesk_Main_8400A17AEEF7C029"
  16. MinWidth="600"
  17. MinHeight="400"
  18. WindowStyle="None"
  19. AllowsTransparency="True"
  20. Background="Transparent"
  21. ShowInTaskbar="False"
  22. Opacity="1"
  23. Deactivated="AppWindow_Deactivated"
  24. SizeChanged="Window_SizeChanged"
  25. PreviewKeyDown="OnKeyDown"
  26. Focusable="True"
  27. MouseDown="MainWindow_MouseDown"
  28. MouseEnter="MainWindow_MouseEnter"
  29. GotFocus="Window_GotFocus"
  30. Loaded="Window_Loaded"
  31. >
  32. <Window.Resources>
  33. <RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
  34. <cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
  35. <cvt:OpcityConvert x:Key="OpcityConvert"/>
  36. <cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
  37. <cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
  38. <cvt:ReverseBoolConvert x:Key="ReverseBoolConvert"/>
  39. </Window.Resources>
  40. <WindowChrome.WindowChrome>
  41. <WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
  42. </WindowChrome.WindowChrome>
  43. <Window.InputBindings>
  44. <KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
  45. </Window.InputBindings>
  46. <Window.CommandBindings>
  47. <CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
  48. </Window.CommandBindings>
  49. <!--Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"-->
  50. <Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
  51. BorderThickness="0"
  52. Focusable="True"
  53. x:Name="BGBorder"
  54. hc:Dialog.Token="MainWindowDialog"
  55. xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=None}"
  56. xf:Animations.PrimaryBinding="{Binding AppConfig.IsShow, Mode=OneWay}"
  57. xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeOut}, Event=None}"
  58. xf:Animations.SecondaryBinding="{Binding AppConfig.IsShow, Mode=OneWay, Converter={StaticResource ReverseBoolConvert}}"
  59. xf:Animations.SecondaryCompletionCommand="{Binding HideCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
  60. xf:Animations.AllowOpacityReset="False"
  61. >
  62. <Border.Effect>
  63. <DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
  64. RenderingBias="Quality" ShadowDepth="2"/>
  65. </Border.Effect>
  66. <hc:DialogContainer Focusable="True">
  67. <Grid>
  68. <Grid.RowDefinitions>
  69. <RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
  70. <RowDefinition Height="*"></RowDefinition>
  71. </Grid.RowDefinitions>
  72. <Grid.ColumnDefinitions>
  73. <ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
  74. <ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
  75. </Grid.ColumnDefinitions>
  76. <CheckBox x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
  77. <CheckBox x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
  78. <StackPanel HorizontalAlignment="Right" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowGrowl" Grid.Column="1" Grid.Row="1"/>
  79. <StackPanel HorizontalAlignment="Center" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowAskGrowl" Grid.Column="1" Grid.Row="1"/>
  80. <DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
  81. <DockPanel.Background>
  82. <SolidColorBrush Opacity="0.01"/>
  83. </DockPanel.Background>
  84. <Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" RenderOptions.BitmapScalingMode="HighQuality" Margin="10,0,0,0" Width="200" Height="30" HorizontalAlignment="Left"/>
  85. </DockPanel>
  86. <DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
  87. <DockPanel.Background>
  88. <SolidColorBrush Opacity="0.01"/>
  89. </DockPanel.Background>
  90. <hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
  91. <Button Background="Transparent"
  92. BorderThickness="0"
  93. 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"
  94. hc:IconElement.Height="18"
  95. hc:IconElement.Width="18"
  96. HorizontalAlignment="Right"
  97. Click="ConfigButtonClick"
  98. Initialized="SettingButton_Initialized"
  99. PreviewMouseLeftButtonDown="AppButton_PreviewMouseLeftButtonDown"
  100. x:Name="SettingButton"
  101. FocusVisualStyle="{x:Null}"
  102. >
  103. <Button.ContextMenu>
  104. <ContextMenu x:Name="SettingMenus" Width="130">
  105. <MenuItem Header="设置" Click="ConfigMenuClick"/>
  106. <MenuItem Header="待办" Click="BacklogMenuClick"/>
  107. </ContextMenu>
  108. </Button.ContextMenu>
  109. </Button>
  110. <Button Background="Transparent"
  111. BorderThickness="0"
  112. 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"
  113. hc:IconElement.Height="18"
  114. hc:IconElement.Width="18"
  115. HorizontalAlignment="Right"
  116. Click="CloseButtonClick"
  117. PreviewMouseLeftButtonDown="AppButton_PreviewMouseLeftButtonDown"
  118. FocusVisualStyle="{x:Null}"
  119. />
  120. </hc:UniformSpacingPanel>
  121. </DockPanel>
  122. <uc:LeftCardControl x:Name="LeftCard" Grid.Row="1" Grid.Column="0"/>
  123. <!--分割线-->
  124. <GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
  125. <!--搜索输入框-->
  126. <TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
  127. x:Name="SearchBox"
  128. Width="0"
  129. Margin="-100,5,0,0"
  130. Height="32"
  131. FontSize="16"
  132. BorderThickness="0"
  133. TextChanged="SearchBox_TextChanged"
  134. />
  135. <hc:NotifyIcon Icon="/Logo.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
  136. Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
  137. <hc:NotifyIcon.ContextMenu>
  138. <ContextMenu Width="130" x:Name="TaskbarContextMenu">
  139. <MenuItem Header="打开面板" Click="ShowApp"/>
  140. <MenuItem Header="拾色器" Click="ColorPicker"/>
  141. <MenuItem Header="备份" Click="BakDataFile"/>
  142. <MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
  143. <MenuItem Header="待办" Click="BacklogMenuClick"/>
  144. <MenuItem Header="程序目录" Click="OpenThisDir"/>
  145. <MenuItem Header="设置" Click="ConfigApp"/>
  146. <MenuItem Header="重启" Click="ReStartApp"/>
  147. <MenuItem Header="退出" Click="ExitApp"/>
  148. </ContextMenu>
  149. </hc:NotifyIcon.ContextMenu>
  150. </hc:NotifyIcon>
  151. <uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
  152. <StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
  153. </Grid>
  154. </hc:DialogContainer>
  155. </Border>
  156. </Window>