Merge pull request #106 from BookerLiu/2.5.14

2.5.14
This commit is contained in:
Booker
2023-04-24 17:08:28 +08:00
committed by GitHub
83 changed files with 6005 additions and 1034 deletions

View File

@@ -33,7 +33,7 @@
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
<probing privatePath="lib;Plugins\EveryThing\lib" />
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
@@ -61,7 +61,7 @@
</assemblyBinding>
</runtime>
<appSettings>
<add key="Version" value="2.5.13" />
<add key="Version" value="2.5.14" />
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />

View File

@@ -54,7 +54,7 @@ namespace GeekDesk
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.WriteErrorLog(e, "严重异常!");
MessageBox.Show("GeekDesk遇到未知问题崩溃!");
//MessageBox.Show("GeekDesk遇到未知问题崩溃!");
}
public static void DoEvents()
{

View File

@@ -26,6 +26,8 @@ namespace GeekDesk.Constant
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
public static string UUID_FILE_BAK_PATH = APP_DIR + "bak\\uuid.txt"; //密码文件路径
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log"; //日志文件
public static string ERROR_FILE_PATH = APP_DIR + "logs\\error.log"; // 错误日志

14
Constant/MenuType.cs Normal file
View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{
public enum MenuType
{
NORMAL, //普通菜单
LINK, //关联菜单
}
}

View File

@@ -1,4 +1,6 @@
namespace GeekDesk.Constant
using System;
namespace GeekDesk.Constant
{
internal class RunTimeStatus
{
@@ -6,57 +8,83 @@
/// <summary>
/// 查询框是否在工作
/// </summary>
public static bool SEARCH_BOX_SHOW = false;
public static volatile bool SEARCH_BOX_SHOW = false;
/// <summary>
/// 查询框是否已经关闭了300毫秒 防止点击右侧区域关闭查询框时误打开列表
/// </summary>
public static volatile bool SEARCH_BOX_HIDED_300 = true;
/// <summary>
/// 贴边隐藏后 以非鼠标经过方式触发显示
/// </summary>
public static bool MARGIN_HIDE_AND_OTHER_SHOW = false;
public static volatile bool MARGIN_HIDE_AND_OTHER_SHOW = false;
/// <summary>
/// 是否锁定主面板 锁定后 不执行隐藏动作
/// </summary>
public static bool LOCK_APP_PANEL = false;
public static volatile bool LOCK_APP_PANEL = false;
/// <summary>
/// 是否弹出了菜单密码框
/// </summary>
public static bool SHOW_MENU_PASSWORDBOX = false;
public static volatile bool SHOW_MENU_PASSWORDBOX = false;
/// <summary>
/// 是否弹出了右键菜单
/// </summary>
public static bool SHOW_RIGHT_BTN_MENU = false;
public static volatile bool SHOW_RIGHT_BTN_MENU = false;
/// <summary>
/// 是否点击了面板功能按钮
/// </summary>
public static bool APP_BTN_IS_DOWN = false;
public static volatile bool APP_BTN_IS_DOWN = false;
/// <summary>
/// 是否正在编辑菜单
/// </summary>
public static bool IS_MENU_EDIT = false;
public static volatile bool IS_MENU_EDIT = false;
/// <summary>
/// 图标card 鼠标滚轮是否正在工作
/// 用来控制popup的显示 否则低性能机器会造成卡顿
/// </summary>
public static bool ICONLIST_MOUSE_WHEEL = false;
public static volatile bool ICONLIST_MOUSE_WHEEL = false;
/// <summary>
/// 控制多少毫秒后 关闭(ICONLIST_MOUSE_WHEEL)鼠标滚轮运行状态
/// </summary>
public static int MOUSE_WHEEL_WAIT_MS = 100;
public static volatile int MOUSE_WHEEL_WAIT_MS = 100;
/// <summary>
/// 与关闭popup 配合使用, 避免线程结束后不显示popup
/// </summary>
public static bool MOUSE_ENTER_ICON = false;
public static volatile bool MOUSE_ENTER_ICON = false;
/// <summary>
/// 控制每次刷新搜索结果 鼠标移动后显示popup
/// </summary>
public static int MOUSE_MOVE_COUNT = 0;
public static volatile int MOUSE_MOVE_COUNT = 0;
/// <summary>
/// everything 新的键入搜索
/// </summary>
public static volatile bool EVERYTHING_NEW_SEARCH = false;
/// <summary>
/// 键入多少毫秒后 没有新的键入开启搜索
/// </summary>
public static volatile int EVERYTHING_SEARCH_DELAY_TIME = 300;
/// <summary>
/// 控制主界面热键按下规定时间内只执行一次show hide
/// </summary>
public static volatile bool MAIN_HOT_KEY_DOWN = false;
/// <summary>
/// 控制主界面热键按下规定时间内只执行一次show hide
/// </summary>
public static volatile int MAIN_HOT_KEY_TIME = 300;
}
}

View File

@@ -10,6 +10,10 @@ namespace GeekDesk.Constant
{
LEFT_CARD = 0, //左侧托盘宽度
RIGHT_CARD = 1, //右侧托盘宽度
RIGHT_CARD_HALF = 2 //右侧托盘宽度的一半
RIGHT_CARD_HALF = 2, //右侧托盘宽度的一半
RIGHT_CARD_HALF_TEXT = 3, //右侧托盘宽度的一半 再减去左侧图像宽度
RIGHT_CARD_20 = 4, //右侧托盘宽度 - 20
RIGHT_CARD_40 = 5, //右侧托盘宽度 - 40
RIGHT_CARD_70 = 6, //右侧托盘宽度 - 70
}
}

View File

@@ -37,17 +37,17 @@
</hc:Card>
<hc:UniformSpacingPanel Spacing="20" HorizontalAlignment="Center" Margin="45.5,310,42.5,36">
<hc:TextBox x:Name="DelayTime" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
<hc:TextBox x:Name="DelayTime" Style="{StaticResource MyTextBoxStyle}" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
<ComboBox x:Name="DelayType" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0" Height="20" Width="60">
<ComboBox.Items>
<ComboBoxItem Content="分"/>
<ComboBoxItem Content="时"/>
</ComboBox.Items>
</ComboBox>
<Button Content="推迟提醒" Click="DelayButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="推迟提醒" Click="DelayButton_Click"/>
</hc:UniformSpacingPanel>
<Button Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
<Button Style="{StaticResource MyBtnStyle}" Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
</Grid>
</Border>

View File

@@ -23,7 +23,7 @@
<TextBlock Text="SVG 图标地址:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<TextBox x:Name="IconUrl" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
<TextBox x:Name="IconUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,58.276,0,-58.276">
@@ -31,18 +31,18 @@
<TextBlock Text="JSON 配置地址:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<TextBox x:Name="JsonUrl" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
<TextBox x:Name="JsonUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
</hc:UniformSpacingPanel>
<TextBlock Text="注: 需配置正确的url方可加载远程图标!" Foreground="Red" Margin="10,95,-10,-92" />
<hc:UniformSpacingPanel Spacing="10" Margin="203,125,-203,-125">
<Button Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
<Button Style="{StaticResource MyBtnStyle}" Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
/>
<Button Content="教程" Click="Teach_Click"
Style="{StaticResource Btn1}"/>
Style="{StaticResource MyBtnStyle}"/>
<Button Content="保存" Click="Confirm_Click"
Command="hc:ControlCommands.Close"
Style="{StaticResource Btn1}"/>
Style="{StaticResource MyBtnStyle}"/>
</hc:UniformSpacingPanel>
</Grid>
<!--<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>-->

View File

@@ -49,6 +49,6 @@
</hc:Card>
</StackPanel>
<Button Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
<Button Style="{StaticResource MyBtnStyle}" Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
</Grid>
</Border>

View File

@@ -63,7 +63,7 @@
</ListBox>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<Button Content="关闭" Style="{StaticResource Btn1}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
<Button Content="关闭" Style="{StaticResource MyBtnStyle}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
</hc:UniformSpacingPanel>
</Grid>
</Border>

View File

@@ -24,7 +24,7 @@
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
<TextBox x:Name="IconName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="相对路径:" Style="{StaticResource LeftTB}"/>
@@ -40,24 +40,19 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,15,0,0">
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
<Button Content="修改" Click="EditImage"/>
<Button Content="重置" Click="ReStoreImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="4,15,0,0">
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox x:Name="IconIsAdmin" Style="{StaticResource MyCheckBoxStyle}"
Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="StartArg" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
<TextBox x:Name="StartArg" Style="{StaticResource MyTextBoxStyle}" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
<Button Content="保存" Style="{StaticResource Btn1}" Click="SaveProperty" Margin="265,10,0,0"/>
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Click="SaveProperty" Margin="265,10,0,0"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>

View File

@@ -23,23 +23,23 @@
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
<TextBox x:Name="IconName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="Url:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="IconUrl" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
<TextBox x:Name="IconUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
<Button Content="修改" Click="EditImage"/>
<Button Content="重置" Click="ReStoreImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10">
<Button Content="保存" Click="SaveProperty" Style="{StaticResource Btn1}" Margin="224,-10,-224,0" />
<Button Content="保存" Click="SaveProperty" Style="{StaticResource MyBtnStyle}" Margin="224,-10,-224,0" />
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>

View File

@@ -1,4 +1,5 @@
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Reflection;
@@ -64,14 +65,15 @@ namespace GeekDesk.Control.Other
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
SolidColorBrush scb = MyColorPicker.SelectedBrush;
Color c = scb.Color;
switch (colorType)
{
case ColorType.COLOR_1:
appConfig.GradientBGParam.Color1 = scb.ToString(); break;
appConfig.GradientBGParam.Color1 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
case ColorType.COLOR_2:
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
appConfig.GradientBGParam.Color2 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
default:
appConfig.TextColor = scb.ToString(); break;
appConfig.TextColor = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
}
}

View File

@@ -64,7 +64,7 @@
</Grid>
<Grid Height="65" x:Name="HintGrid" Visibility="Collapsed" Margin="0,20,0,0" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Visibility}">
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Top" HorizontalAlignment="Center">
<hc:TextBox x:Name="HintBox" TextAlignment="Left" Width="220"/>
<hc:TextBox Style="{StaticResource MyTextBoxStyle}" x:Name="HintBox" TextAlignment="Left" Width="220"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="202,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
<TextBlock Text="跳过" MouseLeftButtonDown="NextTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>

View File

@@ -105,6 +105,7 @@ namespace GeekDesk.Control.Other
if (!string.IsNullOrEmpty(appData.AppConfig.PasswordHint))
{
//显示提示信息
HintMsg.Text = "提示: " + appData.AppConfig.PasswordHint;
HintMsg.Visibility = Visibility.Visible;
}
}
@@ -169,7 +170,11 @@ namespace GeekDesk.Control.Other
new Thread(() =>
{
Thread.Sleep(time);
try
{
Dispatcher.Invoke(() =>
{
try
{
if (string.IsNullOrEmpty(P1.Password))
{
@@ -187,7 +192,11 @@ namespace GeekDesk.Control.Other
return;
}
P4.Focus();
}
catch (Exception ex) { }
});
}
catch (Exception e2) { }
}).Start();
}

View File

@@ -0,0 +1,196 @@
<UserControl x:Class="GeekDesk.Control.Other.SearchResControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.Other"
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:cst="clr-namespace:GeekDesk.Constant"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
>
<UserControl.Resources>
<Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border>
<Border.Style>
<Style TargetType="Border">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Border.Style>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<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="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
</Style>
<Style x:Key="ImageStyleNoWrite" TargetType="Image">
<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="Source" Value="{Binding BitmapImage_NoWrite}"/>
</Style>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
</UserControl.Resources>
<Grid>
<Grid>
<WrapPanel Orientation="Horizontal"
Margin="10"
Panel.ZIndex="1"
>
<UniformGrid x:Name="VerticalUFG"
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Loaded}"
xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeOut}, Event=None}"
xf:Animations.SecondaryBinding="{Binding Visibility,
Converter={StaticResource Visibility2BooleanConverter}, ConverterParameter='reverse',
ElementName=VerticalUFG}"
>
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
<ListBox VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
ItemsSource="{Binding}"
BorderThickness="0"
Padding="0,10,0,0"
x:Name="SearchListBox"
SelectionChanged="SearchListBox_SelectionChanged"
>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<hc:ScrollViewer
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto"
IsInertiaEnabled="True"
CanContentScroll="True"
PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
ScrollChanged="VerticalCard_ScrollChanged"
>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
<ItemsPresenter/>
</Border>
</hc:ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<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="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel
Orientation="Vertical"
Background="#00FFFFFF"
VirtualizationMode="Recycling"
IsVirtualizing="True"
IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="8">
<Border.Style>
<Style TargetType="Border">
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.68"/>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<WrapPanel Tag="{Binding}"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
hc:Poptip.HitMode="None"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseEnter="SearchIcon_MouseEnter"
MouseLeave="SearchIcon_MouseLeave"
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
MouseMove="SearchIcon_MouseMove"
Margin="25,10,0,10"
>
<Image Style="{StaticResource ImageStyleNoWrite}" RenderOptions.BitmapScalingMode="HighQuality"/>
<StackPanel Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF_TEXT}}" >
<TextBlock
Margin="10,5,0,0"
MaxHeight="40"
FontSize="13"
TextTrimming="CharacterEllipsis"
TextAlignment="Left"
VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
Text="{Binding Name}"/>
<TextBlock
Margin="10,10,0,0"
MaxHeight="40"
FontSize="11"
TextTrimming="CharacterEllipsis"
TextAlignment="Left"
VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
Text="{Binding Path}"/>
</StackPanel>
</WrapPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--</hc:TransitioningContentControl>-->
</UniformGrid>
</WrapPanel>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,331 @@
using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
namespace GeekDesk.Control.Other
{
/// <summary>
/// SearchResControl.xaml 的交互逻辑
/// </summary>
public partial class SearchResControl : UserControl
{
public SearchResControl(ObservableCollection<IconInfo> iconList)
{
this.DataContext = iconList;
InitializeComponent();
}
public void SearchListBoxIndexAdd()
{
//控制移动后 鼠标即使在图标上也不显示popup
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
if (SearchListBox.Items.Count > 0)
{
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
{
SearchListBox.SelectedIndex += 1;
}
}
}
public void SearchListBoxIndexSub()
{
//控制移动后 鼠标即使在图标上也不显示popup
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
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)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
}
/// <summary>
/// 查询结果ICON鼠标移动事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseMove(object sender, MouseEventArgs e)
{
//控制首次刷新搜索结果后, 鼠标首次移动后显示popup
RunTimeStatus.MOUSE_MOVE_COUNT++;
//防止移动后不刷新popup content
IconInfo info = (sender as Panel).Tag as IconInfo;
MainWindow.mainWindow.RightCard.MyPoptipContent.Text = info.Content;
MainWindow.mainWindow.RightCard.MyPoptip.VerticalOffset = 30;
if (RunTimeStatus.MOUSE_MOVE_COUNT > 1 && !RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
}
}
/// <summary>
/// 查询结果 ICON 鼠标进入事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseEnter(object sender, MouseEventArgs e)
{
//显示popup
RunTimeStatus.MOUSE_ENTER_ICON = true;
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
new Thread(() =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
IconInfo info = (sender as Panel).Tag as IconInfo;
MainWindow.mainWindow.RightCard.MyPoptipContent.Text = info.Content;
MainWindow.mainWindow.RightCard.MyPoptip.VerticalOffset = 30;
Thread.Sleep(100);
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL && RunTimeStatus.MOUSE_MOVE_COUNT > 1)
{
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
}
}));
}).Start();
}
}
/// <summary>
/// 查询结果ICON鼠标离开事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseLeave(object sender, MouseEventArgs e)
{
RunTimeStatus.MOUSE_ENTER_ICON = false;
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
}
/// <summary>
/// 搜索结果icon 列表鼠标滚轮预处理时间
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void VerticalIconList_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
}
else
{
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
new Thread(() =>
{
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
{
Thread.Sleep(1);
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
}
if (RunTimeStatus.MOUSE_ENTER_ICON)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
}));
}
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
}).Start();
}
}
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (MainWindow.appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (!MainWindow.appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
/// <summary>
/// 图标点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IconClick(object sender, MouseButtonEventArgs e)
{
if (MainWindow.appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
{
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
else if (!MainWindow.appData.AppConfig.DoubleOpen && e.ClickCount == 1)
{
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
private static volatile bool EveryThingRuning = false;
private void VerticalCard_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (MainWindow.appData.AppConfig.EnableEveryThing == true && EveryThingUtil.HasNext())
{
HandyControl.Controls.ScrollViewer sv = sender as HandyControl.Controls.ScrollViewer;
if (sv.ExtentHeight - (sv.ActualHeight + sv.VerticalOffset) < 100
&& EveryThingUtil.HasNext()
&& !EveryThingRuning)
{
EveryThingRuning = true;
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Visible;
int everyThingCount = Convert.ToInt32(MainWindow.mainWindow.EverythingSearchCount.Text);
ObservableCollection<IconInfo> resList = this.DataContext as ObservableCollection<IconInfo>;
ThreadPool.QueueUserWorkItem(state =>
{
ObservableCollection<IconInfo> searchRes = EveryThingUtil.NextPage();
this.Dispatcher.Invoke(() =>
{
everyThingCount += searchRes.Count;
MainWindow.mainWindow.EverythingSearchCount.Text = Convert.ToString(everyThingCount);
foreach (IconInfo info in searchRes)
{
resList.Add(info);
}
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
EveryThingRuning = false;
});
});
}
}
}
/// <summary>
/// 管理员方式启动
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IconAdminStart(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
/// <summary>
/// 打开文件所在位置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ShowInExplore(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
private void SystemContextMenu(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
DirectoryInfo[] folders = new DirectoryInfo[1];
folders[0] = new DirectoryInfo(icon.Path);
ShellContextMenu scm = new ShellContextMenu();
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
p.X -= 80;
p.Y -= 80;
scm.ShowContextMenu(folders, p);
}
}
}

View File

@@ -48,10 +48,11 @@
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
<hc:Shield x:Name="PublicWeChatPanel" Subject="公众号" Visibility="Visible" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip PlacementType="Top" >
<hc:Poptip.Content>
<Image x:Name="PublicWeChat" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
@@ -79,10 +80,10 @@
<!--<hc:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
Style="{StaticResource MyRadioBtnStyle}" Content="Gitee"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>-->
</StackPanel>

View File

@@ -25,63 +25,36 @@
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
x:Name="IconIsAdmin"
Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中键呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="鼠标中键呼出"
Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="双击启动" IsChecked="{Binding DoubleOpen}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="双击启动" IsChecked="{Binding DoubleOpen}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="悬停切换菜单" IsChecked="{Binding HoverMenu}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="悬停切换菜单" IsChecked="{Binding HoverMenu}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Click="MarginHide_Changed">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="贴边隐藏" IsChecked="{Binding MarginHide}"
Click="MarginHide_Changed"/>
</hc:UniformSpacingPanel>
@@ -90,26 +63,34 @@
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}"
Content="失去焦点后"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="运行项目后"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="运行项目后"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="手动关闭"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="手动关闭"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
<TextBlock Text="搜索方式" VerticalAlignment="Center"/>
<TextBlock Text="搜索方式"
VerticalAlignment="Center"
/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="快捷键"
<RadioButton Margin="10,0,0,0"
hc:Poptip.Content="主面板显示时按下Ctrl+F开始搜索"
hc:Poptip.Placement="Top"
Style="{StaticResource MyRadioBtnStyle}" Content="快捷键"
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=0}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="按键即搜"
<RadioButton Margin="10,0,0,0"
hc:Poptip.Content="主面板显示时按下按键直接搜索"
hc:Poptip.Placement="Top"
Style="{StaticResource MyRadioBtnStyle}" Content="按键即搜"
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=1}"/>
</hc:UniformSpacingPanel>
@@ -119,6 +100,7 @@
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Style="{StaticResource MyTextBoxStyle}"
Tag="{x:Static cst:HotKeyType.Main}"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -129,20 +111,17 @@
KeyUp="HotKeyUp"
InputMethod.IsInputMethodEnabled="False"
/>
<CheckBox Content="启用"
Style="{StaticResource MyCheckBoxStyle}"
Click="EnableHotKey_Click"
Tag="{x:Static cst:HotKeyType.Main}"
IsChecked="{Binding EnableAppHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
IsChecked="{Binding EnableAppHotKey}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="待办任务:" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Style="{StaticResource MyTextBoxStyle}"
Tag="{x:Static cst:HotKeyType.ToDo}"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -153,21 +132,18 @@
KeyUp="HotKeyUp"
InputMethod.IsInputMethodEnabled="False"
/>
<CheckBox Content="启用"
Style="{StaticResource MyCheckBoxStyle}"
Click="EnableHotKey_Click"
Tag="{x:Static cst:HotKeyType.ToDo}"
IsChecked="{Binding EnableTodoHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
IsChecked="{Binding EnableTodoHotKey}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="拾色器:" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Style="{StaticResource MyTextBoxStyle}"
Tag="{x:Static cst:HotKeyType.ColorPicker}"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -179,15 +155,10 @@
InputMethod.IsInputMethodEnabled="False"
/>
<CheckBox Content="启用"
Style="{StaticResource MyCheckBoxStyle}"
Tag="{x:Static cst:HotKeyType.ColorPicker}"
Click="EnableHotKey_Click"
IsChecked="{Binding EnableColorPickerHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
IsChecked="{Binding EnableColorPickerHotKey}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</Grid>

View File

@@ -20,75 +20,71 @@
<StackPanel >
<TextBlock Text="程序设置" />
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<CheckBox Content="性能模式" IsChecked="{Binding PMModel}"
<CheckBox Content="性能模式"
Style="{StaticResource MyCheckBoxStyle}"
IsChecked="{Binding PMModel}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="开启性能模式将取消图标动画效果"
hc:Poptip.Placement="TopLeft">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
hc:Poptip.Placement="Top"
/>
</hc:UniformSpacingPanel>
<TextBlock Text="插件" Margin="0,20,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<CheckBox Content="时钟显秒" Click="ShowSeconds_Click" IsChecked="{Binding SecondsWindow}"
<CheckBox Content="时钟显秒"
Style="{StaticResource MyCheckBoxStyle}"
Click="ShowSeconds_Click" IsChecked="{Binding SecondsWindow}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="仅Win11有效"
hc:Poptip.Placement="TopLeft">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
hc:Poptip.Placement="Top"
/>
<CheckBox Content="EveryThing搜索"
Style="{StaticResource MyCheckBoxStyle}"
Click="EveryThing_Changed" IsChecked="{Binding EnableEveryThing}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="勾选后若弹出用户帐户控制请选择是"
hc:Poptip.Placement="Top"
/>
</hc:UniformSpacingPanel>
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton x:Name="CustomSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="自定义"
<RadioButton x:Name="CustomSort" Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="自定义"
Tag="1"
hc:IconElement.Geometry="{StaticResource CustomSort}"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=1}"/>
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Style="{StaticResource MyRadioBtnStyle}" Content="使用次数"
Tag="2"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=2}"/>
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Style="{StaticResource MyRadioBtnStyle}" Content="使用次数"
Tag="3"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=3}"/>
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
Tag="4"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=4}"/>
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
Tag="5"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>
@@ -96,14 +92,14 @@
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="Gitee"
hc:IconElement.Geometry="{StaticResource Gitee}"
Foreground="#B32225"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
<RadioButton Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource GitHub}"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
Foreground="Black"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -112,9 +108,9 @@
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<Button Content="备份数据"
hc:Poptip.Content="当数据文件损坏时, 以便能够恢复部分数据 (损坏时将有操作提示)"
hc:Poptip.Placement="TopLeft"
hc:Poptip.Offset="10"
Style="{StaticResource Btn1}"
hc:Poptip.Placement="Top"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
Style="{StaticResource MyBtnStyle}"
Click="BakDataFile"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -1,5 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.MyThread;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using ShowSeconds;
@@ -186,7 +187,20 @@ namespace GeekDesk.Control.UserControls.Config
catch (Exception ex) { }
}
/// <summary>
/// EveryThing插件开关
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EveryThing_Changed(object sender, RoutedEventArgs e)
{
if (MainWindow.appData.AppConfig.EnableEveryThing == true)
{
EveryThingUtil.EnableEveryThing(0);
} else
{
EveryThingUtil.DisableEveryThing(true);
}
}
}
}

View File

@@ -24,11 +24,11 @@
<TextBlock Text="背景风格" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="图 片"
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="纯 色"
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -49,18 +49,12 @@
hc:Poptip.Content="{Binding BacImgName}"
hc:Poptip.Placement="TopLeft"
/>
<Button Content="修改" Click="BGButton_Click"/>
<Button Content="默认" Click="DefaultButton_Click"/>
<Button Content="修改" Style="{StaticResource MyBtnStyle}" Click="BGButton_Click"/>
<Button Content="默认" Style="{StaticResource MyBtnStyle}" Click="DefaultButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0" Grid.ColumnSpan="4">
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:TransitioningContentControl>
@@ -82,7 +76,10 @@
Margin="0,5,0,0"
VerticalAlignment="Center"
/>
<Button Content="设置" Tag="Color1" Click="ColorButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}"
Content="设置"
Tag="Color1"
Click="ColorButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
@@ -92,10 +89,15 @@
Margin="0,5,0,0"
VerticalAlignment="Center"
/>
<Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}"
Content="设置" Tag="Color2"
Click="ColorButton_Click"
/>
</hc:UniformSpacingPanel>
<Button Content="系统预设"
Style="{StaticResource MyBtnStyle}"
Margin="0,5,0,0"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
@@ -111,41 +113,24 @@
<hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
<hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
<CheckBox Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="置于顶层" IsChecked="{Binding AlwaysTopmost}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}"/>
</hc:UniformSpacingPanel>
@@ -232,7 +217,7 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
<Button Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>
</Grid>

View File

@@ -49,7 +49,7 @@ namespace GeekDesk.Control.UserControls.Config
OpenFileDialog ofd = new OpenFileDialog
{
Multiselect = false, //只允许选中单个文件
Filter = "图像文件(*.png, *.jpg)|*.png;*.jpg;*.gif"
Filter = "图像文件(*.png, *.jpg, *.gif)|*.png;*.jpg;*.gif"
};
if (ofd.ShowDialog() == true)
{

View File

@@ -139,6 +139,7 @@
<hc:Card.ContextMenu>
<ContextMenu Width="200">
<MenuItem Header="新建菜单" Click="CreateMenu"/>
<MenuItem Header="新建关联菜单" Click="CreateLinkMenu"/>
<MenuItem x:Name="AlterPW1" Header="修改密码" Click="AlterPassword"/>
</ContextMenu>
</hc:Card.ContextMenu>
@@ -158,6 +159,7 @@
<ListBox.Resources>
<ContextMenu x:Key="MenuDialog" Width="200">
<MenuItem Header="新建菜单" Click="CreateMenu"/>
<MenuItem Header="新建关联菜单" Click="CreateLinkMenu"/>
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
<MenuItem Header="加密此列表" Click="EncryptMenu" Tag="{Binding}"/>
<MenuItem x:Name="AlterPW2" Header="修改密码" Click="AlterPassword"/>
@@ -184,7 +186,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding}">
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
<TextBox Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path=MenuName, Mode=TwoWay}"
HorizontalAlignment="Left"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
FontSize="16"
@@ -197,7 +199,11 @@
Padding="2"
BorderThickness="0"
IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding MenuEdit}"/>
Visibility="{Binding MenuEdit}">
<TextBox.Background>
<SolidColorBrush Color="White" Opacity="0.6" />
</TextBox.Background>
</TextBox>
<StackPanel Orientation="Horizontal"
IsVisibleChanged="MenuWhenVisibilityChanged"
Visibility="{Binding NotMenuEdit}">

View File

@@ -4,14 +4,19 @@ using GeekDesk.Control.Other;
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using WindowsAPICodePack.Dialogs;
namespace GeekDesk.Control.UserControls.PannelCard
{
@@ -22,13 +27,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
private int menuSelectIndexTemp = -1;
private AppData appData = MainWindow.appData;
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(255, 255, 255));
public LeftCardControl()
{
InitializeComponent();
bac.Opacity = 0.6;
this.Loaded += (s, e) =>
{
@@ -200,6 +206,77 @@ namespace GeekDesk.Control.UserControls.PannelCard
Lbi_Selected(obj, null);
}
/// <summary>
/// 创建实时文件菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CreateLinkMenu(object sender, RoutedEventArgs e)
{
try
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog
{
IsFolderPicker = true,
Title = "选择关联文件夹"
};
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
string menuId = System.Guid.NewGuid().ToString();
string path = dialog.FileName;
MenuInfo menuInfo = new MenuInfo
{
MenuName = Path.GetFileNameWithoutExtension(path),
MenuId = menuId,
MenuType = MenuType.LINK,
LinkPath = path,
IsEncrypt = false,
};
appData.MenuList.Add(menuInfo);
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
appData.AppConfig.SelectedMenuIcons = menuInfo.IconList;
//首次触发不了Selected事件
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
SetListBoxItemEvent((ListBoxItem)obj);
Lbi_Selected(obj, null);
HandyControl.Controls.Growl.Success("菜单关联成功, 加载列表中, 稍后重新进入此菜单可查看列表!", "MainWindowGrowl");
FileWatcher.LinkMenuWatcher(menuInfo);
new Thread(() =>
{
DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath);
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
foreach (FileSystemInfo fileInfo in fileInfos)
{
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
iconList.Add(iconInfo);
}
this.Dispatcher.Invoke(() =>
{
menuInfo.IconList = iconList;
//foreach (IconInfo iconInfo in iconList)
//{
// menuInfo.IconList = iconList;
//}
});
}).Start();
}
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "新建关联菜单失败!");
HandyControl.Controls.Growl.WarningGlobal("新建关联菜单失败!");
}
}
/// <summary>
/// 重命名菜单 将textbox 设置为可见
@@ -220,7 +297,26 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param>
private void DeleteMenu(object sender, RoutedEventArgs e)
{
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
if (menuInfo.IconList != null && menuInfo.IconList.Count > 0)
{
HandyControl.Controls.Growl.Ask("确认删除此菜单吗?", isConfirmed =>
{
if (isConfirmed)
{
DeleteMenu(menuInfo);
}
return true;
}, "MainWindowAskGrowl");
} else
{
DeleteMenu(menuInfo);
}
}
private void DeleteMenu(MenuInfo menuInfo)
{
if (appData.MenuList.Count == 1)
{
//如果删除以后没有菜单的话 先创建一个
@@ -628,5 +724,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
}
}

View File

@@ -8,11 +8,12 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:cst="clr-namespace:GeekDesk.Constant"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
xmlns:component="clr-namespace:GeekDesk.CustomComponent.VirtualizingWrapPanel"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
AllowDrop="True"
>
<UserControl.Resources>
<!--右侧栏样式动画-->
@@ -28,6 +29,11 @@
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
</Style>
<Style x:Key="ImageStyleNoWrite" TargetType="Image">
<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="Source" Value="{Binding BitmapImage_NoWrite}"/>
</Style>
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
@@ -148,6 +154,7 @@
<Grid>
<ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
x:Name="PDDialog"
Visibility="Collapsed"
Panel.ZIndex="99"
IsVisibleChanged="PDDialog_IsVisibleChanged"
Margin="0,-100,0,0"/>
@@ -155,9 +162,6 @@
<WrapPanel Orientation="Horizontal"
Margin="10"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
>
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
@@ -165,21 +169,26 @@
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
BorderThickness="0"
Padding="0,10,0,0"
ScrollViewer.CanContentScroll ="False"
ScrollViewer.CanContentScroll ="True"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<hc:ScrollViewer x:Name="WrapScroll"
Orientation="Vertical"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto"
IsInertiaEnabled="True"
CanContentScroll="True"
PreviewMouseWheel="IconListBox_MouseWheel"
>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
<ItemsPresenter/>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderBrush}"
>
<ItemsPresenter/>
</Border>
</hc:ScrollViewer>
</ControlTemplate>
@@ -195,10 +204,13 @@
HorizontalAlignment="Center"
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
<WrapPanel Background="#00FFFFFF"
<component:VirtualizingWrapPanel VirtualizationMode="Recycling"
IsVirtualizing="True"
IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
@@ -265,8 +277,9 @@
</hc:DialogContainer>
</hc:Card>
<hc:Card x:Name="VerticalCard"
Visibility="Hidden"
Visibility="Collapsed"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,5,5" Grid.ColumnSpan="2"
@@ -280,124 +293,16 @@
<hc:Card.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
</hc:Card.BorderBrush>
<Grid>
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
Margin="10"
>
<UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
BorderThickness="0"
Padding="0,10,0,0"
x:Name="SearchListBox"
SelectionChanged="SearchListBox_SelectionChanged"
>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<hc:ScrollViewer Orientation="Vertical"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto"
IsInertiaEnabled="True"
CanContentScroll="True"
PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
<ItemsPresenter/>
</Border>
</hc:ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<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 SearchListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Background="#00FFFFFF"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="8">
<Border.Style>
<Style TargetType="Border">
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.68"/>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<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.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
hc:Poptip.HitMode="None"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseEnter="SearchIcon_MouseEnter"
MouseLeave="SearchIcon_MouseLeave"
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
MouseMove="SearchIcon_MouseMove"
Margin="25,10,0,10"
>
<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>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--</hc:TransitioningContentControl>-->
</UniformGrid>
</WrapPanel>
</Grid>
</hc:Card>
<hc:LoadingCircle x:Name="Loading_RightCard"
Width="45" Height="45"
DotBorderBrush="White"
DotBorderThickness="2"
Foreground="DarkGray"
Opacity="0.8"
DotDiameter="10"
Margin="-50,-150,0,0"
Visibility="Collapsed"
/>
</Grid>
</UserControl>

View File

@@ -2,8 +2,10 @@
using GeekDesk.Constant;
using GeekDesk.Control.Other;
using GeekDesk.Control.Windows;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using HandyControl.Controls;
using System;
using System.Collections.ObjectModel;
@@ -124,16 +126,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param>
private void IconClick(object sender, MouseButtonEventArgs e)
{
if (!RunTimeStatus.SEARCH_BOX_HIDED_300) return;
if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
{
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
@@ -141,11 +145,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
@@ -159,7 +163,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void IconAdminStart(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
/// <summary>
@@ -170,227 +174,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void ShowInExplore(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
{
try
{
using (Process p = new Process())
{
string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{
StartSystemApp(startArg, type);
}
else
{
string path;
if (useRelativePath)
{
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
path = Path.GetFullPath(fullPath);
}
else
{
path = icon.Path;
}
p.StartInfo.FileName = path;
if (!StringUtil.IsEmpty(startArg))
{
p.StartInfo.Arguments = startArg;
}
if (icon.IconType == IconType.OTHER)
{
if (!File.Exists(path) && !Directory.Exists(path))
{
//如果没有使用相对路径 那么使用相对路径启动一次
if (!useRelativePath)
{
StartIconApp(icon, type, true);
return;
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return;
}
}
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
switch (type)
{
case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas";
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
//p.StartInfo.ErrorDialog = false;
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;// c#好像不能case穿透
case IconStartType.DEFAULT_STARTUP:
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;
case IconStartType.SHOW_IN_EXPLORE:
p.StartInfo.FileName = "Explorer.exe";
p.StartInfo.Arguments = "/e,/select," + icon.Path;
break;
}
}
else
{
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
}
p.Start();
if (useRelativePath)
{
//如果使用相对路径启动成功 那么重新设置程序绝对路径
icon.Path = path;
}
}
}
icon.Count++;
//隐藏搜索框
if (RunTimeStatus.SEARCH_BOX_SHOW)
{
MainWindow.mainWindow.HidedSearchBox();
}
}
catch (Exception e)
{
if (!useRelativePath)
{
StartIconApp(icon, type, true);
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(可能为不支持的启动方式)!");
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
}
}
}
private void StartSystemApp(string startArg, IconStartType type)
{
if (type == IconStartType.SHOW_IN_EXPLORE)
{
Growl.WarningGlobal("系统项目不支持打开文件位置操作!");
return;
}
switch (startArg)
{
case "Calculator":
Process.Start("calc.exe");
break;
case "Computer":
Process.Start("explorer.exe");
break;
case "GroupPolicy":
Process.Start("gpedit.msc");
break;
case "Notepad":
Process.Start("notepad");
break;
case "Network":
Process.Start("ncpa.cpl");
break;
case "RecycleBin":
Process.Start("shell:RecycleBinFolder");
break;
case "Registry":
Process.Start("regedit.exe");
break;
case "Mstsc":
if (type == IconStartType.ADMIN_STARTUP)
{
Process.Start("mstsc", "-admin");
}
else
{
Process.Start("mstsc");
}
break;
case "Control":
Process.Start("Control");
break;
case "CMD":
if (type == IconStartType.ADMIN_STARTUP)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
}
}
else
{
Process.Start("cmd");
}
break;
case "Services":
Process.Start("services.msc");
break;
}
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
/// <summary>
@@ -776,56 +560,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
public void SearchListBoxIndexAdd()
{
//控制移动后 鼠标即使在图标上也不显示popup
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
MyPoptip.IsOpen = false;
if (SearchListBox.Items.Count > 0)
{
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
{
SearchListBox.SelectedIndex += 1;
}
}
}
public void SearchListBoxIndexSub()
{
//控制移动后 鼠标即使在图标上也不显示popup
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
MyPoptip.IsOpen = false;
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);
}
private void PDDialog_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
@@ -850,7 +585,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <summary>
/// 菜单结果icon 列表鼠标滚轮预处理时间
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
/// 以及滚动条尾切换菜单
/// 以及滚动条尾切换菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@@ -935,105 +670,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
/// <summary>
/// 搜索结果icon 列表鼠标滚轮预处理时间
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void VerticalIconList_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
MyPoptip.IsOpen = false;
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
}
else
{
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
new Thread(() =>
{
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
{
Thread.Sleep(1);
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
}
if (RunTimeStatus.MOUSE_ENTER_ICON)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
MyPoptip.IsOpen = true;
}));
}
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
}).Start();
}
}
/// <summary>
/// 查询结果 ICON 鼠标进入事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseEnter(object sender, MouseEventArgs e)
{
//显示popup
RunTimeStatus.MOUSE_ENTER_ICON = true;
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
new Thread(() =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
IconInfo info = (sender as Panel).Tag as IconInfo;
MyPoptipContent.Text = info.Content;
MyPoptip.VerticalOffset = 30;
Thread.Sleep(100);
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL && RunTimeStatus.MOUSE_MOVE_COUNT > 1)
{
MyPoptip.IsOpen = true;
}
}));
}).Start();
}
}
/// <summary>
/// 查询结果ICON鼠标离开事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseLeave(object sender, MouseEventArgs e)
{
RunTimeStatus.MOUSE_ENTER_ICON = false;
MyPoptip.IsOpen = false;
}
/// <summary>
/// 查询结果ICON鼠标移动事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseMove(object sender, MouseEventArgs e)
{
//控制首次刷新搜索结果后, 鼠标首次移动后显示popup
RunTimeStatus.MOUSE_MOVE_COUNT++;
//防止移动后不刷新popup content
IconInfo info = (sender as Panel).Tag as IconInfo;
MyPoptipContent.Text = info.Content;
MyPoptip.VerticalOffset = 30;
if (RunTimeStatus.MOUSE_MOVE_COUNT > 1 && !RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
MyPoptip.IsOpen = true;
}
}
/// <summary>
/// menu结果ICON鼠标移动事件
/// </summary>
@@ -1046,5 +682,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
MyPoptipContent.Text = info.Content;
MyPoptip.VerticalOffset = 30;
}
}
}

View File

@@ -82,10 +82,36 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" SnapsToDevicePixels="True">
<Border.Style>
<Style TargetType="Border">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.6"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Opacity)">
<DoubleAnimation To="1" Duration="0:0:0"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Opacity)">
<DoubleAnimation To="0.6" Duration="0:0:0.5"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<SelectiveScrollingGrid>

View File

@@ -5,7 +5,7 @@
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"
xmlns:local="clr-namespace:GeekDesk" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
Title="Setting"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"

View File

@@ -1,5 +1,6 @@
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Interface;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using System.Collections.Generic;
@@ -34,7 +35,7 @@ namespace GeekDesk.Control.Windows
//BG.Source = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
this.DataContext = appConfig;
RightCard.Content = about;
this.Topmost = true;
WindowUtil.SetOwner(this, mainWindow);
this.mainWindow = mainWindow;
UFG.Visibility = Visibility.Collapsed;
UFG.Visibility = Visibility.Visible;

View File

@@ -5,7 +5,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
KeyDown="OnKeyDown"
@@ -14,8 +16,42 @@
Background="White"
Height="385"
Width="228">
<Grid>
<TextBlock Panel.ZIndex="1000" Text="❤❤❤"
x:Name="CopySuccess"
Visibility="Collapsed"
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndSlideFromBottom}, Duration=400, Event=None}"
xf:Animations.PrimaryBinding="{Binding CopyAnimation}"
Margin="138,300,0,0"
/>
<Button Height="32"
BorderThickness="0" Content="复 制"
Panel.ZIndex="999"
Margin="122,329,0,0"
HorizontalAlignment="Left"
Background="#BF8EF6"
Click="MyColorPicker_Confirmed"
VerticalAlignment="Top" Width="80"
>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MyBtnStyle}">
</Style>
</Button.Style>
</Button>
<Button Height="32"
BorderThickness="0" Content="关 闭"
Panel.ZIndex="999" Margin="26,329,0,0"
Background="#EEEEEE"
Click="MyColorPicker_Canceled"
HorizontalAlignment="Left"
VerticalAlignment="Top" Width="80"
>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MyBtnStyle}">
</Style>
</Button.Style>
</Button>
<StackPanel>
<Border MouseDown="DragMove"
VerticalAlignment="Top"
CornerRadius="8,8,0,0"
@@ -36,14 +72,12 @@
</Button>
</Border>
<hc:ColorPicker HorizontalAlignment="Center"
VerticalAlignment="Bottom"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"
x:Name="MyColorPicker"
Confirmed="MyColorPicker_Confirmed"
Canceled="MyColorPicker_Canceled"
ToggleButton.Checked="MyColorPicker_Checked"/>
</StackPanel>
</Grid>
</Border>
</Window>

View File

@@ -1,5 +1,8 @@
using GeekDesk.Interface;
using GeekDesk.Util;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
@@ -14,10 +17,33 @@ namespace GeekDesk.Control.Windows
public partial class GlobalColorPickerWindow : IWindowCommon
{
PixelColorPickerWindow colorPickerWindow = null;
class PrivateDataContext : INotifyPropertyChanged
{
private bool copyAnimation = false;
public bool CopyAnimation
{
set
{
copyAnimation = value;
OnPropertyChanged("CopyAnimation");
}
get { return copyAnimation; }
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public GlobalColorPickerWindow()
{
this.Topmost = true;
InitializeComponent();
this.DataContext = new PrivateDataContext();
}
public void OnKeyDown(object sender, KeyEventArgs e)
@@ -35,14 +61,26 @@ namespace GeekDesk.Control.Windows
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
private void MyColorPicker_Canceled(object sender, RoutedEventArgs e)
{
MyColorPickerClose();
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
private void MyColorPicker_Confirmed(object sender, RoutedEventArgs e)
{
CopySuccess.Visibility = Visibility.Visible;
PrivateDataContext pdc = this.DataContext as PrivateDataContext;
pdc.CopyAnimation = true;
new Thread(() =>
{
Thread.Sleep(400);
this.Dispatcher.Invoke(() =>
{
pdc.CopyAnimation = false;
CopySuccess.Visibility = Visibility.Collapsed;
});
}).Start();
Color c = MyColorPicker.SelectedBrush.Color;
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B));
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B));
}
/// <summary>
@@ -148,5 +186,28 @@ namespace GeekDesk.Control.Windows
{
this.Close();
}
private ICommand _hideCommand;
public ICommand HideCommand
{
get
{
if (_hideCommand == null)
{
_hideCommand = new RelayCommand(
p =>
{
return true;
},
p =>
{
//CopySuccess.Visibility = Visibility.Collapsed;
});
}
return _hideCommand;
}
}
}
}

View File

@@ -51,7 +51,7 @@
</Border.Background>-->
<hc:DialogContainer>
<Grid MouseDown="DragMove">
<TextBox x:Name="CheckSettingUrl" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
<TextBox x:Name="CheckSettingUrl" Style="{StaticResource MyTextBoxStyle}" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
<hc:TabControl x:Name="MyTabControl"
IsAnimationEnabled="True"
SelectionChanged="TabControl_SelectionChanged"
@@ -75,9 +75,9 @@
</hc:TabControl>
<Button Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5"/>
<Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Style="{StaticResource Btn1}" Margin="447,397.5,71,22.5"/>
<Button Content="确定" Click="Confirm_Click" Style="{StaticResource Btn1}" Margin="534,397.5,20,22.5" />
<Button Style="{StaticResource MyBtnStyle}" Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5" />
<Button Style="{StaticResource MyBtnStyle}" Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Margin="447,397.5,71,22.5"/>
<Button Style="{StaticResource MyBtnStyle}" Content="确定" Click="Confirm_Click" Margin="534,397.5,20,22.5" />
</Grid>
</hc:DialogContainer>
</Border>

View File

@@ -6,6 +6,7 @@
WindowStyle="None"
AllowsTransparency="True"
Background="Black"
ResizeMode="NoResize"
PreviewMouseMove="Window_PreviewMouseMove"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
MouseRightButtonDown="Window_MouseRightButtonDown"

View File

@@ -12,6 +12,7 @@
Width="510"
WindowStyle="None"
Title=""
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
@@ -44,12 +45,13 @@
<TextBlock Text="待办任务:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" />
</WrapPanel>
<TextBox x:Name="Title" Width="290" Text="{Binding Title, Mode=OneWay}" FontSize="14" />
<TextBox x:Name="Title" Style="{StaticResource MyTextBoxStyle}" Width="290" Text="{Binding Title, Mode=OneWay}" FontSize="14" />
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<TextBlock Text="待办详情:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="Msg" TextWrapping="Wrap"
Style="{StaticResource MyTextBoxStyle}"
Margin="5,0,0,0"
Text="{Binding Msg, Mode=OneWay}"
AcceptsReturn="True"
@@ -60,11 +62,11 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<TextBlock Text="运行方式:" Style="{StaticResource LeftTB}"/>
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="1" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="指定时间"
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="1"
Style="{StaticResource MyRadioBtnStyle}" Content="指定时间"
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Background="{DynamicResource SecondaryRegionBrush}" Tag="2"
Style="{StaticResource RadioButtonIcon}" Content="CRON表达式"
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="2"
Style="{StaticResource MyRadioBtnStyle}" Content="CRON表达式"
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -73,7 +75,11 @@
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0"/>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0">
<hc:DateTimePicker.Background>
<SolidColorBrush Color="White" Opacity="0.7"/>
</hc:DateTimePicker.Background>
</hc:DateTimePicker>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel x:Name="CronPanel" Height="30" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
@@ -81,7 +87,7 @@
<TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" />
</WrapPanel>
<TextBox x:Name="Cron" Width="290" Text="{Binding Cron, Mode=OneWay}" FontSize="14" />
<TextBox x:Name="Cron" Style="{StaticResource MyTextBoxStyle}" Width="290" Text="{Binding Cron, Mode=OneWay}" FontSize="14" />
</hc:UniformSpacingPanel>
@@ -95,7 +101,7 @@
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
<Button Content="保存" Style="{StaticResource Btn1}" Margin="320,6,-208,-10"
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Margin="320,6,-208,-10"
Click="Save_Button_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -10,6 +10,7 @@
Height="550"
Width="1000"
Title="Task"
ResizeMode="NoResize"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
@@ -89,7 +90,7 @@
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
<Button Content="新建待办"
Panel.ZIndex="1"
Style="{StaticResource Btn1}"
Style="{StaticResource MyBtnStyle}"
Grid.Column="1"
Margin="669,400,0,0"
Click="CreateBacklog_BtnClick" HorizontalAlignment="Left" VerticalAlignment="Top"/>

View File

@@ -2,6 +2,11 @@
using GeekDesk.Interface;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Input;
@@ -64,6 +69,14 @@ namespace GeekDesk.Control.Windows
{
case "History":
UFG.Visibility = Visibility.Collapsed;
//排序历史待办 倒序
List<ToDoInfo> list = appData.HiToDoList.OrderByDescending(v=>v.DoneTime).ToList();
appData.HiToDoList.Clear();
foreach (var item in list)
{
appData.HiToDoList.Add(item);
}
backlog.BacklogList.ItemsSource = appData.HiToDoList;
if (backlog.BacklogList.Items.Count > 0)
{

View File

@@ -10,6 +10,7 @@
WindowStyle="None"
AllowsTransparency="True"
Title=""
ResizeMode="NoResize"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown">
@@ -28,7 +29,7 @@
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
<Button HorizontalAlignment="Right" Margin="0,0,10,0"
Content="去点个Star" Click="StarBtnClick"
Style="{StaticResource Btn1}"
Style="{StaticResource MyBtnStyle}"
hc:IconElement.Geometry="M718.565517 863.126069c-7.344552 0-15.077517-2.189241-22.987034-6.285241L512 760.337655l-183.613793 96.503173c-18.785103 9.851586-37.499586 7.521103-48.16331-5.12-5.12-6.10869-10.557793-17.125517-7.485794-35.345656l35.063173-204.411586L159.249655 467.155862c-12.747034-12.393931-17.584552-27.153655-13.241379-40.430345 4.343172-13.312 16.913655-22.386759 34.568827-24.929103l205.223725-29.837242 91.806896-185.979586c7.874207-15.995586 20.409379-25.140966 34.392276-25.140965 13.947586 0 26.482759 9.145379 34.392276 25.140965l91.771586 185.979586 205.259035 29.837242c17.619862 2.577655 30.190345 11.652414 34.498206 24.964414 4.378483 13.27669-0.529655 28.001103-13.241379 40.430344l-148.51531 144.807725 35.063172 204.411586c3.10731 18.149517-2.365793 29.272276-7.485793 35.345655a32.273655 32.273655 0 0 1-25.176276 11.369931z"
/>
</hc:SimplePanel>
@@ -55,8 +56,8 @@
</hc:Card.Footer>
</hc:Card>
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Content="暂不更新" Click="Close_Click" Style="{StaticResource Btn1}"/>
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
<Button Style="{StaticResource MyBtnStyle}" Content="暂不更新" Click="Close_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="前往更新" Click="Confirm_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -26,7 +26,21 @@ namespace GeekDesk.Converts
return config.WindowWidth - config.MenuCardWidth;
} else if (WidthTypeEnum.RIGHT_CARD_HALF == type)
{
return (config.WindowWidth - config.MenuCardWidth) / 2;
return (config.WindowWidth - config.MenuCardWidth) * 0.618;
} else if (WidthTypeEnum.RIGHT_CARD_HALF_TEXT == type)
{
return (config.WindowWidth - config.MenuCardWidth) * 0.618 - config.ImageWidth - 20;
} else if (WidthTypeEnum.RIGHT_CARD_20 == type)
{
return (config.WindowWidth - config.MenuCardWidth) - 20;
}
else if (WidthTypeEnum.RIGHT_CARD_40 == type)
{
return (config.WindowWidth - config.MenuCardWidth) - 40;
}
else if (WidthTypeEnum.RIGHT_CARD_70 == type)
{
return (config.WindowWidth - config.MenuCardWidth) - 70;
}
return config.WindowWidth;

View File

@@ -9,14 +9,14 @@ namespace GeekDesk.Converts
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((Visibility)value == Visibility.Visible)
if (parameter == null)
{
return true;
}
else
return (Visibility)value == Visibility.Visible;
} else
{
return false;
return !((Visibility)value == Visibility.Visible);
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public struct ItemRange
{
public int StartIndex { get; }
public int EndIndex { get; }
public ItemRange(int startIndex, int endIndex) : this()
{
StartIndex = startIndex;
EndIndex = endIndex;
}
public bool Contains(int itemIndex)
{
return itemIndex >= StartIndex && itemIndex <= EndIndex;
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public enum ScrollDirection
{
Vertical,
Horizontal
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public enum SpacingMode
{
/// <summary>
/// Spacing is disabled and all items will be arranged as closely as possible.
/// </summary>
None,
/// <summary>
/// The remaining space is evenly distributed between the items on a layout row, as well as the start and end of each row.
/// </summary>
Uniform,
/// <summary>
/// The remaining space is evenly distributed between the items on a layout row, excluding the start and end of each row.
/// </summary>
BetweenItemsOnly,
/// <summary>
/// The remaining space is evenly distributed between start and end of each row.
/// </summary>
StartAndEndOnly
}
}

View File

@@ -0,0 +1,492 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public abstract class VirtualizingPanelBase : VirtualizingPanel, IScrollInfo
{
public static readonly DependencyProperty ScrollLineDeltaProperty = DependencyProperty.Register(nameof(ScrollLineDelta), typeof(double), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(16.0));
public static readonly DependencyProperty MouseWheelDeltaProperty = DependencyProperty.Register(nameof(MouseWheelDelta), typeof(double), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(48.0));
public static readonly DependencyProperty ScrollLineDeltaItemProperty = DependencyProperty.Register(nameof(ScrollLineDeltaItem), typeof(int), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(1));
public static readonly DependencyProperty MouseWheelDeltaItemProperty = DependencyProperty.Register(nameof(MouseWheelDeltaItem), typeof(int), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(3));
private ScrollViewer scrollOwner;
public ScrollViewer GetScrollOwner()
{
return scrollOwner;
}
public void SetScrollOwner(ScrollViewer value)
{
scrollOwner = value;
}
public bool CanVerticallyScroll { get; set; }
public bool CanHorizontallyScroll { get; set; }
protected override bool CanHierarchicallyScrollAndVirtualizeCore => true;
/// <summary>
/// Scroll line delta for pixel based scrolling. The default value is 16 dp.
/// </summary>
public double ScrollLineDelta { get => (double)GetValue(ScrollLineDeltaProperty); set => SetValue(ScrollLineDeltaProperty, value); }
/// <summary>
/// Mouse wheel delta for pixel based scrolling. The default value is 48 dp.
/// </summary>
public double MouseWheelDelta { get => (double)GetValue(MouseWheelDeltaProperty); set => SetValue(MouseWheelDeltaProperty, value); }
/// <summary>
/// Scroll line delta for item based scrolling. The default value is 1 item.
/// </summary>
public double ScrollLineDeltaItem { get => (int)GetValue(ScrollLineDeltaItemProperty); set => SetValue(ScrollLineDeltaItemProperty, value); }
/// <summary>
/// Mouse wheel delta for item based scrolling. The default value is 3 items.
/// </summary>
public int MouseWheelDeltaItem { get => (int)GetValue(MouseWheelDeltaItemProperty); set => SetValue(MouseWheelDeltaItemProperty, value); }
protected ScrollUnit ScrollUnit => GetScrollUnit(ItemsControl);
/// <summary>
/// The direction in which the panel scrolls when user turns the mouse wheel.
/// </summary>
protected ScrollDirection MouseWheelScrollDirection { get; set; } = ScrollDirection.Vertical;
protected bool IsVirtualizing => GetIsVirtualizing(ItemsControl);
protected VirtualizationMode VirtualizationMode => GetVirtualizationMode(ItemsControl);
/// <summary>
/// Returns true if the panel is in VirtualizationMode.Recycling, otherwise false.
/// </summary>
protected bool IsRecycling => VirtualizationMode == VirtualizationMode.Recycling;
/// <summary>
/// The cache length before and after the viewport.
/// </summary>
protected VirtualizationCacheLength CacheLength { get; private set; }
/// <summary>
/// The Unit of the cache length. Can be Pixel, Item or Page.
/// When the ItemsOwner is a group item it can only be pixel or item.
/// </summary>
protected VirtualizationCacheLengthUnit CacheLengthUnit { get; private set; }
/// <summary>
/// The ItemsControl (e.g. ListView).
/// </summary>
protected ItemsControl ItemsControl => ItemsControl.GetItemsOwner(this);
/// <summary>
/// The ItemsControl (e.g. ListView) or if the ItemsControl is grouping a GroupItem.
/// </summary>
protected DependencyObject ItemsOwner
{
get
{
if (ItemsOwner1 is null)
{
/* Use reflection to access internal method because the public
* GetItemsOwner method does always return the itmes control instead
* of the real items owner for example the group item when grouping */
MethodInfo getItemsOwnerInternalMethod = typeof(ItemsControl).GetMethod(
"GetItemsOwnerInternal",
BindingFlags.Static | BindingFlags.NonPublic,
null,
new Type[] { typeof(DependencyObject) },
null
);
ItemsOwner1 = (DependencyObject)getItemsOwnerInternalMethod.Invoke(null, new object[] { this });
}
return ItemsOwner1;
}
}
private DependencyObject _itemsOwner;
protected ReadOnlyCollection<object> Items => ((ItemContainerGenerator)ItemContainerGenerator).Items;
protected new IRecyclingItemContainerGenerator ItemContainerGenerator
{
get
{
if (_itemContainerGenerator is null)
{
/* Because of a bug in the framework the ItemContainerGenerator
* is null until InternalChildren accessed at least one time. */
var children = InternalChildren;
_itemContainerGenerator = (IRecyclingItemContainerGenerator)base.ItemContainerGenerator;
}
return _itemContainerGenerator;
}
}
private IRecyclingItemContainerGenerator _itemContainerGenerator;
public double ExtentWidth => Extent.Width;
public double ExtentHeight => Extent.Height;
protected Size Extent { get; private set; } = new Size(0, 0);
public double HorizontalOffset => Offset.X;
public double VerticalOffset => Offset.Y;
protected Size Viewport { get; private set; } = new Size(0, 0);
public double ViewportWidth => Viewport.Width;
public double ViewportHeight => Viewport.Height;
protected Point Offset { get; private set; } = new Point(0, 0);
/// <summary>
/// The range of items that a realized in viewport or cache.
/// </summary>
protected ItemRange ItemRange { get; set; }
public ScrollViewer ScrollOwner { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public DependencyObject ItemsOwner1 { get => _itemsOwner; set => _itemsOwner = value; }
private Visibility previousVerticalScrollBarVisibility = Visibility.Collapsed;
private Visibility previousHorizontalScrollBarVisibility = Visibility.Collapsed;
protected virtual void UpdateScrollInfo(Size availableSize, Size extent)
{
bool invalidateScrollInfo = false;
if (extent != Extent)
{
Extent = extent;
invalidateScrollInfo = true;
}
if (availableSize != Viewport)
{
Viewport = availableSize;
invalidateScrollInfo = true;
}
if (ViewportHeight != 0 && VerticalOffset != 0 && VerticalOffset + ViewportHeight + 1 >= ExtentHeight)
{
Offset = new Point(Offset.X, extent.Height - availableSize.Height);
invalidateScrollInfo = true;
}
if (ViewportWidth != 0 && HorizontalOffset != 0 && HorizontalOffset + ViewportWidth + 1 >= ExtentWidth)
{
Offset = new Point(extent.Width - availableSize.Width, Offset.Y);
invalidateScrollInfo = true;
}
if (invalidateScrollInfo)
{
GetScrollOwner()?.InvalidateScrollInfo();
}
}
public virtual Rect MakeVisible(Visual visual, Rect rectangle)
{
Point pos = visual.TransformToAncestor(this).Transform(Offset);
double scrollAmountX = 0;
double scrollAmountY = 0;
if (pos.X < Offset.X)
{
scrollAmountX = -(Offset.X - pos.X);
}
else if ((pos.X + rectangle.Width) > (Offset.X + Viewport.Width))
{
double notVisibleX = (pos.X + rectangle.Width) - (Offset.X + Viewport.Width);
double maxScrollX = pos.X - Offset.X; // keep left of the visual visible
scrollAmountX = Math.Min(notVisibleX, maxScrollX);
}
if (pos.Y < Offset.Y)
{
scrollAmountY = -(Offset.Y - pos.Y);
}
else if ((pos.Y + rectangle.Height) > (Offset.Y + Viewport.Height))
{
double notVisibleY = (pos.Y + rectangle.Height) - (Offset.Y + Viewport.Height);
double maxScrollY = pos.Y - Offset.Y; // keep top of the visual visible
scrollAmountY = Math.Min(notVisibleY, maxScrollY);
}
SetHorizontalOffset(Offset.X + scrollAmountX);
SetVerticalOffset(Offset.Y + scrollAmountY);
double visibleRectWidth = Math.Min(rectangle.Width, Viewport.Width);
double visibleRectHeight = Math.Min(rectangle.Height, Viewport.Height);
return new Rect(scrollAmountX, scrollAmountY, visibleRectWidth, visibleRectHeight);
}
protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args)
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Replace:
RemoveInternalChildRange(args.Position.Index, args.ItemUICount);
break;
case NotifyCollectionChangedAction.Move:
RemoveInternalChildRange(args.OldPosition.Index, args.ItemUICount);
break;
}
}
protected int GetItemIndexFromChildIndex(int childIndex)
{
var generatorPosition = GetGeneratorPositionFromChildIndex(childIndex);
return ItemContainerGenerator.IndexFromGeneratorPosition(generatorPosition);
}
protected virtual GeneratorPosition GetGeneratorPositionFromChildIndex(int childIndex)
{
return new GeneratorPosition(childIndex, 0);
}
protected override Size MeasureOverride(Size availableSize)
{
/* Sometimes when scrolling the scrollbar gets hidden without any reason. In this case the "IsMeasureValid"
* property of the ScrollOwner is false. To prevent a infinite circle the mesasure call is ignored. */
if (GetScrollOwner() != null)
{
bool verticalScrollBarGotHidden = GetScrollOwner().VerticalScrollBarVisibility == ScrollBarVisibility.Auto
&& GetScrollOwner().ComputedVerticalScrollBarVisibility != Visibility.Visible
&& GetScrollOwner().ComputedVerticalScrollBarVisibility != previousVerticalScrollBarVisibility;
bool horizontalScrollBarGotHidden = GetScrollOwner().HorizontalScrollBarVisibility == ScrollBarVisibility.Auto
&& GetScrollOwner().ComputedHorizontalScrollBarVisibility != Visibility.Visible
&& GetScrollOwner().ComputedHorizontalScrollBarVisibility != previousHorizontalScrollBarVisibility;
previousVerticalScrollBarVisibility = GetScrollOwner().ComputedVerticalScrollBarVisibility;
previousHorizontalScrollBarVisibility = GetScrollOwner().ComputedHorizontalScrollBarVisibility;
if (!GetScrollOwner().IsMeasureValid && verticalScrollBarGotHidden || horizontalScrollBarGotHidden)
{
return availableSize;
}
}
var groupItem = ItemsOwner as IHierarchicalVirtualizationAndScrollInfo;
Size extent;
Size desiredSize;
if (groupItem != null)
{
/* If the ItemsOwner is a group item the availableSize is ifinity.
* Therfore the vieport size provided by the group item is used. */
var viewportSize = groupItem.Constraints.Viewport.Size;
var headerSize = groupItem.HeaderDesiredSizes.PixelSize;
double availableWidth = Math.Max(viewportSize.Width - 5, 0); // left margin of 5 dp
double availableHeight = Math.Max(viewportSize.Height - headerSize.Height, 0);
availableSize = new Size(availableWidth, availableHeight);
extent = CalculateExtent(availableSize);
desiredSize = new Size(extent.Width, extent.Height);
Extent = extent;
Offset = groupItem.Constraints.Viewport.Location;
Viewport = groupItem.Constraints.Viewport.Size;
CacheLength = groupItem.Constraints.CacheLength;
CacheLengthUnit = groupItem.Constraints.CacheLengthUnit; // can be Item or Pixel
}
else
{
extent = CalculateExtent(availableSize);
double desiredWidth = Math.Min(availableSize.Width, extent.Width);
double desiredHeight = Math.Min(availableSize.Height, extent.Height);
desiredSize = new Size(desiredWidth, desiredHeight);
UpdateScrollInfo(desiredSize, extent);
CacheLength = GetCacheLength(ItemsOwner);
CacheLengthUnit = GetCacheLengthUnit(ItemsOwner); // can be Page, Item or Pixel
}
ItemRange = UpdateItemRange();
RealizeItems();
VirtualizeItems();
return desiredSize;
}
/// <summary>
/// Realizes visible and cached items.
/// </summary>
protected virtual void RealizeItems()
{
var startPosition = ItemContainerGenerator.GeneratorPositionFromIndex(ItemRange.StartIndex);
int childIndex = startPosition.Offset == 0 ? startPosition.Index : startPosition.Index + 1;
using (ItemContainerGenerator.StartAt(startPosition, GeneratorDirection.Forward, true))
{
for (int i = ItemRange.StartIndex; i <= ItemRange.EndIndex; i++, childIndex++)
{
UIElement child = (UIElement)ItemContainerGenerator.GenerateNext(out bool isNewlyRealized);
if (isNewlyRealized || /*recycled*/!InternalChildren.Contains(child))
{
if (childIndex >= InternalChildren.Count)
{
AddInternalChild(child);
}
else
{
InsertInternalChild(childIndex, child);
}
ItemContainerGenerator.PrepareItemContainer(child);
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
}
if (child is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
groupItem.Constraints = new HierarchicalVirtualizationConstraints(
new VirtualizationCacheLength(0),
VirtualizationCacheLengthUnit.Item,
new Rect(0, 0, ViewportWidth, ViewportHeight));
child.Measure(new Size(ViewportWidth, ViewportHeight));
}
}
}
}
/// <summary>
/// Virtualizes (cleanups) no longer visible or cached items.
/// </summary>
protected virtual void VirtualizeItems()
{
for (int childIndex = InternalChildren.Count - 1; childIndex >= 0; childIndex--)
{
var generatorPosition = GetGeneratorPositionFromChildIndex(childIndex);
int itemIndex = ItemContainerGenerator.IndexFromGeneratorPosition(generatorPosition);
if (itemIndex != -1 && !ItemRange.Contains(itemIndex))
{
if (VirtualizationMode == VirtualizationMode.Recycling)
{
ItemContainerGenerator.Recycle(generatorPosition, 1);
}
else
{
ItemContainerGenerator.Remove(generatorPosition, 1);
}
RemoveInternalChildRange(childIndex, 1);
}
}
}
/// <summary>
/// Calculates the extent that would be needed to show all items.
/// </summary>
protected abstract Size CalculateExtent(Size availableSize);
/// <summary>
/// Calculates the item range that is visible in the viewport or cached.
/// </summary>
protected abstract ItemRange UpdateItemRange();
public void SetVerticalOffset(double offset)
{
if (offset < 0 || Viewport.Height >= Extent.Height)
{
offset = 0;
}
else if (offset + Viewport.Height >= Extent.Height)
{
offset = Extent.Height - Viewport.Height;
}
Offset = new Point(Offset.X, offset);
GetScrollOwner()?.InvalidateScrollInfo();
InvalidateMeasure();
}
public void SetHorizontalOffset(double offset)
{
if (offset < 0 || Viewport.Width >= Extent.Width)
{
offset = 0;
}
else if (offset + Viewport.Width >= Extent.Width)
{
offset = Extent.Width - Viewport.Width;
}
Offset = new Point(offset, Offset.Y);
GetScrollOwner()?.InvalidateScrollInfo();
InvalidateMeasure();
}
protected void ScrollVertical(double amount)
{
SetVerticalOffset(VerticalOffset + amount);
}
protected void ScrollHorizontal(double amount)
{
SetHorizontalOffset(HorizontalOffset + amount);
}
public void LineUp() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? -ScrollLineDelta : GetLineUpScrollAmount());
public void LineDown() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? ScrollLineDelta : GetLineDownScrollAmount());
public void LineLeft() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? -ScrollLineDelta : GetLineLeftScrollAmount());
public void LineRight() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? ScrollLineDelta : GetLineRightScrollAmount());
public void MouseWheelUp()
{
if (MouseWheelScrollDirection == ScrollDirection.Vertical)
{
ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? -MouseWheelDelta : GetMouseWheelUpScrollAmount());
}
else
{
MouseWheelLeft();
}
}
public void MouseWheelDown()
{
if (MouseWheelScrollDirection == ScrollDirection.Vertical)
{
ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? MouseWheelDelta : GetMouseWheelDownScrollAmount());
}
else
{
MouseWheelRight();
}
}
public void MouseWheelLeft() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? -MouseWheelDelta : GetMouseWheelLeftScrollAmount());
public void MouseWheelRight() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? MouseWheelDelta : GetMouseWheelRightScrollAmount());
public void PageUp() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? -ViewportHeight : GetPageUpScrollAmount());
public void PageDown() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? ViewportHeight : GetPageDownScrollAmount());
public void PageLeft() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? -ViewportHeight : GetPageLeftScrollAmount());
public void PageRight() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? ViewportHeight : GetPageRightScrollAmount());
protected abstract double GetLineUpScrollAmount();
protected abstract double GetLineDownScrollAmount();
protected abstract double GetLineLeftScrollAmount();
protected abstract double GetLineRightScrollAmount();
protected abstract double GetMouseWheelUpScrollAmount();
protected abstract double GetMouseWheelDownScrollAmount();
protected abstract double GetMouseWheelLeftScrollAmount();
protected abstract double GetMouseWheelRightScrollAmount();
protected abstract double GetPageUpScrollAmount();
protected abstract double GetPageDownScrollAmount();
protected abstract double GetPageLeftScrollAmount();
protected abstract double GetPageRightScrollAmount();
}
}

View File

@@ -0,0 +1,474 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows;
using GeekDesk.CustomComponent.VirtualizingWrapPanel;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public class VirtualizingWrapPanel : VirtualizingPanelBase
{
#region Deprecated properties
[Obsolete("Use SpacingMode")]
public static readonly DependencyProperty IsSpacingEnabledProperty = DependencyProperty.Register(nameof(IsSpacingEnabled), typeof(bool), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsMeasure));
[Obsolete("Use IsSpacingEnabled")]
public bool SpacingEnabled { get => IsSpacingEnabled; set => IsSpacingEnabled = value; }
/// <summary>
/// Gets or sets a value that specifies whether the items are distributed evenly across the width (horizontal orientation)
/// or height (vertical orientation). The default value is true.
/// </summary>
[Obsolete("Use SpacingMode")]
public bool IsSpacingEnabled { get => (bool)GetValue(IsSpacingEnabledProperty); set => SetValue(IsSpacingEnabledProperty, value); }
[Obsolete("Use ItemSize")]
public Size ChildrenSize { get => ItemSize; set => ItemSize = value; }
#endregion
public static readonly DependencyProperty SpacingModeProperty = DependencyProperty.Register(nameof(SpacingMode), typeof(SpacingMode), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(SpacingMode.Uniform, FrameworkPropertyMetadataOptions.AffectsMeasure));
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(Orientation.Vertical, FrameworkPropertyMetadataOptions.AffectsMeasure, (obj, args) => ((VirtualizingWrapPanel)obj).Orientation_Changed()));
public static readonly DependencyProperty ItemSizeProperty = DependencyProperty.Register(nameof(ItemSize), typeof(Size), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(Size.Empty, FrameworkPropertyMetadataOptions.AffectsMeasure));
public static readonly DependencyProperty StretchItemsProperty = DependencyProperty.Register(nameof(StretchItems), typeof(bool), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsArrange));
/// <summary>
/// Gets or sets the spacing mode used when arranging the items. The default value is <see cref="SpacingMode.Uniform"/>.
/// </summary>
public SpacingMode SpacingMode { get => (SpacingMode)GetValue(SpacingModeProperty); set => SetValue(SpacingModeProperty, value); }
/// <summary>
/// Gets or sets a value that specifies the orientation in which items are arranged. The default value is <see cref="Orientation.Vertical"/>.
/// </summary>
public Orientation Orientation { get => (Orientation)GetValue(OrientationProperty); set => SetValue(OrientationProperty, value); }
/// <summary>
/// Gets or sets a value that specifies the size of the items. The default value is <see cref="Size.Empty"/>.
/// If the value is <see cref="Size.Empty"/> the size of the items gots measured by the first realized item.
/// </summary>
public Size ItemSize { get => (Size)GetValue(ItemSizeProperty); set => SetValue(ItemSizeProperty, value); }
/// <summary>
/// Gets or sets a value that specifies if the items get stretched to fill up remaining space. The default value is false.
/// </summary>
/// <remarks>
/// The MaxWidth and MaxHeight properties of the ItemContainerStyle can be used to limit the stretching.
/// In this case the use of the remaining space will be determined by the SpacingMode property.
/// </remarks>
public bool StretchItems { get => (bool)GetValue(StretchItemsProperty); set => SetValue(StretchItemsProperty, value); }
protected Size childSize;
protected int rowCount;
protected int itemsPerRowCount;
private void Orientation_Changed()
{
MouseWheelScrollDirection = Orientation == Orientation.Vertical ? ScrollDirection.Vertical : ScrollDirection.Horizontal;
}
protected override Size MeasureOverride(Size availableSize)
{
UpdateChildSize(availableSize);
return base.MeasureOverride(availableSize);
}
private void UpdateChildSize(Size availableSize)
{
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem
&& VirtualizingPanel.GetIsVirtualizingWhenGrouping(ItemsControl))
{
if (Orientation == Orientation.Vertical)
{
availableSize.Width = groupItem.Constraints.Viewport.Size.Width;
availableSize.Width = Math.Max(availableSize.Width - (Margin.Left + Margin.Right), 0);
}
else
{
availableSize.Height = groupItem.Constraints.Viewport.Size.Height;
availableSize.Height = Math.Max(availableSize.Height - (Margin.Top + Margin.Bottom), 0);
}
}
if (ItemSize != Size.Empty)
{
childSize = ItemSize;
}
else if (InternalChildren.Count != 0)
{
childSize = InternalChildren[0].DesiredSize;
}
else
{
childSize = CalculateChildSize(availableSize);
}
if (double.IsInfinity(GetWidth(availableSize)))
{
itemsPerRowCount = Items.Count;
}
else
{
itemsPerRowCount = Math.Max(1, (int)Math.Floor(GetWidth(availableSize) / GetWidth(childSize)));
}
rowCount = (int)Math.Ceiling((double)Items.Count / itemsPerRowCount);
}
private Size CalculateChildSize(Size availableSize)
{
if (Items.Count == 0)
{
return new Size(0, 0);
}
var startPosition = ItemContainerGenerator.GeneratorPositionFromIndex(0);
using (ItemContainerGenerator.StartAt(startPosition, GeneratorDirection.Forward, true))
{
var child = (UIElement)ItemContainerGenerator.GenerateNext();
AddInternalChild(child);
ItemContainerGenerator.PrepareItemContainer(child);
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
return child.DesiredSize;
}
}
protected override Size CalculateExtent(Size availableSize)
{
double extentWidth = IsSpacingEnabled && SpacingMode != SpacingMode.None && !double.IsInfinity(GetWidth(availableSize))
? GetWidth(availableSize)
: GetWidth(childSize) * itemsPerRowCount;
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
if (Orientation == Orientation.Vertical)
{
extentWidth = Math.Max(extentWidth - (Margin.Left + Margin.Right), 0);
}
else
{
extentWidth = Math.Max(extentWidth - (Margin.Top + Margin.Bottom), 0);
}
}
double extentHeight = GetHeight(childSize) * rowCount;
return CreateSize(extentWidth, extentHeight);
}
protected void CalculateSpacing(Size finalSize, out double innerSpacing, out double outerSpacing)
{
Size childSize = CalculateChildArrangeSize(finalSize);
double finalWidth = GetWidth(finalSize);
double totalItemsWidth = Math.Min(GetWidth(childSize) * itemsPerRowCount, finalWidth);
double unusedWidth = finalWidth - totalItemsWidth;
SpacingMode spacingMode = IsSpacingEnabled ? SpacingMode : SpacingMode.None;
switch (spacingMode)
{
case SpacingMode.Uniform:
innerSpacing = outerSpacing = unusedWidth / (itemsPerRowCount + 1);
break;
case SpacingMode.BetweenItemsOnly:
innerSpacing = unusedWidth / Math.Max(itemsPerRowCount - 1, 1);
outerSpacing = 0;
break;
case SpacingMode.StartAndEndOnly:
innerSpacing = 0;
outerSpacing = unusedWidth / 2;
break;
case SpacingMode.None:
default:
innerSpacing = 0;
outerSpacing = 0;
break;
}
}
protected override Size ArrangeOverride(Size finalSize)
{
double offsetX = GetX(Offset);
double offsetY = GetY(Offset);
/* When the items owner is a group item offset is handled by the parent panel. */
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
offsetY = 0;
}
Size childSize = CalculateChildArrangeSize(finalSize);
CalculateSpacing(finalSize, out double innerSpacing, out double outerSpacing);
for (int childIndex = 0; childIndex < InternalChildren.Count; childIndex++)
{
UIElement child = InternalChildren[childIndex];
int itemIndex = GetItemIndexFromChildIndex(childIndex);
int columnIndex = itemIndex % itemsPerRowCount;
int rowIndex = itemIndex / itemsPerRowCount;
double x = outerSpacing + columnIndex * (GetWidth(childSize) + innerSpacing);
double y = rowIndex * GetHeight(childSize);
if (GetHeight(finalSize) == 0.0)
{
/* When the parent panel is grouping and a cached group item is not
* in the viewport it has no valid arrangement. That means that the
* height/width is 0. Therefore the items should not be visible so
* that they are not falsely displayed. */
child.Arrange(new Rect(0, 0, 0, 0));
}
else
{
child.Arrange(CreateRect(x - offsetX, y - offsetY, childSize.Width, childSize.Height));
}
}
return finalSize;
}
protected Size CalculateChildArrangeSize(Size finalSize)
{
if (StretchItems)
{
if (Orientation == Orientation.Vertical)
{
double childMaxWidth = ReadItemContainerStyle(MaxWidthProperty, double.PositiveInfinity);
double maxPossibleChildWith = finalSize.Width / itemsPerRowCount;
double childWidth = Math.Min(maxPossibleChildWith, childMaxWidth);
return new Size(childWidth, childSize.Height);
}
else
{
double childMaxHeight = ReadItemContainerStyle(MaxHeightProperty, double.PositiveInfinity);
double maxPossibleChildHeight = finalSize.Height / itemsPerRowCount;
double childHeight = Math.Min(maxPossibleChildHeight, childMaxHeight);
return new Size(childSize.Width, childHeight);
}
}
else
{
return childSize;
}
}
private T ReadItemContainerStyle<T>(DependencyProperty property, T fallbackValue)
{
var value = ItemsControl.ItemContainerStyle?.Setters.OfType<Setter>()
.FirstOrDefault(setter => setter.Property == property)?.Value;
return (T)(value ?? fallbackValue);
}
protected override ItemRange UpdateItemRange()
{
if (!IsVirtualizing)
{
return new ItemRange(0, Items.Count - 1);
}
int startIndex;
int endIndex;
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
if (!VirtualizingPanel.GetIsVirtualizingWhenGrouping(ItemsControl))
{
return new ItemRange(0, Items.Count - 1);
}
var offset = new Point(Offset.X, groupItem.Constraints.Viewport.Location.Y);
int offsetRowIndex;
double offsetInPixel;
int rowCountInViewport;
if (ScrollUnit == ScrollUnit.Item)
{
offsetRowIndex = GetY(offset) >= 1 ? (int)GetY(offset) - 1 : 0; // ignore header
offsetInPixel = offsetRowIndex * GetHeight(childSize);
}
else
{
offsetInPixel = Math.Min(Math.Max(GetY(offset) - GetHeight(groupItem.HeaderDesiredSizes.PixelSize), 0), GetHeight(Extent));
offsetRowIndex = GetRowIndex(offsetInPixel);
}
double viewportHeight = Math.Min(GetHeight(Viewport), Math.Max(GetHeight(Extent) - offsetInPixel, 0));
rowCountInViewport = (int)Math.Ceiling((offsetInPixel + viewportHeight) / GetHeight(childSize)) - (int)Math.Floor(offsetInPixel / GetHeight(childSize));
startIndex = offsetRowIndex * itemsPerRowCount;
endIndex = Math.Min(((offsetRowIndex + rowCountInViewport) * itemsPerRowCount) - 1, Items.Count - 1);
if (CacheLengthUnit == VirtualizationCacheLengthUnit.Pixel)
{
double cacheBeforeInPixel = Math.Min(CacheLength.CacheBeforeViewport, offsetInPixel);
double cacheAfterInPixel = Math.Min(CacheLength.CacheAfterViewport, GetHeight(Extent) - viewportHeight - offsetInPixel);
int rowCountInCacheBefore = (int)(cacheBeforeInPixel / GetHeight(childSize));
int rowCountInCacheAfter = ((int)Math.Ceiling((offsetInPixel + viewportHeight + cacheAfterInPixel) / GetHeight(childSize))) - (int)Math.Ceiling((offsetInPixel + viewportHeight) / GetHeight(childSize));
startIndex = Math.Max(startIndex - rowCountInCacheBefore * itemsPerRowCount, 0);
endIndex = Math.Min(endIndex + rowCountInCacheAfter * itemsPerRowCount, Items.Count - 1);
}
else if (CacheLengthUnit == VirtualizationCacheLengthUnit.Item)
{
startIndex = Math.Max(startIndex - (int)CacheLength.CacheBeforeViewport, 0);
endIndex = Math.Min(endIndex + (int)CacheLength.CacheAfterViewport, Items.Count - 1);
}
}
else
{
double viewportSartPos = GetY(Offset);
double viewportEndPos = GetY(Offset) + GetHeight(Viewport);
if (CacheLengthUnit == VirtualizationCacheLengthUnit.Pixel)
{
viewportSartPos = Math.Max(viewportSartPos - CacheLength.CacheBeforeViewport, 0);
viewportEndPos = Math.Min(viewportEndPos + CacheLength.CacheAfterViewport, GetHeight(Extent));
}
int startRowIndex = GetRowIndex(viewportSartPos);
startIndex = startRowIndex * itemsPerRowCount;
int endRowIndex = GetRowIndex(viewportEndPos);
endIndex = Math.Min(endRowIndex * itemsPerRowCount + (itemsPerRowCount - 1), Items.Count - 1);
if (CacheLengthUnit == VirtualizationCacheLengthUnit.Page)
{
int itemsPerPage = endIndex - startIndex + 1;
startIndex = Math.Max(startIndex - (int)CacheLength.CacheBeforeViewport * itemsPerPage, 0);
endIndex = Math.Min(endIndex + (int)CacheLength.CacheAfterViewport * itemsPerPage, Items.Count - 1);
}
else if (CacheLengthUnit == VirtualizationCacheLengthUnit.Item)
{
startIndex = Math.Max(startIndex - (int)CacheLength.CacheBeforeViewport, 0);
endIndex = Math.Min(endIndex + (int)CacheLength.CacheAfterViewport, Items.Count - 1);
}
}
return new ItemRange(startIndex, endIndex);
}
private int GetRowIndex(double location)
{
int calculatedRowIndex = (int)Math.Floor(location / GetHeight(childSize));
int maxRowIndex = (int)Math.Ceiling((double)Items.Count / (double)itemsPerRowCount);
return Math.Max(Math.Min(calculatedRowIndex, maxRowIndex), 0);
}
protected override void BringIndexIntoView(int index)
{
if (index < 0 || index >= Items.Count)
{
throw new ArgumentOutOfRangeException(nameof(index), $"The argument {nameof(index)} must be >= 0 and < the number of items.");
}
if (itemsPerRowCount == 0)
{
throw new InvalidOperationException();
}
var offset = (index / itemsPerRowCount) * GetHeight(childSize);
if (Orientation == Orientation.Horizontal)
{
SetHorizontalOffset(offset);
}
else
{
SetVerticalOffset(offset);
}
}
protected override double GetLineUpScrollAmount()
{
return -Math.Min(childSize.Height * ScrollLineDeltaItem, Viewport.Height);
}
protected override double GetLineDownScrollAmount()
{
return Math.Min(childSize.Height * ScrollLineDeltaItem, Viewport.Height);
}
protected override double GetLineLeftScrollAmount()
{
return -Math.Min(childSize.Width * ScrollLineDeltaItem, Viewport.Width);
}
protected override double GetLineRightScrollAmount()
{
return Math.Min(childSize.Width * ScrollLineDeltaItem, Viewport.Width);
}
protected override double GetMouseWheelUpScrollAmount()
{
return -Math.Min(childSize.Height * MouseWheelDeltaItem, Viewport.Height);
}
protected override double GetMouseWheelDownScrollAmount()
{
return Math.Min(childSize.Height * MouseWheelDeltaItem, Viewport.Height);
}
protected override double GetMouseWheelLeftScrollAmount()
{
return -Math.Min(childSize.Width * MouseWheelDeltaItem, Viewport.Width);
}
protected override double GetMouseWheelRightScrollAmount()
{
return Math.Min(childSize.Width * MouseWheelDeltaItem, Viewport.Width);
}
protected override double GetPageUpScrollAmount()
{
return -Viewport.Height;
}
protected override double GetPageDownScrollAmount()
{
return Viewport.Height;
}
protected override double GetPageLeftScrollAmount()
{
return -Viewport.Width;
}
protected override double GetPageRightScrollAmount()
{
return Viewport.Width;
}
/* orientation aware helper methods */
protected double GetX(Point point) => Orientation == Orientation.Vertical ? point.X : point.Y;
protected double GetY(Point point) => Orientation == Orientation.Vertical ? point.Y : point.X;
protected double GetWidth(Size size) => Orientation == Orientation.Vertical ? size.Width : size.Height;
protected double GetHeight(Size size) => Orientation == Orientation.Vertical ? size.Height : size.Width;
protected Size CreateSize(double width, double height) => Orientation == Orientation.Vertical ? new Size(width, height) : new Size(height, width);
protected Rect CreateRect(double x, double y, double width, double height) => Orientation == Orientation.Vertical ? new Rect(x, y, width, height) : new Rect(y, x, width, height);
}
}

View File

@@ -108,6 +108,7 @@
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
@@ -131,6 +132,7 @@
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
@@ -147,6 +149,9 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsAPICodePack.Shell.CommonFileDialogs, Version=1.1.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\WindowsAPICodePack.Shell.CommonFileDialogs.1.1.5\lib\net452\WindowsAPICodePack.Shell.CommonFileDialogs.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@@ -167,6 +172,7 @@
<Compile Include="Constant\IconType.cs" />
<Compile Include="Constant\CommonEnum.cs" />
<Compile Include="Constant\IconStartType.cs" />
<Compile Include="Constant\MenuType.cs" />
<Compile Include="Constant\PasswordType.cs" />
<Compile Include="Constant\RunTimeStatus.cs" />
<Compile Include="Constant\SearchType.cs" />
@@ -196,6 +202,9 @@
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Other\SearchResControl.xaml.cs">
<DependentUpon>SearchResControl.xaml</DependentUpon>
</Compile>
<Compile Include="Control\UserControls\Config\OtherControl.xaml.cs">
<DependentUpon>OtherControl.xaml</DependentUpon>
</Compile>
@@ -266,11 +275,15 @@
<Compile Include="Converts\UpdateTypeConvert.cs" />
<Compile Include="Converts\ReverseBoolConvert.cs" />
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Interface\IWindowCommon.cs" />
<Compile Include="MyThread\RelativePathThread.cs" />
<Compile Include="Plugins\EveryThing\Constant\EveryThingConst.cs" />
<Compile Include="Plugins\EveryThing\EveryThing32.cs" />
<Compile Include="Plugins\EveryThing\EveryThing64.cs" />
<Compile Include="Plugins\EveryThing\EveryThingUtil.cs" />
<Compile Include="Plugins\ShowSeconds\Common\Constants.cs" />
<Compile Include="Plugins\ShowSeconds\SecondsWindow.xaml.cs">
<DependentUpon>SecondsWindow.xaml</DependentUpon>
@@ -287,10 +300,12 @@
<Compile Include="Util\ColorUtil.cs" />
<Compile Include="Util\DefaultIcons.cs" />
<Compile Include="Util\DragAdorner.cs" />
<Compile Include="Util\FileWatcher.cs" />
<Compile Include="Util\GlobalHotKey.cs" />
<Compile Include="Util\CommonCode.cs" />
<Compile Include="Util\FileIcon.cs" />
<Compile Include="Util\FileUtil.cs" />
<Compile Include="ViewModel\Temp\GuideInfoList.cs" />
<Compile Include="Util\HideWindowUtil.cs" />
<Compile Include="Util\IconHelper.cs" />
<Compile Include="Util\IconUtil.cs" />
@@ -306,6 +321,7 @@
<Compile Include="Util\MouseHook.cs" />
<Compile Include="Util\MouseUtil.cs" />
<Compile Include="Util\NativeMethods.cs" />
<Compile Include="Util\ProcessUtil.cs" />
<Compile Include="Util\RegisterUtil.cs" />
<Compile Include="Util\RelayCommand.cs" />
<Compile Include="Util\ScreenUtil.cs" />
@@ -315,7 +331,13 @@
<Compile Include="Util\StringUtil.cs" />
<Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="Util\UserActivityHook.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\ItemRange.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\SpacingMode.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\VirtualizingPanelBase.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\VirtualizingWrapPanel.cs" />
<Compile Include="Util\WindowsThumbnailProvider.cs" />
<Compile Include="Util\WindowUtil.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\ScrollDirection.cs" />
<Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\GradientBGParam.cs" />
@@ -354,6 +376,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\Other\SearchResControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\UserControls\Config\OtherControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -476,6 +502,18 @@
</EmbeddedResource>
<Resource Include="Resource\Iconfont\iconfont.json" />
<None Include="app.manifest" />
<None Include="Plugins\EveryThing\32\Everything.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\32\Everything.lng">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\64\Everything.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\64\Everything.lng">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Properties\app.manifest" />
<None Include="Update.json" />
<None Include="packages.config" />
@@ -547,6 +585,26 @@
<ItemGroup>
<Resource Include="Logo.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Plugins\EveryThing\lib\Everything32.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\lib\Everything64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<Content Include="Plugins\EveryThing\32\Everything.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Plugins\EveryThing\64\Everything.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
@@ -573,7 +631,8 @@
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>; Move all assemblies and related files to lib folder
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " /XF Data *.exe *.config *.manifest /XD lib logs bak /E /IS /MOVE
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " /XF Data *.exe *.config *.manifest /XD "$(TargetDir)lib" plugins logs bak /E /IS /MOVE
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " *.dll /XD "$(TargetDir)lib" /E /S /MOVE
if %25errorlevel%25 leq 4 exit 0 else exit %25errorlevel%25</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -11,6 +11,7 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
x:Name="AppWindow"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
xmlns:my="clr-namespace:GeekDesk.Util"
d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
Title="GeekDesk_Main_8400A17AEEF7C029"
MinWidth="600"
@@ -28,11 +29,12 @@
MouseEnter="MainWindow_MouseEnter"
GotFocus="Window_GotFocus"
Loaded="Window_Loaded"
SourceInitialized="Window_SourceInitialized"
Topmost="{Binding AppConfig.AlwaysTopmost}"
>
<Window.Resources>
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
@@ -41,7 +43,7 @@
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="23"/>
</WindowChrome.WindowChrome>
<Window.InputBindings>
@@ -52,10 +54,95 @@
</Window.CommandBindings>
<!--Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"-->
<Grid>
<!--遮罩层border 用于引导提示-->
<Border Margin="20"
Visibility="Collapsed"
MouseDown="DragMove"
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=OneWay, Converter={StaticResource IntToCornerRadius}}"
BorderThickness="0"
x:Name="GrayBorder"
Panel.ZIndex="888"
>
<Border.Background>
<SolidColorBrush Color="Gray" Opacity="0.9"/>
</Border.Background>
<!--<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top" IsOpen="False" HitMode="None">
<hc:Poptip.ContentTemplate>
<DataTemplate>
<Border Background="White" Width="300" Height="150">
<TextBlock Text="这是一个测测试"/>
</Border>
</DataTemplate>
</hc:Poptip.ContentTemplate>
</hc:Poptip>
</hc:Poptip.Instance>-->
</Border>
<hc:Card x:Name="GuideCard" Width="300" Height="180" Panel.ZIndex="888"
VerticalAlignment="Top"
HorizontalAlignment="Left" Visibility="Collapsed">
<hc:Card.Background>
<SolidColorBrush Color="White" Opacity="0.85"/>
</hc:Card.Background>
<!--Card 的内容部分-->
<Border CornerRadius="4,4,0,0" Width="300" Height="100">
<TextBlock TextWrapping="Wrap"
x:Name="GuideText"
VerticalAlignment="Center"
HorizontalAlignment="Center"
LineHeight="22"
FontSize="14"
Text=""/>
</Border>
<!--Card 的尾部部分-->
<hc:Card.Footer>
<Grid>
<StackPanel Margin="10" Width="150" Height="50" HorizontalAlignment="Left">
<!--Card 的一级内容-->
<WrapPanel>
<TextBlock TextWrapping="Wrap"
x:Name="GuideTitle1"
Style="{DynamicResource TextBlockLargeBold}"
TextTrimming="CharacterEllipsis"
Text="引导提示"
FontSize="20"
HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap"
x:Name="GuideNum"
Style="{DynamicResource TextBlockLargeBold}"
TextTrimming="CharacterEllipsis"
Text="1"
FontSize="20"
HorizontalAlignment="Left"/>
</WrapPanel>
<!--Card 的二级内容-->
<TextBlock TextWrapping="NoWrap"
x:Name="GuideTitle2"
Style="{DynamicResource TextBlockDefault}"
TextTrimming="CharacterEllipsis"
Text="快捷方式创建"
Margin="0,6,0,0"
FontSize="14"
HorizontalAlignment="Left"/>
</StackPanel>
<hc:UniformSpacingPanel HorizontalAlignment="Right">
<Button Style="{StaticResource MyBtnStyle}" x:Name="PreviewGuideBtn" Click="PreviewGuideBtn_Click" Margin="0,0,20,0" Content="上一步"/>
<Button Style="{StaticResource MyBtnStyle}" x:Name="NextGuideBtn" Click="NextGuideBtn_Click" Margin="0,0,20,0" Content="下一步"/>
</hc:UniformSpacingPanel>
</Grid>
</hc:Card.Footer>
</hc:Card>
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
BorderThickness="0"
Focusable="True"
Panel.ZIndex="1"
x:Name="BGBorder"
Background="AliceBlue"
hc:Dialog.Token="MainWindowDialog"
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=None}"
xf:Animations.PrimaryBinding="{Binding AppConfig.IsShow, Mode=OneWay}"
@@ -70,32 +157,45 @@
</Border.Effect>
<hc:DialogContainer Focusable="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
<RowDefinition Height="40" MouseDown="DragMove"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<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="280"></ColumnDefinition>
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
<StackPanel HorizontalAlignment="Right" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowGrowl" Grid.Column="1" Grid.Row="1"/>
<StackPanel HorizontalAlignment="Center" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowAskGrowl" Grid.Column="1" Grid.Row="1"/>
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
<DockPanel Grid.Row="0" Grid.Column="0" MouseDown="DragMove">
<DockPanel.Background>
<SolidColorBrush Opacity="0.01"/>
</DockPanel.Background>
<Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" RenderOptions.BitmapScalingMode="HighQuality" Margin="10,0,0,0" Width="200" Height="30" HorizontalAlignment="Left"/>
<Image Visibility="{Binding AppConfig.TitleLogoVisible}"
Source="/Resource/Image/TitleLogo.png"
RenderOptions.BitmapScalingMode="HighQuality"
Margin="10,0,0,0"
Width="200"
Height="30"
Opacity="0.8"
HorizontalAlignment="Left"/>
</DockPanel>
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
<DockPanel Grid.Row="0" Grid.Column="2" MouseDown="DragMove">
<DockPanel.Background>
<SolidColorBrush Opacity="0.01"/>
</DockPanel.Background>
<hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
<hc:UniformSpacingPanel x:Name="MainBtnPanel" 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"
@@ -112,6 +212,7 @@
<ContextMenu x:Name="SettingMenus" Width="130">
<MenuItem Header="设置" Click="ConfigMenuClick"/>
<MenuItem Header="待办" Click="BacklogMenuClick"/>
<MenuItem Header="新手引导" Click="Guide_Click"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
@@ -132,7 +233,36 @@
<uc:LeftCardControl x:Name="LeftCard" Grid.Row="1" Grid.Column="0"/>
<!--分割线-->
<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="5" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
<Border x:Name="SearchResContainer" Panel.ZIndex="2"
Visibility="Collapsed"
Grid.Row="1" Grid.Column="1"
HorizontalAlignment="Right" MaxWidth="200"
VerticalAlignment="Top"
CornerRadius="8"
Margin="0,20,40,0"
>
<Border.Style>
<Style TargetType="Border" >
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.6"/>
</Setter.Value>
</Setter>
<Setter Property="MaxWidth" Value="300"/>
</Style>
</Border.Style>
<WrapPanel Margin="8">
<TextBlock Opacity="0.6" Text="g:"/>
<TextBlock x:Name="GeekDeskSearchTotal" Opacity="0.6" Text="0"/>
<TextBlock Opacity="0.6" Text="+"/>
<TextBlock Opacity="0.6" Text="e:"/>
<TextBlock x:Name="EverythingSearchCount" Opacity="0.6" Text="0"/>
<TextBlock Opacity="0.6" Text=" of "/>
<TextBlock x:Name="EverythingSearchTotal" Opacity="0.6" Text="0"/>
</WrapPanel>
</Border>
<!--搜索输入框-->
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
@@ -143,7 +273,12 @@
FontSize="16"
BorderThickness="0"
TextChanged="SearchBox_TextChanged"
/>
Style="{StaticResource MyTextBoxStyle}"
>
<TextBox.Background>
<SolidColorBrush Color="White" Opacity="0.5" />
</TextBox.Background>
</TextBox>
<hc:NotifyIcon Icon="/Logo.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
@@ -165,9 +300,12 @@
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
</Grid>
</hc:DialogContainer>
</Border>
</Grid>
</Window>

View File

@@ -1,9 +1,12 @@
using GeekDesk.Constant;
using GeekDesk.Control.Other;
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.UserControls.PannelCard;
using GeekDesk.Control.Windows;
using GeekDesk.Interface;
using GeekDesk.MyThread;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Plugins.EveryThing.Constant;
using GeekDesk.Task;
using GeekDesk.Util;
using GeekDesk.ViewModel;
@@ -14,12 +17,20 @@ using ShowSeconds;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Shell;
using System.Windows.Threading;
using static GeekDesk.Util.ShowWindowFollowMouse;
@@ -32,14 +43,19 @@ namespace GeekDesk
public partial class MainWindow : Window, IWindowCommon
{
public static AppData appData = CommonCode.GetAppDataByFile();
public static AppData appData;
public static ToDoInfoWindow toDoInfoWindow;
public static int hotKeyId = -1;
public static int toDoHotKeyId = -1;
public static int colorPickerHotKeyId = -1;
public static MainWindow mainWindow;
private static bool dataFileExist = true;
public MainWindow()
{
//加载数据
LoadData();
InitializeComponent();
@@ -47,9 +63,6 @@ namespace GeekDesk
//用于其他类访问
mainWindow = this;
//置于顶层
this.Topmost = true;
//执行待办提醒
ToDoTask.BackLogCheck();
@@ -62,6 +75,15 @@ namespace GeekDesk
}
private void Window_SourceInitialized(object sender, EventArgs e)
{
try
{
//禁用窗口最大化
WindowUtil.DisableMaxWindow(this);
}
catch (Exception) { }
}
@@ -72,9 +94,12 @@ namespace GeekDesk
/// <param name="e"></param>
private void SearchHotKeyDown(object sender, CanExecuteRoutedEventArgs e)
{
if (appData.AppConfig.SearchType == SearchType.HOT_KEY)
if (appData.AppConfig.SearchType == SearchType.HOT_KEY && !RunTimeStatus.SEARCH_BOX_SHOW)
{
ShowSearchBox();
} else if (RunTimeStatus.SEARCH_BOX_SHOW)
{
HidedSearchBox();
}
}
@@ -87,6 +112,9 @@ namespace GeekDesk
RightCard.VisibilitySearchCard(Visibility.Visible);
SearchBox.Width = 400;
SearchBox.Focus();
//执行一遍a查询
//SearchBox_TextChanged(null, null);
}
/// <summary>
/// 搜索开始
@@ -113,33 +141,113 @@ namespace GeekDesk
RightCard.MyPoptip.IsOpen = false;
string inputText = SearchBox.Text.ToLower();
RightCard.VerticalUFG.Visibility = Visibility.Collapsed;
if (!string.IsNullOrEmpty(inputText))
{
SearchIconList.IconList.Clear();
RunTimeStatus.EVERYTHING_SEARCH_DELAY_TIME = 300;
if (!RunTimeStatus.EVERYTHING_NEW_SEARCH)
{
RunTimeStatus.EVERYTHING_NEW_SEARCH = true;
//显示搜索结果列表
RightCard.VisibilitySearchCard(Visibility.Visible);
//暂时隐藏条目信息
SearchResContainer.Visibility = Visibility.Collapsed;
//显示加载条
RightCard.Loading_RightCard.Visibility = Visibility.Visible;
object obj = RightCard.VerticalCard.Content;
if (obj != null)
{
SearchResControl control = obj as SearchResControl;
control.VerticalUFG.Visibility = Visibility.Collapsed;
}
SearchDelay();
}
} else
{
//隐藏条目信息
SearchResContainer.Visibility = Visibility.Collapsed;
//清空查询结果
object obj = RightCard.VerticalCard.Content;
if (obj != null)
{
SearchResControl control = obj as SearchResControl;
control.VerticalUFG.Visibility = Visibility.Collapsed;
}
}
}
private void SearchDelay()
{
new Thread(() =>
{
while (RunTimeStatus.EVERYTHING_SEARCH_DELAY_TIME > 0)
{
Thread.Sleep(10);
RunTimeStatus.EVERYTHING_SEARCH_DELAY_TIME -= 10;
}
RunTimeStatus.EVERYTHING_NEW_SEARCH = false;
this.Dispatcher.Invoke(() =>
{
string inputText = SearchBox.Text.ToLower().Trim();
if (string.IsNullOrEmpty(inputText))
{
RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
return;
}
new Thread(() =>
{
ObservableCollection<IconInfo> resList = new ObservableCollection<IconInfo>();
if (appData.AppConfig.EnableEveryThing == true)
{
ObservableCollection<IconInfo> iconBakList = EveryThingUtil.Search(inputText);
foreach (IconInfo icon in iconBakList)
{
resList.Add(icon);
}
}
int geekDeskCount = 0;
//GeekDesk数据搜索
ObservableCollection<MenuInfo> menuList = appData.MenuList;
foreach (MenuInfo menu in menuList)
{
ObservableCollection<IconInfo> iconList = menu.IconList;
foreach (IconInfo icon in iconList)
{
if (RunTimeStatus.EVERYTHING_NEW_SEARCH) return;
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
if (icon.Name.Contains(inputText) || pyName.Contains(inputText))
{
SearchIconList.IconList.Add(icon);
geekDeskCount++;
resList.Add(icon);
}
}
}
}
else
this.Dispatcher.Invoke(() =>
{
SearchIconList.IconList.Clear();
}
if (RightCard.SearchListBox.Items.Count > 0)
if (appData.AppConfig.EnableEveryThing == true)
{
RightCard.SearchListBox.SelectedIndex = 0;
int everythingTotal = Convert.ToInt32(EveryThingUtil.Everything_GetNumResults());
GeekDeskSearchTotal.Text = Convert.ToString(geekDeskCount);
EverythingSearchCount.Text = Convert.ToString(resList.Count - geekDeskCount);
EverythingSearchTotal.Text = Convert.ToString(everythingTotal + geekDeskCount);
SearchResContainer.Visibility = Visibility.Visible;
}
RightCard.VerticalUFG.Visibility = Visibility.Visible;
SearchResControl control = new SearchResControl(resList);
RightCard.VerticalCard.Content = control;
//关闭加载效果
RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
});
}).Start();
});
}).Start();
}
/// <summary>
@@ -147,15 +255,33 @@ namespace GeekDesk
/// </summary>
public void HidedSearchBox()
{
RunTimeStatus.EVERYTHING_NEW_SEARCH = true;
RunTimeStatus.SEARCH_BOX_HIDED_300 = false;
new Thread(() =>
{
Thread.Sleep(300);
RunTimeStatus.SEARCH_BOX_HIDED_300 = true;
}).Start();
new Thread(() =>
{
Thread.Sleep(1000);
RunTimeStatus.EVERYTHING_NEW_SEARCH = false;
}).Start();
new Thread(() =>
{
this.Dispatcher.Invoke(() =>
{
Keyboard.Focus(SearchBox);
RunTimeStatus.SEARCH_BOX_SHOW = false;
SearchBox.TextChanged -= SearchBox_TextChanged;
SearchBox.Clear();
SearchBox.TextChanged += SearchBox_TextChanged;
SearchBox.Width = 0;
SearchIconList.IconList.Clear();
SearchResContainer.Visibility = Visibility.Collapsed;
RightCard.VerticalCard.Content = null;
RightCard.VisibilitySearchCard(Visibility.Collapsed);
Keyboard.Focus(SearchBox);
App.DoEvents();
});
}).Start();
}
@@ -164,6 +290,11 @@ namespace GeekDesk
/// </summary>
private void LoadData()
{
//判断数据文件是否存在 如果不存在那么是第一次打开程序
dataFileExist = File.Exists(Constants.DATA_FILE_PATH);
appData = CommonCode.GetAppDataByFile();
this.DataContext = appData;
if (appData.MenuList.Count == 0)
{
@@ -226,6 +357,9 @@ namespace GeekDesk
SecondsWindow.ShowWindow();
}
//监听实时文件夹菜单
FileWatcher.EnableLinkMenuWatcher(appData);
//更新线程开启 检测更新
UpdateThread.Update();
@@ -236,9 +370,28 @@ namespace GeekDesk
//毛玻璃 暂时未解决阴影问题
//BlurGlassUtil.EnableBlur(this);
MessageUtil.ChangeWindowMessageFilter(MessageUtil.WM_COPYDATA, 1);
//设置归属桌面 解决桌面覆盖程序界面的bug
WindowUtil.SetOwner(this, WindowUtil.GetDesktopHandle(this, DesktopLayer.Progman));
if (appData.AppConfig.EnableEveryThing == true)
{
//开启EveryThing插件
EveryThingUtil.EnableEveryThing();
}
Keyboard.Focus(SearchBox);
MessageUtil.ChangeWindowMessageFilter(MessageUtil.WM_COPYDATA, 1);
if (!dataFileExist)
{
Guide();
}
}
/// <summary>
/// 注册当前窗口的热键
/// </summary>
@@ -250,9 +403,17 @@ namespace GeekDesk
{
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
{
if (RunTimeStatus.MAIN_HOT_KEY_DOWN) return;
RunTimeStatus.MAIN_HOT_KEY_DOWN = true;
new Thread(() =>
{
Thread.Sleep(RunTimeStatus.MAIN_HOT_KEY_TIME);
RunTimeStatus.MAIN_HOT_KEY_DOWN = false;
}).Start();
if (MotionControl.hotkeyFinished)
{
if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0 || MarginHide.IS_HIDE)
if (CheckShouldShowApp())
{
ShowApp();
}
@@ -371,28 +532,9 @@ namespace GeekDesk
/// <param name="e"></param>
private void DragMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
var windowMode = this.ResizeMode;
if (this.ResizeMode != ResizeMode.NoResize)
{
this.ResizeMode = ResizeMode.NoResize;
}
this.UpdateLayout();
/* 当点击拖拽区域的时候,让窗口跟着移动
(When clicking the drag area, make the window follow) */
DragMove();
if (this.ResizeMode != windowMode)
{
this.ResizeMode = windowMode;
}
this.UpdateLayout();
}
}
@@ -456,6 +598,7 @@ namespace GeekDesk
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
}
MainWindow.mainWindow.Activate();
mainWindow.Show();
//mainWindow.Visibility = Visibility.Visible;
@@ -574,7 +717,7 @@ namespace GeekDesk
/// <param name="e"></param>
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
{
if (this.Visibility == Visibility.Collapsed || this.Opacity == 0)
if (CheckShouldShowApp())
{
ShowApp();
}
@@ -584,6 +727,14 @@ namespace GeekDesk
}
}
private static bool CheckShouldShowApp()
{
return mainWindow.Visibility == Visibility.Collapsed
|| mainWindow.Opacity == 0
|| MarginHide.IS_HIDE
|| !WindowUtil.WindowIsTop(mainWindow);
}
/// <summary>
/// 右键任务栏图标 设置
/// </summary>
@@ -672,6 +823,10 @@ namespace GeekDesk
appData.AppConfig.WindowWidth = this.Width;
appData.AppConfig.WindowHeight = this.Height;
}
if (guideRun)
{
Guide();
}
}
@@ -687,6 +842,10 @@ namespace GeekDesk
{
MouseHookThread.Dispose();
}
if (appData.AppConfig.EnableEveryThing == true)
{
EveryThingUtil.DisableEveryThing();
}
Application.Current.Shutdown();
}
/// <summary>
@@ -737,15 +896,18 @@ namespace GeekDesk
{
if (e.Key == Key.Down || e.Key == Key.Tab)
{
RightCard.SearchListBoxIndexAdd();
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.SearchListBoxIndexAdd();
}
else if (e.Key == Key.Up)
{
RightCard.SearchListBoxIndexSub();
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.SearchListBoxIndexSub();
}
else if (e.Key == Key.Enter)
{
RightCard.StartupSelectionItem();
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.StartupSelectionItem();
}
}
}
@@ -884,7 +1046,123 @@ namespace GeekDesk
return hwnd;
}
#region
private int guideIndex = 0;
private bool guideRun = false;
private void Guide()
{
try
{
guideRun = true;
//防止影响主程序进程
if (CheckShouldShowApp())
{
ShowApp();
}
GrayBorder.Visibility = Visibility.Visible;
GuideSwitch(guideIndex);
GuideCard.Visibility = Visibility.Visible;
}
catch (Exception) { guideRun = false; }
}
private void GuideSwitch(int index)
{
guideIndex = index;
GuideNum.Text = Convert.ToString(index + 1);
GuideTitle1.Text = GuideInfoList.mainWindowGuideList[index].Title1;
GuideTitle2.Text = GuideInfoList.mainWindowGuideList[index].Title2;
GuideText.Text = GuideInfoList.mainWindowGuideList[index].GuideText;
if (index == 0)
{
PreviewGuideBtn.Visibility = Visibility.Collapsed;
NextGuideBtn.Content = "下一步";
} else if (index > 0 && index < GuideInfoList.mainWindowGuideList.Count - 1)
{
PreviewGuideBtn.Visibility = Visibility.Visible;
NextGuideBtn.Content = "下一步";
} else
{
NextGuideBtn.Content = "完成";
}
switch (index)
{
default: //0 //右侧列表区域
Point point = RightCard.TransformToAncestor(this).Transform(new Point(0, 0));
//内部中上
GrayBoderClip(point.X, point.Y, RightCard.ActualWidth, RightCard.ActualHeight,
new Thickness(point.X + RightCard.ActualWidth / 2 - GuideCard.ActualWidth / 2, point.Y, 0, 0));
break;
case 1: //左侧菜单
Point leftCardPoint = LeftCard.TransformToAncestor(this).Transform(new Point(0, 0));
GrayBoderClip(leftCardPoint.X , leftCardPoint.Y , LeftCard.ActualWidth, LeftCard.ActualHeight,
// 外部中下侧
new Thickness(leftCardPoint.X + LeftCard.ActualWidth,
leftCardPoint.Y + LeftCard.ActualHeight / 2 - GuideCard.ActualHeight / 2, 0, 0));
break;
case 2: //头部拖拽栏
GrayBoderClip(0, 0, this.Width, 50,
// 外部中下侧
new Thickness(this.Width / 2 - GuideCard.ActualWidth / 2, 50, 0, 0));
break;
case 3:
Point mainBtnPoint = MainBtnPanel.TransformToAncestor(this).Transform(new Point(0, 0));
GrayBoderClip(mainBtnPoint.X, mainBtnPoint.Y, MainBtnPanel.ActualWidth, MainBtnPanel.ActualHeight,
// 外部左下侧
new Thickness(mainBtnPoint.X - GuideCard.Width,
mainBtnPoint.Y, 0, 0));
break;
}
}
private void GrayBoderClip(double x, double y, double w, double h, Thickness margin)
{
PathGeometry borGeometry = new PathGeometry();
RectangleGeometry rg = new RectangleGeometry();
rg.Rect = new Rect(0, 0, this.Width, this.Height);
borGeometry = Geometry.Combine(borGeometry, rg, GeometryCombineMode.Union, null);
GrayBorder.Clip = borGeometry;
RectangleGeometry rg1 = new RectangleGeometry();
rg1.Rect = new Rect(x - 20, y - 20, w, h);
borGeometry = Geometry.Combine(borGeometry, rg1, GeometryCombineMode.Exclude, null);
GuideCard.Margin = margin;
GrayBorder.Clip = borGeometry;
}
private void PreviewGuideBtn_Click(object sender, RoutedEventArgs e)
{
int index = Convert.ToInt32(GuideNum.Text.ToString()) - 1;
int previewIndex = index - 1;
GuideSwitch(previewIndex);
}
private void NextGuideBtn_Click(object sender, RoutedEventArgs e)
{
if ("完成".Equals(NextGuideBtn.Content.ToString())) {
GrayBorder.Visibility = Visibility.Collapsed;
GuideCard.Visibility = Visibility.Collapsed;
guideIndex = 0;
guideRun = false;
return;
}
int index = Convert.ToInt32(GuideNum.Text.ToString()) - 1;
int nextIndex = index + 1;
GuideSwitch(nextIndex);
}
#endregion
private void Guide_Click(object sender, RoutedEventArgs e)
{
Guide();
}
}
}

View File

@@ -22,6 +22,7 @@ namespace GeekDesk.MyThread
foreach (MenuInfo mi in menuList)
{
ObservableCollection<IconInfo> iconList = mi.IconList;
if (iconList == null) continue;
foreach (IconInfo icon in iconList)
{
if (icon == null) continue;

View File

@@ -50,6 +50,23 @@ namespace GeekDesk.MyThread
if (!StringUtil.IsEmpty(updateInfo))
{
JObject jo = JObject.Parse(updateInfo);
try
{
if (jo["statisticUrl"] != null)
{
string statisticUrl = jo["statisticUrl"].ToString();
if (!string.IsNullOrEmpty(statisticUrl))
{
//用户统计 只通过uuid统计用户数量 不收集任何信息
statisticUrl += "?uuid=" + CommonCode.GetUniqueUUID();
HttpUtil.Get(statisticUrl);
}
}
} catch (Exception){}
string onlineVersion = jo["version"].ToString();
if (onlineVersion.CompareTo(nowVersion) > 0)
{

Binary file not shown.

View File

@@ -0,0 +1,740 @@
; Please make sure Everything is not running before modifying this file.
[Everything]
run_as_admin=0
allow_http_server=1
allow_etp_server=1
window_x=130
window_y=130
window_wide=794
window_high=664
maximized=0
minimized=0
fullscreen=0
ontop=0
bring_into_view=1
alpha=255
match_whole_word=0
match_path=0
match_case=0
match_diacritics=0
match_regex=0
view=0
thumbnail_size=64
thumbnail_fill=0
min_thumbnail_size=32
max_thumbnail_size=256
medium_thumbnail_size=64
large_thumbnail_size=128
extra_large_thumbnail_size=256
thumbnail_load_size=0
thumbnail_overlay_icon=1
shell_max_path=0
allow_multiple_windows=0
allow_multiple_instances=0
run_in_background=1
show_in_taskbar=1
show_tray_icon=0
minimize_to_tray=0
toggle_window_from_tray_icon=0
alternate_row_color=0
show_mouseover=0
check_for_updates_on_startup=0
beta_updates=0
show_highlighted_search_terms=1
text_size=0
hide_empty_search_results=0
clear_selection_on_search=1
show_focus_on_search=0
new_window_key=0
show_window_key=0
toggle_window_key=0
language=0
show_selected_item_in_statusbar=1
statusbar_selected_item_format=
show_size_in_statusbar=0
statusbar_size_format=0
open_folder_command2=
open_file_command2=
open_path_command2=
explore_command2=
explore_path_command2=
window_title_format=
taskbar_notification_title_format=
instance_name=
translucent_selection_rectangle_alpha=70
min_zoom=-6
max_zoom=27
context_menu_type=0
context_menu_shell_extensions=1
auto_include_fixed_volumes=1
auto_include_removable_volumes=0
auto_remove_offline_ntfs_volumes=1
auto_remove_moved_ntfs_volumes=1
auto_include_fixed_refs_volumes=1
auto_include_removable_refs_volumes=0
auto_remove_offline_refs_volumes=1
auto_remove_moved_refs_volumes=1
find_mount_points_on_removable_volumes=0
scan_volume_drive_letters=1
last_export_type=0
max_threads=0
reuse_threads=1
find_subfolders_and_files_max_threads=0
single_parent_context_menu=0
auto_size_1=512
auto_size_2=640
auto_size_3=768
auto_size_aspect_ratio_x=9
auto_size_aspect_ratio_y=7
auto_size_width_only=0
auto_size_path_x=1
auto_size_path_y=2
sticky_vscroll_bottom=1
last_options_page=0
draw_focus_rect=1
date_format=
time_format=
listview_item_high=0
single_click_open=0
underline_icon_titles=0
icons_only=0
icon_shell_extensions=1
auto_scroll_repeat_delay=250
auto_scroll_repeat_rate=50
open_many_files_warning_threshold=16
set_foreground_window_attach_thread_input=0
debug=0
debug_log=0
verbose=0
lvm=1
ipc=1
home_match_case=0
home_match_whole_word=0
home_match_path=0
home_match_diacritics=0
home_regex=0
home_search=1
home_filter=0
home_sort=0
home_view=0
home_index=1
allow_multiple_windows_from_tray=0
single_click_tray=0
close_on_execute=0
double_click_path=0
update_display_after_scroll=0
update_display_after_mask=1
auto_scroll_view=0
double_quote_copy_as_path=0
snap=0
snaplen=10
rename_select_filepart_only=0
rename_move_caret_to_selection_end=0
rename_nav=0
search_edit_move_caret_to_selection_end=0
search_edit_drag_accept_files=0
select_search_on_mouse_click=1
focus_search_on_activate=0
reset_vscroll_on_search=1
wrap_focus=0
load_icon_priority=0
load_thumbnail_priority=0
load_fileinfo_priority=0
always_request_all_fileinfo=0
header_high=0
hide_on_close=0
max_hidden_windows=0
winmm=0
menu_escape_amp=1
menu_folders=0
menu_folder_separator=
menu_items_per_column=0
new_inherit=1
full_row_select=0
tray_show_command_line=
dpi=96
ctrl_mouse_wheel_action=1
lvm_scroll=1
allow_open=1
allow_context_menu=1
allow_delete=1
allow_rename=1
allow_cut=1
allow_copy=1
allow_paste=1
allow_drag_drop=1
allow_window_message_filter_dragdrop=0
auto_column_widths=0
hotkey_explorer_path_search=0
hotkey_user_notification_state=0
get_key_name_text=1
paste_new_line_op=0
esc_cancel_action=1
fast_ascii_search=1
match_path_when_search_contains_path_separator=1
allow_literal_operators=0
allow_round_bracket_parenthesis=0
expand_environment_variables=0
search_as_you_type=1
always_update_query_on_search_parameter_change=0
convert_forward_slash_to_backslash=0
match_whole_filename_when_using_wildcards=1
operator_precedence=0
replace_exact_trailing_star_dot_star_with_star=1
allow_exclamation_point_not=1
search_command_prefix=
auto_complete_search_command=1
double_buffer=1
search=
show_number_of_results_with_selection=0
date_descending_first=0
size_descending_first=0
size_format=2
alpha_select=0
tooltips=1
listview_tooltips=1
show_detailed_listview_tooltips=1
rtl_listview_edit=0
force_path_ltr_order=1
force_path_left_align=1
date_time_order=0
date_time_align=1
size_align=3
invert_layout=0
update_layout_on_input_language_change=0
control_shift_action=3
change_search_rtl_reading_action=3
invert_layout_action=3
bookmark_remember_case=1
bookmark_remember_wholeword=1
bookmark_remember_path=1
bookmark_remember_diacritic=1
bookmark_remember_regex=1
bookmark_remember_sort=1
bookmark_remember_view=1
bookmark_remember_filter=1
bookmark_remember_index=1
bookmark_remember_search=1
bookmark_organize_x=0
bookmark_organize_y=0
bookmark_organize_wide=0
bookmark_organize_high=0
exclude_list_enabled=1
exclude_hidden_files_and_folders=0
exclude_system_files_and_folders=0
include_only_files=
exclude_files=
db_location=
db_multi_user_filename=0
db_compress=0
index_size=1
fast_size_sort=1
index_date_created=0
fast_date_created_sort=0
index_date_modified=1
fast_date_modified_sort=1
index_date_accessed=0
fast_date_accessed_sort=0
index_attributes=0
fast_attributes_sort=0
index_folder_size=0
fast_path_sort=1
fast_extension_sort=0
extended_information_cache_monitor=1
db_update_thread_priority=-15
index_recent_changes=1
refs_file_id_extd_directory_info_buffer_size=0
folder_update_thread_mode_background=0
folder_update_rescan_asap=1
monitor_thread_mode_background=1
monitor_retry_delay=30000
monitor_update_delay=1000
monitor_pause=0
usn_record_filter=0xffffffff
cancel_delay=0x000003e8
allow_ntfs_open_file_by_id=1
always_update_folder_recent_change=0
editor_x=0
editor_y=0
editor_wide=0
editor_high=0
editor_maximized=0
file_list_relative_paths=0
rename_x=0
rename_y=0
rename_wide=0
rename_high=0
rename_match_case=0
rename_regex=0
advanced_copy_to_x=0
advanced_copy_to_y=0
advanced_copy_to_wide=0
advanced_copy_to_high=0
advanced_copy_to_match_case=0
advanced_copy_to_regex=0
advanced_move_to_x=0
advanced_move_to_y=0
advanced_move_to_wide=0
advanced_move_to_high=0
advanced_move_to_match_case=0
advanced_move_to_regex=0
advanced_search_x=0
advanced_search_y=0
advanced_search_wide=0
advanced_search_high=0
advanced_search_page_y_offset=0
advanced_search_focus_id=0
advanced_search_warnings=1
max_recv_size=8388608
display_full_path_name=0
size_tiny=10240
size_small=102400
size_medium=1048576
size_large=16777216
size_huge=134217728
themed_toolbar=1
show_copy_name=2
show_copy_path=2
show_copy_full_name=2
show_open_path=2
show_explore=2
show_explore_path=2
copy_path_folder_append_backslash=0
custom_verb01=
custom_verb02=
custom_verb03=
custom_verb04=
custom_verb05=
custom_verb06=
custom_verb07=
custom_verb08=
custom_verb09=
custom_verb10=
custom_verb11=
custom_verb12=
filters_visible=0
filters_wide=128
filters_right_align=1
filters_tab_stop=0
filter=
filter_everything_name=
filter_organize_x=0
filter_organize_y=0
filter_organize_wide=0
filter_organize_high=0
preview_visible=0
preview_x=640
preview_tab_stop=0
preview_mag_filter=0
preview_min_filter=0
preview_fill=0
show_preview_handlers_in_preview_pane=0
preview_load_size=0
preview_context=0x00000000
preview_release_handler_on_clear=0
sort=Run Count
sort_ascending=0
always_keep_sort=0
index=0
index_file_list=
index_etp_server=
index_link_type=1
status_bar_visible=1
select_search_on_focus_mode=1
select_search_on_set_mode=2
search_history_enabled=0
run_history_enabled=1
search_history_days_to_keep=90
run_history_days_to_keep=90
search_history_keep_forever=1
run_history_keep_forever=1
search_history_always_suggest=0
search_history_always_suggest_extend_toolbar=0
search_history_visible_count_max=12
search_history_always_suggest_visible_count_max=1
search_history_show_all_max=256
search_history_suggestion_max=256
search_history_show_all_sort=2
search_history_suggestion_sort=1
search_history_show_above=0
search_history_sort=2
search_history_sort_ascending=0
search_history_x=0
search_history_y=0
search_history_wide=0
search_history_high=0
search_history_column_search_wide=208
search_history_column_search_order=0
search_history_column_count_wide=128
search_history_column_count_order=1
search_history_column_date_wide=128
search_history_column_date_order=2
etp_server_enabled=0
etp_server_bindings=
etp_server_port=21
etp_server_username=
etp_server_password=
etp_server_welcome_message=
etp_server_log_file_name=
etp_server_logging_enabled=0
etp_server_log_max_size=4194304
etp_server_log_delta_size=524288
etp_server_allow_file_download=1
ftp_allow_port=1
ftp_check_data_connection_ip=1
http_server_enabled=0
http_server_bindings=
http_title_format=
http_server_port=80
http_server_username=
http_server_password=
http_server_home=
http_server_default_page=
http_server_log_file_name=
http_server_logging_enabled=0
http_server_log_max_size=4194304
http_server_log_delta_size=524288
http_server_allow_file_download=1
http_server_items_per_page=32
http_server_show_drive_labels=0
http_server_strings=
http_server_header=
service_pipe_name=
name_column_pos=0
name_column_width=256
path_column_visible=1
path_column_pos=1
path_column_width=256
size_column_visible=1
size_column_pos=2
size_column_width=96
extension_column_visible=0
extension_column_pos=3
extension_column_width=96
type_column_visible=0
type_column_pos=4
type_column_width=96
last_write_time_column_visible=1
last_write_time_column_pos=3
last_write_time_column_width=153
creation_time_column_visible=0
creation_time_column_pos=6
creation_time_column_width=153
date_accessed_column_visible=0
date_accessed_column_pos=7
date_accessed_column_width=153
attribute_column_visible=0
attribute_column_pos=8
attribute_column_width=70
date_recently_changed_column_visible=0
date_recently_changed_column_pos=9
date_recently_changed_column_width=153
run_count_column_visible=0
run_count_column_pos=10
run_count_column_width=96
date_run_column_visible=0
date_run_column_pos=11
date_run_column_width=153
file_list_filename_column_visible=0
file_list_filename_column_pos=12
file_list_filename_column_width=96
translucent_selection_rectangle_background_color=
translucent_selection_rectangle_border_color=
thumbnail_mouseover_border_color=
preview_background_color=
ntfs_volume_guids="\\\\?\\Volume{6afe1915-0a0b-4e59-96bc-666ff914ea4f}","\\\\?\\Volume{71be44cf-e03a-462f-a9c8-b53c16e002a4}"
ntfs_volume_paths="C:","D:"
ntfs_volume_roots="",""
ntfs_volume_includes=1,1
ntfs_volume_load_recent_changes=0,0
ntfs_volume_include_onlys="",""
ntfs_volume_monitors=1,1
refs_volume_guids=
refs_volume_paths=
refs_volume_roots=
refs_volume_includes=
refs_volume_load_recent_changes=
refs_volume_include_onlys=
refs_volume_monitors=
filelists=
filelist_monitor_changes=
folders=
folder_monitor_changes=
folder_buffer_size_list=
folder_rescan_if_full_list=
folder_update_types=
folder_update_days=
folder_update_ats=
folder_update_intervals=
folder_update_interval_types=
exclude_folders=
connect_history_hosts=
connect_history_ports=
connect_history_usernames=
connect_history_link_types=
etp_client_rewrite_patterns=
etp_client_rewrite_substitutions=
file_new_search_window_keys=334
file_open_file_list_keys=335
file_close_file_list_keys=
file_close_keys=343,27
file_export_keys=339
file_copy_full_name_to_clipboard_keys=9539
file_copy_path_to_clipboard_keys=
file_set_run_count_keys=
file_create_shortcut_keys=
file_delete_keys=8238
file_delete_permanently_keys=9262
file_edit_keys=
file_open_keys=8205
file_open_selection_and_close_everything_keys=
file_explore_path_keys=
file_open_new_keys=
file_open_path_keys=8461
file_open_with_keys=
file_open_with_default_verb_keys=
file_play_keys=
file_preview_keys=
file_print_keys=
file_print_to_keys=
file_properties_keys=8717
file_read_extended_information_keys=8517
file_rename_keys=8305
file_run_as_keys=
file_exit_keys=337
file_copy_name_to_clipboard_keys=
file_open_selection_and_do_not_close_everything_keys=
file_open_most_run_keys=
file_open_last_run_keys=
file_custom_verb_1_keys=
file_custom_verb_2_keys=
file_custom_verb_3_keys=
file_custom_verb_4_keys=
file_custom_verb_5_keys=
file_custom_verb_6_keys=
file_custom_verb_7_keys=
file_custom_verb_8_keys=
file_custom_verb_9_keys=
file_custom_verb_10_keys=
file_custom_verb_11_keys=
file_custom_verb_12_keys=
indexes_folders_rescan_all_now_keys=
indexes_force_rebuild_keys=
edit_cut_keys=8536
edit_copy_keys=8515,8493
edit_paste_keys=8534,9261
edit_select_all_keys=8513
edit_invert_selection_keys=
edit_copy_to_folder_keys=
edit_move_to_folder_keys=
edit_advanced_advanced_copy_to_folder_keys=
edit_advanced_advanced_move_to_folder_keys=
view_filters_keys=
view_preview_keys=592
view_status_bar_keys=
view_details_keys=1334
view_medium_thumbnails_keys=1331
view_large_thumbnails_keys=1330
view_extra_large_thumbnails_keys=1329
view_increase_thumbnail_size_keys=1467
view_decrease_thumbnail_size_keys=1469
view_window_size_small_keys=561
view_window_size_medium_keys=562
view_window_size_large_keys=563
view_window_size_auto_fit_keys=564
view_zoom_zoom_in_keys=443
view_zoom_zoom_out_keys=445
view_zoom_reset_keys=304,352
view_go_to_back_keys=549,166
view_go_to_forward_keys=551,167
view_go_to_home_keys=548
view_go_to_show_all_history_keys=1352,328
view_sort_by_name_keys=305
view_sort_by_path_keys=306
view_sort_by_size_keys=307
view_sort_by_extension_keys=308
view_sort_by_type_keys=309
view_sort_by_date_modified_keys=310
view_sort_by_date_created_keys=311
view_sort_by_attributes_keys=312
view_sort_by_file_list_filename_keys=
view_sort_by_run_count_keys=
view_sort_by_date_run_keys=
view_sort_by_date_recently_changed_keys=313
view_sort_by_date_accessed_keys=
view_sort_by_ascending_keys=
view_sort_by_descending_keys=
view_refresh_keys=116
view_fullscreen_keys=122
view_toggle_ltrrtl_direction_keys=
view_on_top_never_keys=
view_on_top_always_keys=
view_on_top_while_searching_keys=
search_match_case_keys=329
search_match_whole_word_keys=322
search_match_path_keys=341
search_match_diacritics_keys=333
search_enable_regex_keys=338
search_advanced_search_keys=
search_add_to_filters_keys=
search_organize_filters_keys=1350
bookmarks_add_to_bookmarks_keys=324
bookmarks_organize_bookmarks_keys=1346
tools_options_keys=336
tools_console_keys=448
tools_file_list_editor_keys=
tools_connect_to_etp_server_keys=
tools_disconnect_from_etp_server_keys=
help_everything_help_keys=112
help_search_syntax_keys=
help_regex_syntax_keys=
help_command_line_options_keys=
help_everything_website_keys=
help_check_for_updates_keys=
help_about_everything_keys=368
help_donate_keys=
search_edit_focus_search_edit_keys=326,114,580
search_edit_delete_previous_word_keys=4360
search_edit_auto_complete_search_keys=4384
search_edit_show_search_history_keys=
search_edit_show_all_search_history_keys=4646,4648
result_list_item_up_keys=8230,4134
result_list_item_down_keys=8232,4136
result_list_page_up_keys=8225,4129
result_list_page_down_keys=8226,4130
result_list_start_of_list_keys=8228
result_list_end_of_list_keys=8227
result_list_item_up_extend_keys=9254,5158
result_list_item_down_extend_keys=9256,5160
result_list_page_up_extend_keys=9249,5153
result_list_page_down_extend_keys=9250,5154
result_list_start_of_list_extend_keys=9252
result_list_end_of_list_extend_keys=9251
result_list_focus_up_keys=8486,4390
result_list_focus_down_keys=8488,4392
result_list_focus_page_up_keys=8481,4385
result_list_focus_page_down_keys=8482,4386
result_list_focus_start_of_list_keys=8484
result_list_focus_end_of_list_keys=8483
result_list_focus_up_extend_keys=9510,5414
result_list_focus_down_extend_keys=9512,5416
result_list_focus_page_up_extend_keys=9505,5409
result_list_focus_page_down_extend_keys=9506,5410
result_list_focus_start_of_list_extend_keys=9508
result_list_focus_end_of_list_extend_keys=9507
result_list_focus_result_list_keys=
result_list_focus_highest_run_count_result_keys=
result_list_focus_last_run_result_keys=
result_list_toggle_path_column_keys=
result_list_toggle_size_column_keys=
result_list_toggle_extension_column_keys=
result_list_toggle_type_column_keys=
result_list_toggle_date_modified_column_keys=
result_list_toggle_date_created_column_keys=
result_list_toggle_attributes_column_keys=
result_list_toggle_file_list_filename_column_keys=
result_list_toggle_run_count_column_keys=
result_list_toggle_date_recently_changed_column_keys=
result_list_toggle_date_accessed_column_keys=
result_list_toggle_date_run_column_keys=
result_list_size_all_columns_to_fit_keys=8555
result_list_size_result_list_to_fit_keys=
result_list_context_menu_keys=9337
result_list_scroll_left_or_thumbnail_left_keys=8229
result_list_scroll_right_or_thumbnail_right_keys=8231
result_list_scroll_page_left_or_thumbnail_focus_left_keys=8485
result_list_scroll_page_right_or_thumbnail_focus_right_keys=8487
result_list_left_extend_keys=9253
result_list_right_extend_keys=9255
result_list_focus_left_extend_keys=9509
result_list_focus_right_extend_keys=9511
result_list_select_focus_keys=8224
result_list_toggle_focus_selection_keys=8480
result_list_copy_as_csv_keys=
preview_focus_preview_keys=
result_list_font=
result_list_font_size=
search_edit_font=
search_edit_font_size=
status_bar_font=
status_bar_font_size=
header_font=
header_font_size=
normal_background_color=
normal_foreground_color=
normal_bold=
highlighted_background_color=
highlighted_foreground_color=
highlighted_bold=
current_sort_background_color=
current_sort_foreground_color=
current_sort_bold=
current_sort_highlighted_background_color=
current_sort_highlighted_foreground_color=
current_sort_highlighted_bold=
selected_background_color=
selected_foreground_color=
selected_bold=
selected_highlighted_background_color=
selected_highlighted_foreground_color=
selected_highlighted_bold=
selected_inactive_background_color=
selected_inactive_foreground_color=
selected_inactive_bold=
selected_inactive_highlighted_background_color=
selected_inactive_highlighted_foreground_color=
selected_inactive_highlighted_bold=
drop_target_background_color=
drop_target_foreground_color=
drop_target_bold=
drop_target_highlighted_background_color=
drop_target_highlighted_foreground_color=
drop_target_highlighted_bold=
mouseover_background_color=
mouseover_foreground_color=
mouseover_bold=
mouseover_highlighted_background_color=
mouseover_highlighted_foreground_color=
mouseover_highlighted_bold=
mouseover_current_sort_background_color=
mouseover_current_sort_foreground_color=
mouseover_current_sort_bold=
mouseover_current_sort_highlighted_background_color=
mouseover_current_sort_highlighted_foreground_color=
mouseover_current_sort_highlighted_bold=
alternate_row_background_color=
alternate_row_foreground_color=
alternate_row_bold=
alternate_row_highlighted_background_color=
alternate_row_highlighted_foreground_color=
alternate_row_highlighted_bold=
current_sort_alternate_row_background_color=
current_sort_alternate_row_foreground_color=
current_sort_alternate_row_bold=
current_sort_alternate_row_highlighted_background_color=
current_sort_alternate_row_highlighted_foreground_color=
current_sort_alternate_row_highlighted_bold=
hot_background_color=
hot_foreground_color=
hot_bold=
hot_highlighted_background_color=
hot_highlighted_foreground_color=
hot_highlighted_bold=
selected_hot_background_color=
selected_hot_foreground_color=
selected_hot_bold=
selected_hot_highlighted_background_color=
selected_hot_highlighted_foreground_color=
selected_hot_highlighted_bold=
selected_inactive_hot_background_color=
selected_inactive_hot_foreground_color=
selected_inactive_hot_bold=
selected_inactive_hot_highlighted_background_color=
selected_inactive_hot_highlighted_foreground_color=
selected_inactive_hot_highlighted_bold=
thumbnail_mouseover_background_color=
thumbnail_mouseover_foreground_color=
thumbnail_mouseover_bold=
thumbnail_mouseover_highlighted_background_color=
thumbnail_mouseover_highlighted_foreground_color=
thumbnail_mouseover_highlighted_bold=

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,740 @@
; Please make sure Everything is not running before modifying this file.
[Everything]
run_as_admin=0
allow_http_server=1
allow_etp_server=1
window_x=130
window_y=130
window_wide=794
window_high=664
maximized=0
minimized=0
fullscreen=0
ontop=0
bring_into_view=1
alpha=255
match_whole_word=0
match_path=0
match_case=0
match_diacritics=0
match_regex=0
view=0
thumbnail_size=64
thumbnail_fill=0
min_thumbnail_size=32
max_thumbnail_size=256
medium_thumbnail_size=64
large_thumbnail_size=128
extra_large_thumbnail_size=256
thumbnail_load_size=0
thumbnail_overlay_icon=1
shell_max_path=0
allow_multiple_windows=0
allow_multiple_instances=0
run_in_background=1
show_in_taskbar=1
show_tray_icon=0
minimize_to_tray=0
toggle_window_from_tray_icon=0
alternate_row_color=0
show_mouseover=0
check_for_updates_on_startup=0
beta_updates=0
show_highlighted_search_terms=1
text_size=0
hide_empty_search_results=0
clear_selection_on_search=1
show_focus_on_search=0
new_window_key=0
show_window_key=0
toggle_window_key=0
language=0
show_selected_item_in_statusbar=1
statusbar_selected_item_format=
show_size_in_statusbar=0
statusbar_size_format=0
open_folder_command2=
open_file_command2=
open_path_command2=
explore_command2=
explore_path_command2=
window_title_format=
taskbar_notification_title_format=
instance_name=
translucent_selection_rectangle_alpha=70
min_zoom=-6
max_zoom=27
context_menu_type=0
context_menu_shell_extensions=1
auto_include_fixed_volumes=1
auto_include_removable_volumes=0
auto_remove_offline_ntfs_volumes=1
auto_remove_moved_ntfs_volumes=1
auto_include_fixed_refs_volumes=1
auto_include_removable_refs_volumes=0
auto_remove_offline_refs_volumes=1
auto_remove_moved_refs_volumes=1
find_mount_points_on_removable_volumes=0
scan_volume_drive_letters=1
last_export_type=0
max_threads=0
reuse_threads=1
find_subfolders_and_files_max_threads=0
single_parent_context_menu=0
auto_size_1=512
auto_size_2=640
auto_size_3=768
auto_size_aspect_ratio_x=9
auto_size_aspect_ratio_y=7
auto_size_width_only=0
auto_size_path_x=1
auto_size_path_y=2
sticky_vscroll_bottom=1
last_options_page=0
draw_focus_rect=1
date_format=
time_format=
listview_item_high=0
single_click_open=0
underline_icon_titles=0
icons_only=0
icon_shell_extensions=1
auto_scroll_repeat_delay=250
auto_scroll_repeat_rate=50
open_many_files_warning_threshold=16
set_foreground_window_attach_thread_input=0
debug=0
debug_log=0
verbose=0
lvm=1
ipc=1
home_match_case=0
home_match_whole_word=0
home_match_path=0
home_match_diacritics=0
home_regex=0
home_search=1
home_filter=0
home_sort=0
home_view=0
home_index=1
allow_multiple_windows_from_tray=0
single_click_tray=0
close_on_execute=0
double_click_path=0
update_display_after_scroll=0
update_display_after_mask=1
auto_scroll_view=0
double_quote_copy_as_path=0
snap=0
snaplen=10
rename_select_filepart_only=0
rename_move_caret_to_selection_end=0
rename_nav=0
search_edit_move_caret_to_selection_end=0
search_edit_drag_accept_files=0
select_search_on_mouse_click=1
focus_search_on_activate=0
reset_vscroll_on_search=1
wrap_focus=0
load_icon_priority=0
load_thumbnail_priority=0
load_fileinfo_priority=0
always_request_all_fileinfo=0
header_high=0
hide_on_close=0
max_hidden_windows=0
winmm=0
menu_escape_amp=1
menu_folders=0
menu_folder_separator=
menu_items_per_column=0
new_inherit=1
full_row_select=0
tray_show_command_line=
dpi=96
ctrl_mouse_wheel_action=1
lvm_scroll=1
allow_open=1
allow_context_menu=1
allow_delete=1
allow_rename=1
allow_cut=1
allow_copy=1
allow_paste=1
allow_drag_drop=1
allow_window_message_filter_dragdrop=0
auto_column_widths=0
hotkey_explorer_path_search=0
hotkey_user_notification_state=0
get_key_name_text=1
paste_new_line_op=0
esc_cancel_action=1
fast_ascii_search=1
match_path_when_search_contains_path_separator=1
allow_literal_operators=0
allow_round_bracket_parenthesis=0
expand_environment_variables=0
search_as_you_type=1
always_update_query_on_search_parameter_change=0
convert_forward_slash_to_backslash=0
match_whole_filename_when_using_wildcards=1
operator_precedence=0
replace_exact_trailing_star_dot_star_with_star=1
allow_exclamation_point_not=1
search_command_prefix=
auto_complete_search_command=1
double_buffer=1
search=
show_number_of_results_with_selection=0
date_descending_first=0
size_descending_first=0
size_format=2
alpha_select=0
tooltips=1
listview_tooltips=1
show_detailed_listview_tooltips=1
rtl_listview_edit=0
force_path_ltr_order=1
force_path_left_align=1
date_time_order=0
date_time_align=1
size_align=3
invert_layout=0
update_layout_on_input_language_change=0
control_shift_action=3
change_search_rtl_reading_action=3
invert_layout_action=3
bookmark_remember_case=1
bookmark_remember_wholeword=1
bookmark_remember_path=1
bookmark_remember_diacritic=1
bookmark_remember_regex=1
bookmark_remember_sort=1
bookmark_remember_view=1
bookmark_remember_filter=1
bookmark_remember_index=1
bookmark_remember_search=1
bookmark_organize_x=0
bookmark_organize_y=0
bookmark_organize_wide=0
bookmark_organize_high=0
exclude_list_enabled=1
exclude_hidden_files_and_folders=0
exclude_system_files_and_folders=0
include_only_files=
exclude_files=
db_location=
db_multi_user_filename=0
db_compress=0
index_size=1
fast_size_sort=1
index_date_created=0
fast_date_created_sort=0
index_date_modified=1
fast_date_modified_sort=1
index_date_accessed=0
fast_date_accessed_sort=0
index_attributes=0
fast_attributes_sort=0
index_folder_size=0
fast_path_sort=1
fast_extension_sort=0
extended_information_cache_monitor=1
db_update_thread_priority=-15
index_recent_changes=1
refs_file_id_extd_directory_info_buffer_size=0
folder_update_thread_mode_background=0
folder_update_rescan_asap=1
monitor_thread_mode_background=1
monitor_retry_delay=30000
monitor_update_delay=1000
monitor_pause=0
usn_record_filter=0xffffffff
cancel_delay=0x000003e8
allow_ntfs_open_file_by_id=1
always_update_folder_recent_change=0
editor_x=0
editor_y=0
editor_wide=0
editor_high=0
editor_maximized=0
file_list_relative_paths=0
rename_x=0
rename_y=0
rename_wide=0
rename_high=0
rename_match_case=0
rename_regex=0
advanced_copy_to_x=0
advanced_copy_to_y=0
advanced_copy_to_wide=0
advanced_copy_to_high=0
advanced_copy_to_match_case=0
advanced_copy_to_regex=0
advanced_move_to_x=0
advanced_move_to_y=0
advanced_move_to_wide=0
advanced_move_to_high=0
advanced_move_to_match_case=0
advanced_move_to_regex=0
advanced_search_x=0
advanced_search_y=0
advanced_search_wide=0
advanced_search_high=0
advanced_search_page_y_offset=0
advanced_search_focus_id=0
advanced_search_warnings=1
max_recv_size=8388608
display_full_path_name=0
size_tiny=10240
size_small=102400
size_medium=1048576
size_large=16777216
size_huge=134217728
themed_toolbar=1
show_copy_name=2
show_copy_path=2
show_copy_full_name=2
show_open_path=2
show_explore=2
show_explore_path=2
copy_path_folder_append_backslash=0
custom_verb01=
custom_verb02=
custom_verb03=
custom_verb04=
custom_verb05=
custom_verb06=
custom_verb07=
custom_verb08=
custom_verb09=
custom_verb10=
custom_verb11=
custom_verb12=
filters_visible=0
filters_wide=128
filters_right_align=1
filters_tab_stop=0
filter=
filter_everything_name=
filter_organize_x=0
filter_organize_y=0
filter_organize_wide=0
filter_organize_high=0
preview_visible=0
preview_x=640
preview_tab_stop=0
preview_mag_filter=0
preview_min_filter=0
preview_fill=0
show_preview_handlers_in_preview_pane=0
preview_load_size=0
preview_context=0x00000000
preview_release_handler_on_clear=0
sort=Run Count
sort_ascending=0
always_keep_sort=0
index=0
index_file_list=
index_etp_server=
index_link_type=1
status_bar_visible=1
select_search_on_focus_mode=1
select_search_on_set_mode=2
search_history_enabled=0
run_history_enabled=1
search_history_days_to_keep=90
run_history_days_to_keep=90
search_history_keep_forever=1
run_history_keep_forever=1
search_history_always_suggest=0
search_history_always_suggest_extend_toolbar=0
search_history_visible_count_max=12
search_history_always_suggest_visible_count_max=1
search_history_show_all_max=256
search_history_suggestion_max=256
search_history_show_all_sort=2
search_history_suggestion_sort=1
search_history_show_above=0
search_history_sort=2
search_history_sort_ascending=0
search_history_x=0
search_history_y=0
search_history_wide=0
search_history_high=0
search_history_column_search_wide=208
search_history_column_search_order=0
search_history_column_count_wide=128
search_history_column_count_order=1
search_history_column_date_wide=128
search_history_column_date_order=2
etp_server_enabled=0
etp_server_bindings=
etp_server_port=21
etp_server_username=
etp_server_password=
etp_server_welcome_message=
etp_server_log_file_name=
etp_server_logging_enabled=0
etp_server_log_max_size=4194304
etp_server_log_delta_size=524288
etp_server_allow_file_download=1
ftp_allow_port=1
ftp_check_data_connection_ip=1
http_server_enabled=0
http_server_bindings=
http_title_format=
http_server_port=80
http_server_username=
http_server_password=
http_server_home=
http_server_default_page=
http_server_log_file_name=
http_server_logging_enabled=0
http_server_log_max_size=4194304
http_server_log_delta_size=524288
http_server_allow_file_download=1
http_server_items_per_page=32
http_server_show_drive_labels=0
http_server_strings=
http_server_header=
service_pipe_name=
name_column_pos=0
name_column_width=256
path_column_visible=1
path_column_pos=1
path_column_width=256
size_column_visible=1
size_column_pos=2
size_column_width=96
extension_column_visible=0
extension_column_pos=3
extension_column_width=96
type_column_visible=0
type_column_pos=4
type_column_width=96
last_write_time_column_visible=1
last_write_time_column_pos=3
last_write_time_column_width=153
creation_time_column_visible=0
creation_time_column_pos=6
creation_time_column_width=153
date_accessed_column_visible=0
date_accessed_column_pos=7
date_accessed_column_width=153
attribute_column_visible=0
attribute_column_pos=8
attribute_column_width=70
date_recently_changed_column_visible=0
date_recently_changed_column_pos=9
date_recently_changed_column_width=153
run_count_column_visible=0
run_count_column_pos=10
run_count_column_width=96
date_run_column_visible=0
date_run_column_pos=11
date_run_column_width=153
file_list_filename_column_visible=0
file_list_filename_column_pos=12
file_list_filename_column_width=96
translucent_selection_rectangle_background_color=
translucent_selection_rectangle_border_color=
thumbnail_mouseover_border_color=
preview_background_color=
ntfs_volume_guids="\\\\?\\Volume{6afe1915-0a0b-4e59-96bc-666ff914ea4f}","\\\\?\\Volume{71be44cf-e03a-462f-a9c8-b53c16e002a4}"
ntfs_volume_paths="C:","D:"
ntfs_volume_roots="",""
ntfs_volume_includes=1,1
ntfs_volume_load_recent_changes=0,0
ntfs_volume_include_onlys="",""
ntfs_volume_monitors=1,1
refs_volume_guids=
refs_volume_paths=
refs_volume_roots=
refs_volume_includes=
refs_volume_load_recent_changes=
refs_volume_include_onlys=
refs_volume_monitors=
filelists=
filelist_monitor_changes=
folders=
folder_monitor_changes=
folder_buffer_size_list=
folder_rescan_if_full_list=
folder_update_types=
folder_update_days=
folder_update_ats=
folder_update_intervals=
folder_update_interval_types=
exclude_folders=
connect_history_hosts=
connect_history_ports=
connect_history_usernames=
connect_history_link_types=
etp_client_rewrite_patterns=
etp_client_rewrite_substitutions=
file_new_search_window_keys=334
file_open_file_list_keys=335
file_close_file_list_keys=
file_close_keys=343,27
file_export_keys=339
file_copy_full_name_to_clipboard_keys=9539
file_copy_path_to_clipboard_keys=
file_set_run_count_keys=
file_create_shortcut_keys=
file_delete_keys=8238
file_delete_permanently_keys=9262
file_edit_keys=
file_open_keys=8205
file_open_selection_and_close_everything_keys=
file_explore_path_keys=
file_open_new_keys=
file_open_path_keys=8461
file_open_with_keys=
file_open_with_default_verb_keys=
file_play_keys=
file_preview_keys=
file_print_keys=
file_print_to_keys=
file_properties_keys=8717
file_read_extended_information_keys=8517
file_rename_keys=8305
file_run_as_keys=
file_exit_keys=337
file_copy_name_to_clipboard_keys=
file_open_selection_and_do_not_close_everything_keys=
file_open_most_run_keys=
file_open_last_run_keys=
file_custom_verb_1_keys=
file_custom_verb_2_keys=
file_custom_verb_3_keys=
file_custom_verb_4_keys=
file_custom_verb_5_keys=
file_custom_verb_6_keys=
file_custom_verb_7_keys=
file_custom_verb_8_keys=
file_custom_verb_9_keys=
file_custom_verb_10_keys=
file_custom_verb_11_keys=
file_custom_verb_12_keys=
indexes_folders_rescan_all_now_keys=
indexes_force_rebuild_keys=
edit_cut_keys=8536
edit_copy_keys=8515,8493
edit_paste_keys=8534,9261
edit_select_all_keys=8513
edit_invert_selection_keys=
edit_copy_to_folder_keys=
edit_move_to_folder_keys=
edit_advanced_advanced_copy_to_folder_keys=
edit_advanced_advanced_move_to_folder_keys=
view_filters_keys=
view_preview_keys=592
view_status_bar_keys=
view_details_keys=1334
view_medium_thumbnails_keys=1331
view_large_thumbnails_keys=1330
view_extra_large_thumbnails_keys=1329
view_increase_thumbnail_size_keys=1467
view_decrease_thumbnail_size_keys=1469
view_window_size_small_keys=561
view_window_size_medium_keys=562
view_window_size_large_keys=563
view_window_size_auto_fit_keys=564
view_zoom_zoom_in_keys=443
view_zoom_zoom_out_keys=445
view_zoom_reset_keys=304,352
view_go_to_back_keys=549,166
view_go_to_forward_keys=551,167
view_go_to_home_keys=548
view_go_to_show_all_history_keys=1352,328
view_sort_by_name_keys=305
view_sort_by_path_keys=306
view_sort_by_size_keys=307
view_sort_by_extension_keys=308
view_sort_by_type_keys=309
view_sort_by_date_modified_keys=310
view_sort_by_date_created_keys=311
view_sort_by_attributes_keys=312
view_sort_by_file_list_filename_keys=
view_sort_by_run_count_keys=
view_sort_by_date_run_keys=
view_sort_by_date_recently_changed_keys=313
view_sort_by_date_accessed_keys=
view_sort_by_ascending_keys=
view_sort_by_descending_keys=
view_refresh_keys=116
view_fullscreen_keys=122
view_toggle_ltrrtl_direction_keys=
view_on_top_never_keys=
view_on_top_always_keys=
view_on_top_while_searching_keys=
search_match_case_keys=329
search_match_whole_word_keys=322
search_match_path_keys=341
search_match_diacritics_keys=333
search_enable_regex_keys=338
search_advanced_search_keys=
search_add_to_filters_keys=
search_organize_filters_keys=1350
bookmarks_add_to_bookmarks_keys=324
bookmarks_organize_bookmarks_keys=1346
tools_options_keys=336
tools_console_keys=448
tools_file_list_editor_keys=
tools_connect_to_etp_server_keys=
tools_disconnect_from_etp_server_keys=
help_everything_help_keys=112
help_search_syntax_keys=
help_regex_syntax_keys=
help_command_line_options_keys=
help_everything_website_keys=
help_check_for_updates_keys=
help_about_everything_keys=368
help_donate_keys=
search_edit_focus_search_edit_keys=326,114,580
search_edit_delete_previous_word_keys=4360
search_edit_auto_complete_search_keys=4384
search_edit_show_search_history_keys=
search_edit_show_all_search_history_keys=4646,4648
result_list_item_up_keys=8230,4134
result_list_item_down_keys=8232,4136
result_list_page_up_keys=8225,4129
result_list_page_down_keys=8226,4130
result_list_start_of_list_keys=8228
result_list_end_of_list_keys=8227
result_list_item_up_extend_keys=9254,5158
result_list_item_down_extend_keys=9256,5160
result_list_page_up_extend_keys=9249,5153
result_list_page_down_extend_keys=9250,5154
result_list_start_of_list_extend_keys=9252
result_list_end_of_list_extend_keys=9251
result_list_focus_up_keys=8486,4390
result_list_focus_down_keys=8488,4392
result_list_focus_page_up_keys=8481,4385
result_list_focus_page_down_keys=8482,4386
result_list_focus_start_of_list_keys=8484
result_list_focus_end_of_list_keys=8483
result_list_focus_up_extend_keys=9510,5414
result_list_focus_down_extend_keys=9512,5416
result_list_focus_page_up_extend_keys=9505,5409
result_list_focus_page_down_extend_keys=9506,5410
result_list_focus_start_of_list_extend_keys=9508
result_list_focus_end_of_list_extend_keys=9507
result_list_focus_result_list_keys=
result_list_focus_highest_run_count_result_keys=
result_list_focus_last_run_result_keys=
result_list_toggle_path_column_keys=
result_list_toggle_size_column_keys=
result_list_toggle_extension_column_keys=
result_list_toggle_type_column_keys=
result_list_toggle_date_modified_column_keys=
result_list_toggle_date_created_column_keys=
result_list_toggle_attributes_column_keys=
result_list_toggle_file_list_filename_column_keys=
result_list_toggle_run_count_column_keys=
result_list_toggle_date_recently_changed_column_keys=
result_list_toggle_date_accessed_column_keys=
result_list_toggle_date_run_column_keys=
result_list_size_all_columns_to_fit_keys=8555
result_list_size_result_list_to_fit_keys=
result_list_context_menu_keys=9337
result_list_scroll_left_or_thumbnail_left_keys=8229
result_list_scroll_right_or_thumbnail_right_keys=8231
result_list_scroll_page_left_or_thumbnail_focus_left_keys=8485
result_list_scroll_page_right_or_thumbnail_focus_right_keys=8487
result_list_left_extend_keys=9253
result_list_right_extend_keys=9255
result_list_focus_left_extend_keys=9509
result_list_focus_right_extend_keys=9511
result_list_select_focus_keys=8224
result_list_toggle_focus_selection_keys=8480
result_list_copy_as_csv_keys=
preview_focus_preview_keys=
result_list_font=
result_list_font_size=
search_edit_font=
search_edit_font_size=
status_bar_font=
status_bar_font_size=
header_font=
header_font_size=
normal_background_color=
normal_foreground_color=
normal_bold=
highlighted_background_color=
highlighted_foreground_color=
highlighted_bold=
current_sort_background_color=
current_sort_foreground_color=
current_sort_bold=
current_sort_highlighted_background_color=
current_sort_highlighted_foreground_color=
current_sort_highlighted_bold=
selected_background_color=
selected_foreground_color=
selected_bold=
selected_highlighted_background_color=
selected_highlighted_foreground_color=
selected_highlighted_bold=
selected_inactive_background_color=
selected_inactive_foreground_color=
selected_inactive_bold=
selected_inactive_highlighted_background_color=
selected_inactive_highlighted_foreground_color=
selected_inactive_highlighted_bold=
drop_target_background_color=
drop_target_foreground_color=
drop_target_bold=
drop_target_highlighted_background_color=
drop_target_highlighted_foreground_color=
drop_target_highlighted_bold=
mouseover_background_color=
mouseover_foreground_color=
mouseover_bold=
mouseover_highlighted_background_color=
mouseover_highlighted_foreground_color=
mouseover_highlighted_bold=
mouseover_current_sort_background_color=
mouseover_current_sort_foreground_color=
mouseover_current_sort_bold=
mouseover_current_sort_highlighted_background_color=
mouseover_current_sort_highlighted_foreground_color=
mouseover_current_sort_highlighted_bold=
alternate_row_background_color=
alternate_row_foreground_color=
alternate_row_bold=
alternate_row_highlighted_background_color=
alternate_row_highlighted_foreground_color=
alternate_row_highlighted_bold=
current_sort_alternate_row_background_color=
current_sort_alternate_row_foreground_color=
current_sort_alternate_row_bold=
current_sort_alternate_row_highlighted_background_color=
current_sort_alternate_row_highlighted_foreground_color=
current_sort_alternate_row_highlighted_bold=
hot_background_color=
hot_foreground_color=
hot_bold=
hot_highlighted_background_color=
hot_highlighted_foreground_color=
hot_highlighted_bold=
selected_hot_background_color=
selected_hot_foreground_color=
selected_hot_bold=
selected_hot_highlighted_background_color=
selected_hot_highlighted_foreground_color=
selected_hot_highlighted_bold=
selected_inactive_hot_background_color=
selected_inactive_hot_foreground_color=
selected_inactive_hot_bold=
selected_inactive_hot_highlighted_background_color=
selected_inactive_hot_highlighted_foreground_color=
selected_inactive_hot_highlighted_bold=
thumbnail_mouseover_background_color=
thumbnail_mouseover_foreground_color=
thumbnail_mouseover_bold=
thumbnail_mouseover_highlighted_background_color=
thumbnail_mouseover_highlighted_foreground_color=
thumbnail_mouseover_highlighted_bold=

Binary file not shown.

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing.Constant
{
public class EveryThingConst
{
public const int EVERYTHING_OK = 0;
public const int EVERYTHING_ERROR_MEMORY = 1;
public const int EVERYTHING_ERROR_IPC = 2;
public const int EVERYTHING_ERROR_REGISTERCLASSEX = 3;
public const int EVERYTHING_ERROR_CREATEWINDOW = 4;
public const int EVERYTHING_ERROR_CREATETHREAD = 5;
public const int EVERYTHING_ERROR_INVALIDINDEX = 6;
public const int EVERYTHING_ERROR_INVALIDCALL = 7;
public const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001;
public const int EVERYTHING_REQUEST_PATH = 0x00000002;
public const int EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = 0x00000004;
public const int EVERYTHING_REQUEST_EXTENSION = 0x00000008;
public const int EVERYTHING_REQUEST_SIZE = 0x00000010;
public const int EVERYTHING_REQUEST_DATE_CREATED = 0x00000020;
public const int EVERYTHING_REQUEST_DATE_MODIFIED = 0x00000040;
public const int EVERYTHING_REQUEST_DATE_ACCESSED = 0x00000080;
public const int EVERYTHING_REQUEST_ATTRIBUTES = 0x00000100;
public const int EVERYTHING_REQUEST_FILE_LIST_FILE_NAME = 0x00000200;
public const int EVERYTHING_REQUEST_RUN_COUNT = 0x00000400;
public const int EVERYTHING_REQUEST_DATE_RUN = 0x00000800;
public const int EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED = 0x00001000;
public const int EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME = 0x00002000;
public const int EVERYTHING_REQUEST_HIGHLIGHTED_PATH = 0x00004000;
public const int EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME = 0x00008000;
public const int EVERYTHING_SORT_NAME_ASCENDING = 1;
public const int EVERYTHING_SORT_NAME_DESCENDING = 2;
public const int EVERYTHING_SORT_PATH_ASCENDING = 3;
public const int EVERYTHING_SORT_PATH_DESCENDING = 4;
public const int EVERYTHING_SORT_SIZE_ASCENDING = 5;
public const int EVERYTHING_SORT_SIZE_DESCENDING = 6;
public const int EVERYTHING_SORT_EXTENSION_ASCENDING = 7;
public const int EVERYTHING_SORT_EXTENSION_DESCENDING = 8;
public const int EVERYTHING_SORT_TYPE_NAME_ASCENDING = 9;
public const int EVERYTHING_SORT_TYPE_NAME_DESCENDING = 10;
public const int EVERYTHING_SORT_DATE_CREATED_ASCENDING = 11;
public const int EVERYTHING_SORT_DATE_CREATED_DESCENDING = 12;
public const int EVERYTHING_SORT_DATE_MODIFIED_ASCENDING = 13;
public const int EVERYTHING_SORT_DATE_MODIFIED_DESCENDING = 14;
public const int EVERYTHING_SORT_ATTRIBUTES_ASCENDING = 15;
public const int EVERYTHING_SORT_ATTRIBUTES_DESCENDING = 16;
public const int EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING = 17;
public const int EVERYTHING_SORT_FILE_LIST_FILENAME_DESCENDING = 18;
public const int EVERYTHING_SORT_RUN_COUNT_ASCENDING = 19;
public const int EVERYTHING_SORT_RUN_COUNT_DESCENDING = 20;
public const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_ASCENDING = 21;
public const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_DESCENDING = 22;
public const int EVERYTHING_SORT_DATE_ACCESSED_ASCENDING = 23;
public const int EVERYTHING_SORT_DATE_ACCESSED_DESCENDING = 24;
public const int EVERYTHING_SORT_DATE_RUN_ASCENDING = 25;
public const int EVERYTHING_SORT_DATE_RUN_DESCENDING = 26;
public const int EVERYTHING_TARGET_MACHINE_X86 = 1;
public const int EVERYTHING_TARGET_MACHINE_X64 = 2;
public const int EVERYTHING_TARGET_MACHINE_ARM = 3;
}
}

View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing
{
public class EveryThing32
{
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern UInt32 Everything_SetSearchW(string lpSearchString);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMatchPath(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMatchCase(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMatchWholeWord(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetRegex(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMax(UInt32 dwMax);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetOffset(UInt32 dwOffset);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetMatchPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetMatchCase();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetMatchWholeWord();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetRegex();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetMax();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetOffset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern IntPtr Everything_GetSearchW();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetLastError();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_Query(bool bWait);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SortResultsByPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetNumFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetNumFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetNumResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetTotFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetTotFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetTotResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_IsVolumeResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_IsFolderResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_IsFileResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_Reset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileName(UInt32 nIndex);
// Everything 1.4
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetSort(UInt32 dwSortType);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultListSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultListRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultExtension(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateCreated(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateModified(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateAccessed(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultAttributes(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileListFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultRunCount(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateRun(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateRecentlyChanged(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedPath(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFullPathAndFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_SetRunCountFromFileName(string lpFileName, UInt32 dwRunCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_IncRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_Exit();
}
}

View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing
{
public class EveryThing64
{
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern UInt32 Everything_SetSearchW(string lpSearchString);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMatchPath(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMatchCase(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMatchWholeWord(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetRegex(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMax(UInt32 dwMax);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetOffset(UInt32 dwOffset);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetMatchPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetMatchCase();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetMatchWholeWord();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetRegex();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetMax();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetOffset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern IntPtr Everything_GetSearchW();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetLastError();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_Query(bool bWait);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SortResultsByPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetNumFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetNumFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetNumResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetTotFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetTotFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetTotResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_IsVolumeResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_IsFolderResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_IsFileResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_Reset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileName(UInt32 nIndex);
// Everything 1.4
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetSort(UInt32 dwSortType);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultListSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultListRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultExtension(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateCreated(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateModified(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateAccessed(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultAttributes(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileListFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultRunCount(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateRun(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateRecentlyChanged(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedPath(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFullPathAndFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_SetRunCountFromFileName(string lpFileName, UInt32 dwRunCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_IncRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_Exit();
}
}

View File

@@ -0,0 +1,347 @@
using GeekDesk.Constant;
using GeekDesk.Plugins.EveryThing.Constant;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing
{
public class EveryThingUtil
{
//每次加载20条
private static long pageCount = 20;
private static UInt32 ui = 0;
public static void EnableEveryThing(int delayTime = 2000)
{
string pluginsPath = Constants.PLUGINS_PATH;
bool Is64Bit = Environment.Is64BitOperatingSystem;
string everyThingPath = pluginsPath + "/EveryThing/" + (Is64Bit ? 64 : 32) + "/EveryThing.exe";
string installUtilPath = "C:\\Windows\\Microsoft.NET\\Framework"+ (Is64Bit ? "64" : "") + "\\v4.0.30319\\InstallUtil.exe";
new Thread(() =>
{
try
{
Thread.Sleep(delayTime);
//判断EveryThing服务是否存在
ServiceController sc = GetService("Everything");
if (sc != null)
{
//判断是否启动
if (sc.Status != ServiceControllerStatus.StartPending
&& sc.Status != ServiceControllerStatus.Running)
{
//启动服务
EveryThingService(ServiceType.START);
}
} else
{
//安装服务
EveryThingService(ServiceType.INSTALL);
}
Thread.Sleep(2000);
if (GetService("Everything") != null)
{
//启动程序
Process exeProcess = new Process();
exeProcess.StartInfo.FileName = everyThingPath;
exeProcess.Start();
int waitTime = 5000;
while (true && waitTime > 0)
{
Thread.Sleep(100);
waitTime -= 100;
exeProcess.CloseMainWindow();
}
}
} catch (Exception e)
{
}
}).Start();
}
enum ServiceType
{
START,
STOP,
INSTALL,
UNINSTALL
}
private static void EveryThingService(ServiceType type)
{
string pluginsPath = Constants.PLUGINS_PATH;
bool Is64Bit = Environment.Is64BitOperatingSystem;
string everyThingPath = pluginsPath + "/EveryThing/" + (Is64Bit ? 64 : 32) + "/EveryThing.exe";
Process p = new Process();
p.StartInfo.FileName = everyThingPath;
string arg;
switch(type)
{
default:
p.StartInfo.Verb = "runas";
arg = "-start-service";
break;
case ServiceType.STOP:
arg = "-stop-service";
break;
case ServiceType.INSTALL:
p.StartInfo.Verb = "runas";
arg = "-install-service";
break;
case ServiceType.UNINSTALL:
arg = "-uninstall-service";
break;
}
p.StartInfo.Arguments = arg;
p.Start();
}
public static ServiceController GetService(string serviceName)
{
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController s in services)
{
if (s.ServiceName.ToLower().Equals(serviceName.ToLower()))
{
return s;
}
}
return null;
}
public static void DisableEveryThing(bool uninstall = false)
{
try
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_Exit();
}
else
{
EveryThing32.Everything_Exit();
}
}
catch (Exception e) { }
try
{
if (GetService("Everything") != null)
{
if (uninstall)
{
EveryThingService(ServiceType.UNINSTALL);
}
else
{
EveryThingService(ServiceType.STOP);
}
}
}
catch (Exception e) { }
}
public static bool HasNext()
{
return ui < Everything_GetNumResults();
}
public static ObservableCollection<IconInfo> Search(string text)
{
ui = 0;
//EveryThing全盘搜索
Everything_Reset();
EveryThingUtil.Everything_SetSearchW(text);
EveryThingUtil.Everything_SetRequestFlags(
EveryThingConst.EVERYTHING_REQUEST_FILE_NAME
| EveryThingConst.EVERYTHING_REQUEST_PATH
| EveryThingConst.EVERYTHING_REQUEST_DATE_MODIFIED
| EveryThingConst.EVERYTHING_REQUEST_SIZE);
EveryThingUtil.Everything_SetSort(
EveryThingConst.EVERYTHING_SORT_TYPE_NAME_DESCENDING
| EveryThingConst.EVERYTHING_SORT_RUN_COUNT_DESCENDING
| EveryThingConst.EVERYTHING_SORT_DATE_MODIFIED_DESCENDING
);
EveryThingUtil.Everything_Query(true);
return NextPage();
}
public static ObservableCollection<IconInfo> NextPage()
{
if (ui == 0)
{
pageCount = 40;
} else
{
pageCount = 20;
}
string filePath;
const int bufsize = 260;
StringBuilder buf = new StringBuilder(bufsize);
ObservableCollection<IconInfo> iconBakList = new ObservableCollection<IconInfo>();
for (long count = 0; ui < Everything_GetNumResults() && count < pageCount; count++, ui++)
{
buf.Clear();
EveryThingUtil.Everything_GetResultFullPathName(ui, buf, bufsize);
filePath = buf.ToString();
string tempPath = filePath;
string ext = "";
if (!ImageUtil.IsSystemItem(filePath))
{
ext = System.IO.Path.GetExtension(filePath).ToLower();
}
//if (".lnk".Equals(ext))
//{
// string targetPath = FileUtil.GetTargetPathByLnk(filePath);
// if (targetPath != null)
// {
// filePath = targetPath;
// }
//}
string name = System.IO.Path.GetFileNameWithoutExtension(tempPath);
if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(tempPath))
{
name = tempPath.Substring(tempPath.LastIndexOf("\\"));
}
IconInfo iconInfo = new IconInfo
{
Path_NoWrite = filePath,
LnkPath_NoWrite = tempPath,
BitmapImage_NoWrite = ImageUtil.GetBitmapIconByUnknownPath(filePath),
StartArg_NoWrite = FileUtil.GetArgByLnk(tempPath),
Name_NoWrite = name,
};
//缓存信息 异步加载图标
iconBakList.Add(iconInfo);
}
return iconBakList;
}
public static UInt32 Everything_SetSearchW(string lpSearchString)
{
if (Environment.Is64BitOperatingSystem)
{
return EveryThing64.Everything_SetSearchW(lpSearchString);
} else
{
return EveryThing32.Everything_SetSearchW(lpSearchString);
}
}
public static void Everything_SetRequestFlags(UInt32 dwRequestFlags)
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_SetRequestFlags(dwRequestFlags);
}
else
{
EveryThing32.Everything_SetRequestFlags(dwRequestFlags);
}
}
public static void Everything_SetSort(UInt32 dwSortType)
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_SetSort(dwSortType);
}
else
{
EveryThing32.Everything_SetSort(dwSortType);
}
}
public static bool Everything_Query(bool bWait)
{
if (Environment.Is64BitOperatingSystem)
{
return EveryThing64.Everything_Query(bWait);
}
else
{
return EveryThing32.Everything_Query(bWait);
}
}
public static UInt32 Everything_GetNumResults()
{
if (Environment.Is64BitOperatingSystem)
{
return EveryThing64.Everything_GetNumResults();
}
else
{
return EveryThing32.Everything_GetNumResults();
}
}
public static void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount)
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_GetResultFullPathName(nIndex, lpString, nMaxCount);
}
else
{
EveryThing32.Everything_GetResultFullPathName(nIndex, lpString, nMaxCount);
}
}
public static void Everything_Reset()
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_Reset();
}
else
{
EveryThing32.Everything_Reset();
}
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -124,11 +124,14 @@ namespace ShowSeconds
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (ScreenUtil.IsPrimaryFullScreen()) return;
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
{
try
{
int x = e.X;
int y = e.Y;
@@ -209,7 +212,7 @@ namespace ShowSeconds
}
else
{
BGBorder.Visibility= Visibility.Collapsed;
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
@@ -231,8 +234,11 @@ namespace ShowSeconds
timer.Stop();
}
}
}
catch (Exception e1) { }
}));
}
}

View File

@@ -19,15 +19,15 @@
</Style.Setters>
</Style>
<LinearGradientBrush x:Key="BtnBG" Opacity="0.97">
<LinearGradientBrush x:Key="BtnBG" Opacity="0.7">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
<!--按钮样式-->
<Style x:Key="Btn1" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
<Style x:Key="MyBtnStyle" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
<Setter Property="Background" Value="{StaticResource BtnBG}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#E5E5E2"/>
@@ -36,7 +36,50 @@
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E5E5E2"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush Opacity="1">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
<!--CheckBox样式-->
<Style x:Key="MyCheckBoxStyle" TargetType="CheckBox" BasedOn="{StaticResource CheckBoxBaseStyle}">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0" Opacity="0.6">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0" Opacity="0.6">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0" Opacity="0.7">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
@@ -57,4 +100,40 @@
</Style>
<!--radio btn style-->
<Style x:Key="MyRadioBtnStyle" TargetType="RadioButton" BasedOn="{StaticResource RadioButtonIcon}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.7"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="1"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
<!--text box style-->
<Style x:Key="MyTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource TextBoxBaseStyle}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.7"/>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderThickness" Value="0" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@@ -33,6 +33,8 @@ namespace GeekDesk.Task
private static void Check(object source, ElapsedEventArgs e)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
try
{
if (MainWindow.appData.ToDoList.Count > 0)
{
@@ -46,6 +48,8 @@ namespace GeekDesk.Task
}
}
}
}
catch (Exception e1) { }
//ClearMemory();
}));
}

View File

@@ -1,9 +1,10 @@
{
"title": "GeekDesk版本更新",
"subTitle": "V2.5.13",
"subTitle": "V2.5.14",
"msgTitle": "本次更新内容如下",
"msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '更改一下Logo', '其它已知问题修复']",
"msg": "['好久不见, 别来无恙, 辞职回老家了, 突然换了新环境有点不适应, 目前还处于工作中的迷茫期, 祝我们大家全都前程似锦', 'GeekDesk准备冲击一下Gitee GVP, 希望大家能给我点一下码云(Gitee)和GitHub的star❤❤❤', '之后我会抽时间编写一下开发者文档, 方便大家更清楚的了解项目结构, 从而有更多的人参与进来开发(一直没有编写是因为太懒了), 不多说了, 看下这次更新内容吧', '集成Everything搜索,设置-->其它-->勾选Everything插件开启', '增加了关联文件夹功能, 右键点击左侧栏-->新建关联菜单', '增加强制置顶开关,设置-->显示设置-->勾选/取消 置于顶层', '右侧栏图标列表增加了自适应列宽, 不会出现图标显示一半的情况了', '简单添加了新手引导提示', '加密菜单bug修复 By @1062406901', '多显示器拾色器bug修复 By @1062406901', '拖动图标到菜单的异常修复 By @Hsxxxxxx', '优化部分UI', '其它bug修复及功能优化','关注微信公众号\\'抓几个娃\\'可以第一时间收到更新通知(公众号也是佛系维护, 希望能关注的人多一点吧, 让作者这个穷B挣口饭吃)']",
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
"version": "2.5.13"
"statisticUrl": "http://43.138.23.39:8989/bookerService/geekDeskController/userCountStatistic",
"version": "2.5.14"
}

View File

@@ -45,7 +45,6 @@ namespace GeekDesk.Util
else
{
LinearGradientBrush lgb = new LinearGradientBrush();
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
GradientStop gs = new GradientStop
{
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
@@ -60,6 +59,7 @@ namespace GeekDesk.Util
Offset = 1
};
lgb.GradientStops.Add(gs2);
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
MainWindow.mainWindow.BGBorder.Background = lgb;
}

View File

@@ -43,6 +43,12 @@ namespace GeekDesk.Util
{
BinaryFormatter bf = new BinaryFormatter();
appData = bf.Deserialize(fs) as AppData;
//将菜单密码写入文件
if (!string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
SavePassword(appData.AppConfig.MenuPassword);
}
}
}
catch
@@ -124,6 +130,41 @@ namespace GeekDesk.Util
}
}
private static string GeneraterUUID()
{
try
{
if (!File.Exists(Constants.UUID_FILE_BAK_PATH) || string.IsNullOrEmpty(GetUniqueUUID()))
{
using (StreamWriter sw = new StreamWriter(Constants.UUID_FILE_BAK_PATH))
{
string uuid = Guid.NewGuid().ToString() + "-" + Constants.MY_UUID;
sw.Write(uuid);
return uuid;
}
}
} catch (Exception) { }
return "ERROR_UUID_GeneraterUUID_" + Constants.MY_UUID;
}
public static string GetUniqueUUID()
{
try
{
if (File.Exists(Constants.UUID_FILE_BAK_PATH))
{
using (StreamReader reader = new StreamReader(Constants.UUID_FILE_BAK_PATH))
{
return reader.ReadToEnd().Trim();
}
} else
{
return GeneraterUUID();
}
} catch(Exception) { }
return "ERROR_UUID_GetUniqueUUID_" + Constants.MY_UUID;
}
public static void BakAppData()
{
@@ -249,10 +290,13 @@ namespace GeekDesk.Util
/// <summary>
/// 排序图标
/// </summary>
public static void SortIconList()
{
try
{
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM)
{
@@ -282,6 +326,9 @@ namespace GeekDesk.Util
MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList;
}
}
catch (Exception) { }
}

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using File = System.IO.File;
namespace GeekDesk.Util
{
@@ -45,17 +46,22 @@ namespace GeekDesk.Util
/// <returns></returns>
public static string GetArgByLnk(string filePath)
{
//return "";
try
{
WshShell shell = new WshShell();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
if (File.Exists(filePath))
{
object shortcutObj = shell.CreateShortcut(filePath);
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shortcutObj;
return shortcut.Arguments;
}
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
return "";
//LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
}
return "";
}
/// <summary>

174
Util/FileWatcher.cs Normal file
View File

@@ -0,0 +1,174 @@
using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class FileWatcher
{
public static Dictionary<FileSystemWatcher, MenuInfo> linkMenuMap = new Dictionary<FileSystemWatcher, MenuInfo>();
/// <summary>
/// 实时文件夹监听
/// </summary>
/// <param name="path"></param>
public static void LinkMenuWatcher(MenuInfo menuInfo)
{
try
{
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher
{
Path = menuInfo.LinkPath,
};
linkMenuMap.Add(fileSystemWatcher, menuInfo);
fileSystemWatcher.EnableRaisingEvents = true;
fileSystemWatcher.Changed += LinkIcon_Changed;
fileSystemWatcher.Deleted += LinkIcon_Deleted;
fileSystemWatcher.Created += LinkIcon_Created;
fileSystemWatcher.Renamed += LinkIcon_Renamed;
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, "添加LinkMenu监听异常");
}
}
private static void LinkIcon_Renamed(object sender, RenamedEventArgs e)
{
IconInfo iconInfo = getIconInfoByPath(sender, e.OldFullPath);
iconInfo.Name = e.Name;
iconInfo.Path = e.FullPath;
}
private static void LinkIcon_Changed(object sender, FileSystemEventArgs e)
{
IconInfo iconInfo = getIconInfoByPath(sender, e.FullPath);
if (iconInfo != null)
{
IconInfo newIconInfo = CommonCode.GetIconInfoByPath(e.FullPath);
iconInfo.BitmapImage = newIconInfo.BitmapImage;
}
}
private static void LinkIcon_Deleted(object sender, FileSystemEventArgs e)
{
IconInfo iconInfo = getIconInfoByPath(sender, e.FullPath);
App.Current.Dispatcher.Invoke(() =>
{
linkMenuMap[sender as FileSystemWatcher].IconList.Remove(iconInfo);
});
}
private static void LinkIcon_Created(object sender, FileSystemEventArgs e)
{
IconInfo iconInfo = CommonCode.GetIconInfoByPath(e.FullPath);
App.Current.Dispatcher.Invoke(() =>
{
linkMenuMap[sender as FileSystemWatcher].IconList.Add(iconInfo);
});
}
private static IconInfo getIconInfoByPath(object sender, string path)
{
MenuInfo menuInfo = linkMenuMap[sender as FileSystemWatcher];
foreach (IconInfo iconInfo in menuInfo.IconList)
{
if (iconInfo.Path.Equals(path))
{
return iconInfo;
}
}
return null;
}
/// <summary>
/// 开启所有菜单监听
/// </summary>
/// <param name="appData"></param>
public static void EnableLinkMenuWatcher(AppData appData)
{
foreach (MenuInfo menuInfo in appData.MenuList)
{
if (menuInfo.MenuType == Constant.MenuType.LINK)
{
LinkMenuWatcher(menuInfo);
}
}
RefreshLinkMenuIcon(appData);
}
private static void RefreshLinkMenuIcon(AppData appData)
{
new Thread(() =>
{
try
{
foreach (MenuInfo menuInfo in appData.MenuList)
{
if (menuInfo.MenuType == Constant.MenuType.LINK)
{
DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath);
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
foreach (FileSystemInfo fileInfo in fileInfos)
{
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
iconList.Add(iconInfo);
}
App.Current.Dispatcher.Invoke(() =>
{
foreach (IconInfo iconInfo in iconList)
{
menuInfo.IconList = null;
menuInfo.IconList = iconList;
}
});
}
}
}
catch (Exception) { }
}).Start();
}
/// <summary>
/// 移除菜单监听
/// </summary>
/// <param name="menuInfo"></param>
public static void RemoveLinkMenuWatcher(MenuInfo menuInfo)
{
try
{
foreach (FileSystemWatcher watcher in linkMenuMap.Keys)
{
if (linkMenuMap[watcher] == menuInfo)
{
//释放资源
watcher.Changed -= LinkIcon_Changed;
watcher.Created -= LinkIcon_Created;
watcher.Deleted -= LinkIcon_Deleted;
watcher.Renamed -= LinkIcon_Renamed;
watcher.EnableRaisingEvents = false;
watcher.Dispose();
linkMenuMap.Remove(watcher);
}
}
}
catch (Exception e)
{
//nothing
}
}
}
}

View File

@@ -20,6 +20,7 @@ namespace GeekDesk.Util
/// <returns></returns>
public static BitmapImage ByteArrToImage(byte[] array)
{
if (array == null) return null;
using (var ms = new System.IO.MemoryStream(array))
{
BitmapImage image = new BitmapImage();
@@ -39,6 +40,7 @@ namespace GeekDesk.Util
/// <returns></returns>
public static byte[] BitmapImageToByte(BitmapImage bi)
{
if (bi == null) return null;
using (MemoryStream memStream = new MemoryStream())
{
PngBitmapEncoder encoder = new PngBitmapEncoder();
@@ -119,6 +121,34 @@ namespace GeekDesk.Util
}
public static BitmapImage GetBitmapIconByUnknownPath(string path)
{
//string base64 = ImageUtil.FileImageToBase64(path, System.Drawing.Imaging.ImageFormat.Png);
string ext = "";
if (!ImageUtil.IsSystemItem(path))
{
ext = System.IO.Path.GetExtension(path).ToLower();
}
string iconPath = null;
if (".lnk".Equals(ext))
{
string targetPath = FileUtil.GetTargetPathByLnk(path);
iconPath = FileUtil.GetIconPathByLnk(path);
if (targetPath != null)
{
path = targetPath;
}
}
if (StringUtil.IsEmpty(iconPath))
{
iconPath = path;
}
return ImageUtil.GetBitmapIconByPath(iconPath);
}
/// <summary>
///
/// </summary>
@@ -173,6 +203,10 @@ namespace GeekDesk.Util
{
try
{
FileInfo file = new FileInfo(filePath);
if (file.Exists && file.Length > 0
&& !System.IO.Path.GetExtension(filePath).Contains("psd"))
{
Image img = Image.FromFile(filePath);
if (img.Width <= tWidth && img.Height <= tHeight)
@@ -217,6 +251,10 @@ namespace GeekDesk.Util
File.Delete(tempPath);
return bm;
}
} else
{
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
}
}
catch (Exception e)
{
@@ -334,6 +372,9 @@ namespace GeekDesk.Util
public static bool IsImage(string path)
{
try
{
string ext = Path.GetExtension(path);
if (!string.IsNullOrEmpty(ext))
{
string strExt = Path.GetExtension(path).Substring(1);
string suffixs = "bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp,avif";
@@ -345,6 +386,7 @@ namespace GeekDesk.Util
return true;
}
}
}
return false;
}
catch (Exception)

277
Util/ProcessUtil.cs Normal file
View File

@@ -0,0 +1,277 @@
using GeekDesk.Constant;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class ProcessUtil
{
public static void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
{
App.Current.Dispatcher.Invoke(() =>
{
try
{
using (Process p = new Process())
{
string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{
StartSystemApp(startArg, type);
}
else
{
string path;
if (useRelativePath)
{
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
path = Path.GetFullPath(fullPath);
}
else
{
path = icon.Path;
}
p.StartInfo.FileName = path;
if (!StringUtil.IsEmpty(startArg))
{
p.StartInfo.Arguments = startArg;
}
if (icon.IconType == IconType.OTHER)
{
if (!File.Exists(path) && !Directory.Exists(path))
{
//如果没有使用相对路径 那么使用相对路径启动一次
if (!useRelativePath)
{
StartIconApp(icon, type, true);
return;
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return;
}
}
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
switch (type)
{
case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas";
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
//p.StartInfo.ErrorDialog = false;
if (MainWindow.appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;// c#好像不能case穿透
case IconStartType.DEFAULT_STARTUP:
if (MainWindow.appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;
case IconStartType.SHOW_IN_EXPLORE:
p.StartInfo.FileName = "Explorer.exe";
p.StartInfo.Arguments = "/e,/select," + icon.Path;
break;
}
}
else
{
if (MainWindow.appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
}
p.Start();
if (useRelativePath)
{
//如果使用相对路径启动成功 那么重新设置程序绝对路径
icon.Path = path;
}
}
}
icon.Count++;
//隐藏搜索框
if (RunTimeStatus.SEARCH_BOX_SHOW)
{
MainWindow.mainWindow.HidedSearchBox();
}
}
catch (Exception e)
{
if (!useRelativePath)
{
StartIconApp(icon, type, true);
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(可能为不支持的启动方式)!");
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
}
}
});
}
private static void StartSystemApp(string startArg, IconStartType type)
{
if (type == IconStartType.SHOW_IN_EXPLORE)
{
Growl.WarningGlobal("系统项目不支持打开文件位置操作!");
return;
}
switch (startArg)
{
case "Calculator":
Process.Start("calc.exe");
break;
case "Computer":
Process.Start("explorer.exe");
break;
case "GroupPolicy":
Process.Start("gpedit.msc");
break;
case "Notepad":
Process.Start("notepad");
break;
case "Network":
Process.Start("ncpa.cpl");
break;
case "RecycleBin":
Process.Start("shell:RecycleBinFolder");
break;
case "Registry":
Process.Start("regedit.exe");
break;
case "Mstsc":
if (type == IconStartType.ADMIN_STARTUP)
{
Process.Start("mstsc", "-admin");
}
else
{
Process.Start("mstsc");
}
break;
case "Control":
Process.Start("Control");
break;
case "CMD":
if (type == IconStartType.ADMIN_STARTUP)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
}
}
else
{
Process.Start("cmd");
}
break;
case "Services":
Process.Start("services.msc");
break;
}
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
[Flags]
private enum ProcessAccessFlags : uint
{
QueryLimitedInformation = 0x00001000
}
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool QueryFullProcessImageName(
[In] IntPtr hProcess,
[In] int dwFlags,
[Out] StringBuilder lpExeName,
ref int lpdwSize);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr OpenProcess(
ProcessAccessFlags processAccess,
bool bInheritHandle,
int processId);
public static String GetProcessFilename(Process p)
{
int capacity = 2000;
StringBuilder builder = new StringBuilder(capacity);
IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity))
{
return String.Empty;
}
return builder.ToString();
}
}
}

167
Util/WindowUtil.cs Normal file
View File

@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Interop;
namespace GeekDesk.Util
{
public class WindowUtil
{
public enum GetWindowCmd : uint
{
GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,
GW_HWNDNEXT = 2,
GW_HWNDPREV = 3,
GW_OWNER = 4,
GW_CHILD = 5,
GW_ENABLEDPOPUP = 6
}
[Flags]
public enum SetWindowPosFlags
{
SWP_NOSIZE = 0x0001,
SWP_NOMOVE = 0x0002,
SWP_NOZORDER = 0x0004,
SWP_NOREDRAW = 0x0008,
SWP_NOACTIVATE = 0x0010,
SWP_FRAMECHANGED = 0x0020,
SWP_SHOWWINDOW = 0x0040,
SWP_HIDEWINDOW = 0x0080,
SWP_NOCOPYBITS = 0x0100,
SWP_NOOWNERZORDER = 0x0200,
SWP_NOSENDCHANGING = 0x0400
}
//取得前台窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
//取得桌面窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetWindow(HandleRef hWnd, int nCmd);
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr child, IntPtr parent);
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr window, IntPtr handle);
[DllImport("user32.dll")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_STYLE = -16;
private const int WS_MAXIMIZEBOX = 0x10000;
public static void DisableMaxWindow(Window window)
{
var hwnd = new WindowInteropHelper(window).Handle;
var value = GetWindowLong(hwnd, GWL_STYLE);
SetWindowLong(hwnd, GWL_STYLE, (int)(value & ~WS_MAXIMIZEBOX));
}
public static void SetOwner(Window window, Window parentWindow)
{
SetOwner(window, new WindowInteropHelper(parentWindow).Handle);
}
public static void SetOwner(Window window, IntPtr parentHandle)
{
WindowInteropHelper helper = new WindowInteropHelper(window);
helper.Owner = parentHandle;
}
/// <summary>
///
/// </summary>
/// <param name="window"></param>
/// <returns></returns>
public static bool WindowIsTop(Window window)
{
IntPtr handle = new WindowInteropHelper(window).Handle;
IntPtr deskHandle = GetDesktopHandle(window, DesktopLayer.Progman);
IntPtr topHandle = GetForegroundWindow();
//暂时不能正确获取桌面handle 但发现焦点在桌面时 window title为空
string windowTitle = GetWindowTitle(topHandle);
return topHandle.Equals(handle) || topHandle.Equals(deskHandle) || string.IsNullOrEmpty(windowTitle);
}
private static string GetWindowTitle(IntPtr handle)
{
const int nChars = 256;
StringBuilder Buff = new StringBuilder(nChars);
if (GetWindowText(handle, Buff, nChars) > 0)
{
return Buff.ToString();
}
return null;
}
public const int GW_CHILD = 5;
public static IntPtr GetDesktopHandle(Window window, DesktopLayer layer)
{
HandleRef hWnd;
IntPtr hDesktop = new IntPtr();
switch (layer)
{
case DesktopLayer.Progman:
hDesktop = FindWindow("Progman", null);//第一层桌面
break;
case DesktopLayer.SHELLDLL:
hDesktop = FindWindow("Progman", null);//第一层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第2层桌面
break;
case DesktopLayer.FolderView:
hDesktop = FindWindow("Progman", null);//第一层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第2层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第3层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第4层桌面
break;
}
return hDesktop;
}
}
public enum DesktopLayer
{
Progman = 0,
SHELLDLL = 1,
FolderView = 2
}
}

View File

@@ -105,6 +105,39 @@ namespace GeekDesk.ViewModel
private bool? secondsWindow; //秒数窗口 默认打开
private bool? enableEveryThing;
private bool? alwaysTopmost;
public bool? AlwaysTopmost
{
get
{
if (alwaysTopmost == null) alwaysTopmost = false;
return alwaysTopmost;
}
set
{
alwaysTopmost = value;
OnPropertyChanged("AlwaysTopmost");
}
}
public bool? EnableEveryThing
{
get
{
if (enableEveryThing == null) enableEveryThing = false;
return enableEveryThing;
}
set
{
enableEveryThing = value;
OnPropertyChanged("EnableEveryThing");
}
}
#region GetSet
public bool? SecondsWindow

View File

@@ -283,6 +283,7 @@ namespace GeekDesk.ViewModel
{
bitmapImage = value;
ImageByteArr_NoWrite = ImageUtil.BitmapImageToByte(bitmapImage);
OnPropertyChanged("BitmapImage_NoWrite");
}
}
@@ -346,8 +347,11 @@ namespace GeekDesk.ViewModel
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
if (propertyName!=null && propertyName.Contains("NoWrite"))
{
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}
}
}

View File

@@ -21,8 +21,36 @@ namespace GeekDesk.ViewModel
private string geometryColor; //几何图标颜色
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
private bool isEncrypt; //是否加密
private MenuType menuType; //菜单类型 普通, 关联
private string linkPath; //关联路径
public string LinkPath
{
get
{
return linkPath;
}
set
{
linkPath = value;
OnPropertyChanged("LinkPath");
}
}
public MenuType MenuType
{
get
{
return menuType;
}
set
{
menuType = value;
OnPropertyChanged("MenuType");
}
}
public bool IsEncrypt
{
get

View File

@@ -13,7 +13,7 @@ namespace GeekDesk.ViewModel.Temp
//gradientBGParams = (ObservableCollection<GradientBGParam>)ConfigurationManager.GetSection("SystemBGs")
gradientBGParams = new ObservableCollection<GradientBGParam>
{
new GradientBGParam("魅惑妖术", "#FFDDE1", "#EE9CA7"),
new GradientBGParam("魅惑妖术", "#EE9CA7", "#FFDDE1"),
new GradientBGParam ("森林之友", "#EBF7E3", "#A8E4C0"),
new GradientBGParam("完美谢幕", "#D76D77", "#FFAF7B")
};

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class GuideInfoList
{
public static ObservableCollection<GuideInfo> mainWindowGuideList = new ObservableCollection<GuideInfo>();
static GuideInfoList()
{
GuideInfo guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "图标列表区",
GuideText = "右侧高亮区域是图标列表区, 将文件拖动到图标列表区将自动创建快捷方式, 或者鼠标右键单击添加系统项目"
};
mainWindowGuideList.Add(guideInfo);
guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "菜单栏",
GuideText = "左侧高亮区域是菜单栏, 右键单击左侧区域可以创建菜单, 右键单击菜单可以对菜单进行操作"
};
mainWindowGuideList.Add(guideInfo);
guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "拖动区域",
GuideText = "左键按住上部高亮区域可以拖动程序窗体"
};
mainWindowGuideList.Add(guideInfo);
guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "设置和关闭",
GuideText = "高亮区域的两个按钮分别是设置和关闭按钮, 你可以点击设置按钮重新打开引导提示, 设置窗口中可自定义开启或关闭众多功能, 赶紧探索使用吧"
};
mainWindowGuideList.Add(guideInfo);
}
public class GuideInfo
{
private string title1;
private string title2;
private string guideText;
public string Title1 { get; set; }
public string Title2 { get; set; }
public string GuideText { get; set; }
}
public enum GuidePopOffect
{
TOP,
INNER_TOP,
LEFT,
INNER_LEFT,
CENTER,
RIGHT,
INNER_RIGHT,
BOTTOM,
INNER_BOTTOM
}
}
}

View File

@@ -21,8 +21,15 @@ namespace GeekDesk.ViewModel.Temp
}
}
public static void RemoveAll()
{
while (IconList.Count > 0)
{
IconList.RemoveAt(IconList.Count - 1);
}
}
public static event PropertyChangedEventHandler PropertyChanged;
private static event PropertyChangedEventHandler PropertyChanged;
private static void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
@@ -18,48 +18,41 @@
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
@@ -75,5 +68,4 @@
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@@ -19,5 +19,6 @@
<package id="System.Reactive" version="5.0.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="WindowsAPICodePack.Shell.CommonFileDialogs" version="1.1.5" targetFramework="net472" />
<package id="XamlFlair.WPF" version="1.2.13" targetFramework="net472" />
</packages>