9 Commits

Author SHA1 Message Date
BookerLiu
4f65c303a0 🐛 2.5.12 2022-08-29 16:47:33 +08:00
BookerLiu
6ae4312bdf 修改文字 2022-08-02 17:47:03 +08:00
BookerLiu
001270e4ad ♻️ 优化滚动条动画 :boom:增加触底切换菜单 2022-08-02 17:28:09 +08:00
BookerLiu
aa2ca80822 🐛 修复缩放屏幕截图bug 2022-07-27 17:14:57 +08:00
BookerLiu
43314a3006 🐛 修复缩放屏幕截图bug 2022-07-27 17:13:45 +08:00
BookerLiu
a682f27223 Merge branch 'master' of https://github.com/BookerLiu/GeekDesk into 2.5.12 2022-07-27 17:06:21 +08:00
BookerLiu
a50d88f2c2 🐛 1修复程序崩溃, :boom:2添加时钟显秒 2022-07-25 17:57:57 +08:00
BookerLiu
6f62e6b2a0 Merge remote-tracking branch 'origin/master' into 2.5.12 2022-07-20 17:25:57 +08:00
BookerLiu
bf4111cc81 Merge remote-tracking branch 'origin/master' into 2.5.12 2022-07-20 17:22:07 +08:00
108 changed files with 1732 additions and 8117 deletions

View File

@@ -10,7 +10,7 @@
<add key="Version" value="1.0.01" />
<add key="LProportion" value="0.82" />
<add key="TProportion" value="0.03" />
<add key="DelayTime" value="1500" />
<add key="DelayTime" value="800" />
</ShowSecondsSettings>
<SystemIcons>
<add key="Calculator" value="计算器" />
@@ -28,60 +28,59 @@
<SystemBGs>
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏" />
</SystemBGs>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="Version" value="2.5.15" />
<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" />
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
<!--<add key="GiteeUpdateUrl" value="file:///D:/WorkSpace/VS/GeekDesk/Update.json" />-->
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
<add key="ShowPublicWeChat" value="Y" />
<add key="BakDays" value="7" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="Version" value="2.5.12" />
<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" />
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
<!--<add key="GiteeUpdateUrl" value="file:///D:/WorkSpace/workspace-VS/GeekDesk/Update.json" />-->
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
<add key="ShowPublicWeChat" value="Y" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>

View File

@@ -1,14 +1,8 @@
using GeekDesk.Constant;
using GeekDesk.MyThread;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Threading;
namespace GeekDesk
@@ -26,13 +20,10 @@ namespace GeekDesk
this.Startup += new StartupEventHandler(App_Startup);
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
SystemEvents.PowerModeChanged += OnPowerModeChanged;
}
private void App_Startup(object sender, StartupEventArgs e)
{
//RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly; //禁用硬件加速
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
if (!ret)
{
@@ -49,25 +40,6 @@ namespace GeekDesk
}
}
//电源监听
private void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
switch (e.Mode)
{
case PowerModes.Resume:
// 系统从休眠状态唤醒
LogUtil.WriteLog("System resumed from sleep.");
ProcessUtil.ReStartApp();
break;
case PowerModes.Suspend:
// 系统进入休眠状态
LogUtil.WriteLog("System is going to sleep.");
break;
}
}
void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;//使用这一行代码告诉运行时该异常被处理了不再作为UnhandledException抛出了。
@@ -82,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

@@ -22,15 +22,9 @@ namespace GeekDesk.Constant
/// <summary>
/// 备份文件路径
/// </summary>
public static string DATA_FILE_BAK_DIR_PATH = APP_DIR + "bak"; //app备份数据文件路径
public static string DATA_FILE_TEMP_DIR_PATH = APP_DIR + "temp"; //app临时缓存文件路径
//public static string DATA_FILE_BAK_PATH = DATA_FILE_BAK_DIR_PATH + "\\Data.bak"; //app备份数据文件路径
public static string DATA_FILE_BAK_PATH = APP_DIR + "bak\\Data.bak"; //app备份数据文件路径
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
public static string UUID_FILE_BAK_PATH = APP_DIR + "bak\\uuid.txt"; //uuid文件路径
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log"; //日志文件

View File

@@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{
public class DictConst
{
public static readonly Dictionary<bool, string> batchMenuHeaderDict = new Dictionary<bool, string>();
static DictConst() {
batchMenuHeaderDict.Add(true, "取消批量操作");
batchMenuHeaderDict.Add(false, "批量操作");
}
}
}

View File

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

View File

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

View File

@@ -1,34 +0,0 @@
<Border x:Class="GeekDesk.Control.Other.BGNmaeDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts"
CornerRadius="4"
Width="350"
Height="160"
Style="{StaticResource BorderBG}"
>
<Border.Resources>
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
<Setter Property="Width" Value="75"/>
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="5,8,0,0"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
</Border.Resources>
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
<StackPanel>
<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="BGName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Click="Save" Margin="265,10,0,0"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>
</Border>

View File

@@ -1,42 +0,0 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
using System.Windows;
using System.Windows.Media.Imaging;
namespace GeekDesk.Control.Other
{
/// <summary>
/// TextDialog.xaml 的交互逻辑
/// </summary>
public partial class BGNmaeDialog
{
public HandyControl.Controls.Dialog dialog;
public BGNmaeDialog()
{
InitializeComponent();
}
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Save(object sender, RoutedEventArgs e)
{
GradientBGParam bg = new GradientBGParam();
bg.Id = Guid.NewGuid().ToString();
bg.Name = BGName.Text;
bg.Color1 = MainWindow.appData.AppConfig.GradientBGParam.Color1;
bg.Color2 = MainWindow.appData.AppConfig.GradientBGParam.Color2;
MainWindow.appData.AppConfig.CustomBGParams.Add(bg);
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
dialog.Close();
}
}
}

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" Style="{StaticResource MyTextBoxStyle}" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
<hc:TextBox x:Name="DelayTime" 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 Style="{StaticResource MyBtnStyle}" Content="推迟提醒" Click="DelayButton_Click"/>
<Button Content="推迟提醒" Click="DelayButton_Click"/>
</hc:UniformSpacingPanel>
<Button Style="{StaticResource MyBtnStyle}" Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
<Button 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" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
<TextBox x:Name="IconUrl" 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" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
<TextBox x:Name="JsonUrl" 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 Style="{StaticResource MyBtnStyle}" Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
<Button Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
/>
<Button Content="教程" Click="Teach_Click"
Style="{StaticResource MyBtnStyle}"/>
Style="{StaticResource Btn1}"/>
<Button Content="保存" Click="Confirm_Click"
Command="hc:ControlCommands.Close"
Style="{StaticResource MyBtnStyle}"/>
Style="{StaticResource Btn1}"/>
</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 Style="{StaticResource MyBtnStyle}" Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
<Button Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
</Grid>
</Border>

View File

@@ -20,27 +20,19 @@
Width="600"
Height="400"
Margin="0,-620,0,0">
<Border Style="{StaticResource BorderBG}">
<Grid>
<TextBlock Text="提示: 右键点击可以删除自定义的背景颜色哦" Foreground="Gray" HorizontalAlignment="Center" Margin="0,5,0,0"/>
<ListBox x:Name="GradientBGs"
ItemsSource="{Binding}"
Background="Transparent"
Margin="20,20,20,50"
BorderThickness="0"
>
<ListBox.Resources>
<ContextMenu x:Key="CMDialog" Width="200">
<MenuItem Header="删除" Click="Delete" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
ItemsSource="{Binding}"
Background="Transparent"
Margin="20,20,20,50"
BorderThickness="0"
>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="ContextMenu" Value="{StaticResource CMDialog}"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
@@ -48,7 +40,6 @@
<WrapPanel Background="Transparent"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="4" Width="100" Height="100"
@@ -72,7 +63,7 @@
</ListBox>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<Button Content="关闭" Style="{StaticResource MyBtnStyle}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
<Button Content="关闭" Style="{StaticResource Btn1}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
</hc:UniformSpacingPanel>
</Grid>
</Border>

View File

@@ -1,8 +1,6 @@
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -18,13 +16,7 @@ namespace GeekDesk.Control.Other
public GradientBGDialog()
{
ObservableCollection<GradientBGParam> bgArr = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams);
foreach(var bg in MainWindow.appData.AppConfig.CustomBGParams)
{
bgArr.Add(bg);
}
this.DataContext = DeepCopyUtil.DeepCopy(bgArr);
this.DataContext = GradientBGParamList.GradientBGParams;
InitializeComponent();
}
@@ -53,38 +45,8 @@ namespace GeekDesk.Control.Other
}
}
private void Delete(object sender, RoutedEventArgs e)
{
HandyControl.Controls.Growl.Ask("确认删除吗?", isConfirmed =>
{
if (isConfirmed)
{
GradientBGParam bg = (GradientBGParam)(((MenuItem)sender).Tag);
ObservableCollection<GradientBGParam> bgArr = (ObservableCollection<GradientBGParam>)this.DataContext;
bgArr.Remove(bg);
MainWindow.appData.AppConfig.CustomBGParams.Remove(bg);
for (int i = MainWindow.appData.AppConfig.CustomBGParams.Count - 1; i >= 0; i--)
{
var cbg = MainWindow.appData.AppConfig.CustomBGParams[i];
if (cbg.Id == null)
{
if (cbg.Color1.Equals(bg.Color1) && cbg.Color2.Equals(bg.Color2))
{
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
}
} else
{
if (cbg.Id.Equals(bg.Id))
{
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
}
}
}
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
}
return true;
}, "ConfigWindowAskGrowl");
}
}
}

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" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
<TextBox x:Name="IconName" 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,19 +40,24 @@
<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 Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
<Button Content="修改" Click="EditImage"/>
<Button Content="重置" Click="ReStoreImage"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="4,15,0,0">
<CheckBox x:Name="IconIsAdmin" Style="{StaticResource MyCheckBoxStyle}"
Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}"/>
<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>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="StartArg" Style="{StaticResource MyTextBoxStyle}" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
<TextBox x:Name="StartArg" 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 MyBtnStyle}" Click="SaveProperty" Margin="265,10,0,0"/>
<Button Content="保存" Style="{StaticResource Btn1}" 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" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
<TextBox x:Name="IconName" 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" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
<TextBox x:Name="IconUrl" 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 Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
<Button Content="修改" Click="EditImage"/>
<Button Content="重置" Click="ReStoreImage"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10">
<Button Content="保存" Click="SaveProperty" Style="{StaticResource MyBtnStyle}" Margin="224,-10,-224,0" />
<Button Content="保存" Click="SaveProperty" Style="{StaticResource Btn1}" Margin="224,-10,-224,0" />
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>

View File

@@ -1,5 +1,4 @@
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Reflection;
@@ -65,15 +64,14 @@ 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 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
appConfig.GradientBGParam.Color1 = scb.ToString(); break;
case ColorType.COLOR_2:
appConfig.GradientBGParam.Color2 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
default:
appConfig.TextColor = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
appConfig.TextColor = scb.ToString(); 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 Style="{StaticResource MyTextBoxStyle}" x:Name="HintBox" TextAlignment="Left" Width="220"/>
<hc:TextBox 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,7 +105,6 @@ namespace GeekDesk.Control.Other
if (!string.IsNullOrEmpty(appData.AppConfig.PasswordHint))
{
//显示提示信息
HintMsg.Text = "提示: " + appData.AppConfig.PasswordHint;
HintMsg.Visibility = Visibility.Visible;
}
}
@@ -170,33 +169,25 @@ namespace GeekDesk.Control.Other
new Thread(() =>
{
Thread.Sleep(time);
try
Dispatcher.Invoke(() =>
{
Dispatcher.Invoke(() =>
if (string.IsNullOrEmpty(P1.Password))
{
try
{
if (string.IsNullOrEmpty(P1.Password))
{
P1.Focus();
return;
}
if (string.IsNullOrEmpty(P2.Password))
{
P2.Focus();
return;
}
if (string.IsNullOrEmpty(P3.Password))
{
P3.Focus();
return;
}
P4.Focus();
}
catch (Exception ex) { }
});
}
catch (Exception e2) { }
P1.Focus();
return;
}
if (string.IsNullOrEmpty(P2.Password))
{
P2.Focus();
return;
}
if (string.IsNullOrEmpty(P3.Password))
{
P3.Focus();
return;
}
P4.Focus();
});
}).Start();
}

View File

@@ -1,196 +0,0 @@
<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

@@ -1,331 +0,0 @@
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,11 +48,10 @@
<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>
@@ -80,10 +79,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 MyRadioBtnStyle}" Content="Gitee"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>-->
</StackPanel>

View File

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

View File

@@ -47,7 +47,7 @@ namespace GeekDesk.Control.UserControls.Config
if (!CheckIsEnable(hkType)) return;
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
{
if (hotkeyFinished)
@@ -342,8 +342,7 @@ namespace GeekDesk.Control.UserControls.Config
if (true == appConfig.EnableAppHotKey)
{
MainWindow.RegisterHotKey(false);
}
else
} else
{
if (MainWindow.hotKeyId != -1)
{

View File

@@ -20,71 +20,75 @@
<StackPanel >
<TextBlock Text="程序设置" />
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click"/>
<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>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<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="Top"
/>
<CheckBox Content="性能模式" 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:UniformSpacingPanel>
<TextBlock Text="插件" Margin="0,20,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<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="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"
/>
<CheckBox Content="时钟显秒" 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: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"
Style="{StaticResource MyRadioBtnStyle}" Content="自定义"
<RadioButton x:Name="CustomSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" 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"
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource MyRadioBtnStyle}" Content="使用次数"
Style="{StaticResource RadioButtonIcon}" 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"
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource MyRadioBtnStyle}" Content="使用次数"
Style="{StaticResource RadioButtonIcon}" 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"
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
Style="{StaticResource RadioButtonIcon}" 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"
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="5"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>
@@ -92,25 +96,25 @@
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="Gitee"
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" 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"
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource GitHub}"
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
Foreground="Black"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
<TextBlock Text="其它" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<Button Content="备份数据"
hc:Poptip.Content="当数据文件损坏时, 以便能够恢复部分数据 (损坏时将有操作提示)"
hc:Poptip.Placement="Top"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
Style="{StaticResource MyBtnStyle}"
hc:Poptip.Placement="TopLeft"
hc:Poptip.Offset="10"
Style="{StaticResource Btn1}"
Click="BakDataFile"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -1,6 +1,5 @@
using GeekDesk.Constant;
using GeekDesk.MyThread;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using ShowSeconds;
@@ -122,16 +121,21 @@ namespace GeekDesk.Control.UserControls.Config
private void ShowSeconds_Click(object sender, RoutedEventArgs e)
{
if (MainWindow.appData.AppConfig.SecondsWindow == true)
{
//StartSecondsWindow();
SecondsWindow.ShowWindow();
}
else
{
SecondsWindow.CloseWindow();
//StopSecondsWindow();
}
//if (MainWindow.appData.AppConfig.SecondsWindow == true)
//{
// //StartSecondsWindow();
// //SecondsWindow.ShowWindow();
// MouseHookThread.Dispose();
// MouseHookThread.Hook();
//}
//else
//{
// MouseHookThread.Dispose();
// MouseHookThread.Hook();
//}
MouseHookThread.Dispose();
MouseHookThread.Hook();
}
public static void StopSecondsWindow()
@@ -187,20 +191,7 @@ 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

@@ -16,7 +16,6 @@
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
<cvt:TextToColorConverter x:Key="TextToColorConverter"/>
</UserControl.Resources>
<Grid>
<Grid Background="Transparent">
@@ -25,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"
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="图 片"
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="纯 色"
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色"
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -50,12 +49,18 @@
hc:Poptip.Content="{Binding BacImgName}"
hc:Poptip.Placement="TopLeft"
/>
<Button Content="修改" Style="{StaticResource MyBtnStyle}" Click="BGButton_Click"/>
<Button Content="默认" Style="{StaticResource MyBtnStyle}" Click="DefaultButton_Click"/>
<Button Content="修改" Click="BGButton_Click"/>
<Button Content="默认" Click="DefaultButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}"/>
<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>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:TransitioningContentControl>
@@ -71,36 +76,26 @@
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
<TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=GradientBGParam.Color1, Converter={StaticResource TextToColorConverter}}"/>
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True, Mode=OneWay}"
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True}"
TargetUpdated="Color_TargetUpdated"
Width="65"
Margin="0,5,0,0"
VerticalAlignment="Center"
/>
<Button Style="{StaticResource MyBtnStyle}"
Content="设置"
Tag="Color1"
Click="ColorButton_Click"/>
<Button 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"/>
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=GradientBGParam.Color2, Converter={StaticResource TextToColorConverter}}"/>
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True, Mode=OneWay}"
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True}"
TargetUpdated="Color_TargetUpdated"
Width="65"
Margin="0,5,0,0"
VerticalAlignment="Center"
/>
<Button Style="{StaticResource MyBtnStyle}"
Content="设置" Tag="Color2"
Click="ColorButton_Click"
/>
<Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel HorizontalAlignment="Center" Spacing="10" Grid.ColumnSpan="4">
<Button Content="系统预设"
Style="{StaticResource MyBtnStyle}"
Margin="0,5,0,0"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
@@ -108,42 +103,49 @@
hc:Poptip.Placement="Top"
Click="SysBG_Click"
/>
<Button Content="保存当前颜色到系统预设"
Style="{StaticResource MyBtnStyle}"
Margin="0,5,0,0"
Click="NewBGBtn_Click"
/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:TransitioningContentControl>
</UniformGrid>
<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 Style="{StaticResource MyCheckBoxStyle}" Content="置于顶层" IsChecked="{Binding AlwaysTopmost}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked"/>
<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 Style="{StaticResource MyCheckBoxStyle}" Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}"/>
<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 Style="{StaticResource MyCheckBoxStyle}" x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}"/>
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
<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 Style="{StaticResource MyCheckBoxStyle}" Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示图标标题" IsChecked="{Binding ShowIconTitle, Mode=TwoWay}"/>
<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>
</hc:UniformSpacingPanel>
@@ -229,9 +231,8 @@
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=TextColor, Converter={StaticResource TextToColorConverter}}"/>
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
<Button Style="{StaticResource MyBtnStyle}" Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
<Button 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, *.gif)|*.png;*.jpg;*.gif"
Filter = "图像文件(*.png, *.jpg)|*.png;*.jpg;*.gif"
};
if (ofd.ShowDialog() == true)
{
@@ -168,15 +168,5 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.IsShow = null;
}
/// <summary>
/// 保存当前颜色到系统预设
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void NewBGBtn_Click(object sender, RoutedEventArgs e)
{
BGNmaeDialog dialog = new BGNmaeDialog();
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "ConfigWindowDialog");
}
}
}

View File

@@ -139,7 +139,6 @@
<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>
@@ -159,7 +158,6 @@
<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"/>
@@ -186,7 +184,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding}">
<TextBox Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path=MenuName, Mode=TwoWay}"
<TextBox 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"
@@ -199,11 +197,7 @@
Padding="2"
BorderThickness="0"
IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding MenuEdit}">
<TextBox.Background>
<SolidColorBrush Color="White" Opacity="0.6" />
</TextBox.Background>
</TextBox>
Visibility="{Binding MenuEdit}"/>
<StackPanel Orientation="Horizontal"
IsVisibleChanged="MenuWhenVisibilityChanged"
Visibility="{Binding NotMenuEdit}">

View File

@@ -4,19 +4,14 @@ 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
{
@@ -27,14 +22,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
private int menuSelectIndexTemp = -1;
private AppData appData = MainWindow.appData;
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(255, 255, 255));
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
public LeftCardControl()
{
InitializeComponent();
bac.Opacity = 0.6;
this.Loaded += (s, e) =>
{
@@ -176,9 +170,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
lbi.MouseLeave -= Lbi_MouseLeave;
lbi.Background = bac;
lbi.Foreground = fontColor;
}
catch { }
} catch { }
}
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
@@ -206,77 +199,6 @@ 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 设置为可见
@@ -297,26 +219,7 @@ 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)
{
//如果删除以后没有菜单的话 先创建一个
@@ -430,7 +333,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
appData.AppConfig.SelectedMenuIcons = null;
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.INPUT;
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
}
else
@@ -463,10 +365,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
int index = MenuListBox.ItemContainerGenerator.IndexFromContainer(lbi);
MenuListBox.SelectedIndex = index;
if (appData.AppConfig.IconBatch_NoWrite)
{
appData.AppConfig.IconBatch_NoWrite = false;
}
}
});
});
@@ -491,12 +389,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
MenuInfo mi = lbi.DataContext as MenuInfo;
int index = MenuListBox.Items.IndexOf(mi);
MenuListBox.SelectedIndex = index;
if (appData.AppConfig.IconBatch_NoWrite)
{
appData.AppConfig.IconBatch_NoWrite = false;
MainWindow.mainWindow.RightCard.IconListBox.SelectionMode = SelectionMode.Extended;
}
}
@@ -551,8 +443,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
MenuListBox.SelectedIndex = index;
}
}
else if (e.Delta > 0)
} else if (e.Delta > 0)
{
if (ScrollUtil.IsTopScrollView(scrollViewer))
{
@@ -593,44 +484,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
MyPoptip.IsOpen = false;
}
/// <summary>
/// 拖动移动图标到指定菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Menu_Drop(object sender, DragEventArgs e)
{
MyPoptip.IsOpen = false;
MenuInfo mi = (sender as ListBoxItem).DataContext as MenuInfo;
IconInfo iconInfo = (IconInfo)e.Data.GetData(typeof(IconInfo));
if (iconInfo != null)
{
// 将已有图标移动到该菜单
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
}
else
{
// 直接将新图标移动到该菜单
Array dropObject = (System.Array)e.Data.GetData(DataFormats.FileDrop);
if (dropObject == null) return;
foreach (object obj in dropObject)
{
string path = (string)obj;
iconInfo = CommonCode.GetIconInfoByPath(path);
if (iconInfo == null)
{
LogUtil.WriteErrorLog("添加项目失败,未能获取到项目图标:" + path);
break;
}
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
}
CommonCode.SortIconList();
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
}
private void EncryptMenu(object sender, RoutedEventArgs e)
@@ -645,15 +507,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
//单独设置焦点
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
}
else
} else
{
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
MainWindow.mainWindow.RightCard.PDDialog.menuInfo = menuInfo;
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "设置新密码";
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.CREATE;
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
}
else
@@ -691,8 +552,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
AlterPW1.Visibility = Visibility.Collapsed;
}
else
} else
{
AlterPW1.Visibility = Visibility.Visible;
}
@@ -703,7 +563,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
ListBoxItem lbi = sender as ListBoxItem;
MenuInfo info = lbi.DataContext as MenuInfo;
ItemCollection ics = lbi.ContextMenu.Items;
ItemCollection ics = lbi.ContextMenu.Items;
foreach (object obj in ics)
{
@@ -725,8 +585,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (info.IsEncrypt)
{
mi.Header = "取消加密此列表";
}
else
} else
{
mi.Header = "加密此列表";
}
@@ -734,7 +593,5 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
}
}

View File

@@ -8,12 +8,11 @@
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>
<!--右侧栏样式动画-->
@@ -29,11 +28,6 @@
<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">
@@ -111,10 +105,6 @@
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
<temp:SearchIconList x:Key="SearchIconList"/>
<cvt:Boolean2VisibilityConverter x:Key="MyBoolean2VisibilityConverter"/>
<cvt:ValueConvert x:Key="ValueConvert"/>
<cst:RunTimeStatus x:Key="RunTimeStatus"/>
<cst:DictConst x:Key="DictConst"/>
</UserControl.Resources>
<!--右侧栏-->
<Grid>
@@ -129,7 +119,7 @@
</Border>
</Grid>
</Popup>
<hc:Card AllowDrop="True"
x:Name="WrapCard"
Visibility="Visible"
@@ -152,103 +142,88 @@
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
<MenuItem x:Name="showTitle" Header="隐藏/显示标题" Click="ShowTitle_Click"/>
<MenuItem Header="{Binding AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}" Click="BatchHandle" Tag="{Binding}"/>
</ContextMenu>
</hc:Card.ContextMenu>
<hc:DialogContainer>
<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"/>
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
<WrapPanel Orientation="Horizontal"
Margin="10"
<WrapPanel Orientation="Horizontal"
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}">-->
<ListBox x:Name="IconListBox"
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
BorderThickness="0"
Padding="0,10,0,0"
SelectionChanged="IconListBox_SelectionChanged"
ScrollViewer.CanContentScroll ="True"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<ListBox x:Name="IconListBox"
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
BorderThickness="0"
Padding="0,10,0,0"
ScrollViewer.CanContentScroll ="False"
>
<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}"
>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
<ItemsPresenter/>
</Border>
</hc:ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<ListBox.Background>
<SolidColorBrush Color="#00FFFFFF" />
</ListBox.Background>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
</ListBox.Template>
<ListBox.Background>
<SolidColorBrush Color="#00FFFFFF" />
</ListBox.Background>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
HorizontalAlignment="Center"
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
<component:VirtualizingWrapPanel VirtualizationMode="Recycling"
IsVirtualizing="True"
IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
<WrapPanel Background="#00FFFFFF"
Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<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}"/>
<MenuItem Header="从列表移除"
Click="RemoveIcon"
Tag="{Binding}"/>
<!--MenuItem Header="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}"
Click="BatchHandle"
Tag="{Binding}"/>-->
</ContextMenu>
</ListBox.Resources>
<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}"/>
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<ListBox.ItemTemplate>
<DataTemplate>
<hc:SimpleStackPanel Tag="{Binding}"
<hc:SimpleStackPanel Tag="{Binding}"
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
HorizontalAlignment="Center"
@@ -259,17 +234,13 @@
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
>
<!--<CheckBox IsChecked="{Binding IsChecked_NoWrite}" Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,0,-20" HorizontalAlignment="Right"/>-->
<!--<StackPanel Background="#00FFFFFF"
<!--<StackPanel Background="#00FFFFFF"
MouseEnter="CursorPanel_MouseEnter"
MouseLeave="CursorPanel_MouseLeave"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
<Image Style="{StaticResource ImageStyle}"
<Image Style="{StaticResource ImageStyle}"
RenderOptions.BitmapScalingMode="HighQuality"/>
<!--Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"-->
<TextBlock MaxWidth="80"
<TextBlock MaxWidth="80"
Margin="0,5,0,0"
MaxHeight="40"
FontSize="13"
@@ -278,15 +249,14 @@
TextAlignment="Center"
VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ShowIconTitle, Converter={StaticResource MyBoolean2VisibilityConverter}, ConverterParameter={x:Static Visibility.Collapsed}, Mode=TwoWay}"
Text="{Binding Name}"/>
<!--</StackPanel>-->
<!--</StackPanel>-->
</hc:SimpleStackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--</hc:TransitioningContentControl>-->
</hc:SimpleStackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--</hc:TransitioningContentControl>-->
</UniformGrid>
</WrapPanel>
@@ -294,32 +264,138 @@
</hc:DialogContainer>
</hc:Card>
<hc:Card x:Name="VerticalCard"
Visibility="Collapsed"
Visibility="Hidden"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,5,5" Grid.ColumnSpan="2"
MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
>
<hc:Card.Background>
<SolidColorBrush Color="AliceBlue"
<SolidColorBrush Color="AliceBlue"
hc:GeometryEffect.GeometryEffect="20"
Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
</hc:Card.Background>
<hc:Card.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
</hc:Card.BorderBrush>
</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"
/>
</hc:Card.Background>
<hc:Card.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
</hc:Card.BorderBrush>
<Grid>
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
>
<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>
</Grid>
</UserControl>

View File

@@ -2,17 +2,13 @@
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 Newtonsoft.Json.Linq;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Windows;
@@ -39,7 +35,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
InitializeComponent();
this.Loaded += RightCardControl_Loaded;
}
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
@@ -107,11 +103,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (appData.AppConfig.IconBatch_NoWrite)
{
return;
}
if (appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
@@ -120,18 +111,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
//Console.WriteLine("选中:" + IconListBox.SelectedItems.Count);
if (appData.AppConfig.IconBatch_NoWrite)
{
//查找checkbox更改选中状态
Panel p = sender as Panel;
var ens = p.Children.OfType<CheckBox>();
foreach (CheckBox cb in ens)
{
cb.IsChecked = !cb.IsChecked;
}
return;
}
if (!appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
@@ -145,18 +124,16 @@ 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)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
@@ -164,11 +141,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
@@ -182,7 +159,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void IconAdminStart(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
/// <summary>
@@ -193,7 +170,231 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void ShowInExplore(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
{
try
{
Process p = new Process();
//using ()
//{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
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.Verb = "runas";
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();
p.Close();
p.Dispose();
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();
}
}
/// <summary>
@@ -278,7 +479,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
}));
});
}
double width = appData.AppConfig.ImageWidth;
@@ -371,14 +572,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
Panel sp = sender as Panel;
DependencyObject dos = sp.Parent;
Image img = null;
foreach (var imgBak in sp.Children.OfType<Image>())
{
img = (Image)imgBak;
Image img = sp.Children[0] as Image;
}
if (img == null) return;
double afterHeight = img.Height;
double afterWidth = img.Width;
@@ -577,14 +773,62 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (RunTimeStatus.LOCK_APP_PANEL)
{
CardLockCM.Header = "解锁主面板";
}
else
} else
{
CardLockCM.Header = "锁定主面板";
}
}
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)
{
@@ -609,7 +853,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <summary>
/// 菜单结果icon 列表鼠标滚轮预处理时间
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
/// 以及滚动条尾切换菜单
/// 以及滚动条尾切换菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@@ -621,8 +865,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
}
else
} else
{
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
@@ -655,7 +898,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
//在card 上获取的事件
scrollViewer = ScrollUtil.FindSimpleVisualChild<System.Windows.Controls.ScrollViewer>(IconListBox);
}
}
if (e.Delta < 0)
{
int index = MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex;
@@ -694,6 +937,105 @@ 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>
@@ -706,40 +1048,5 @@ namespace GeekDesk.Control.UserControls.PannelCard
MyPoptipContent.Text = info.Content;
MyPoptip.VerticalOffset = 30;
}
/// <summary>
/// 控制图标标题显示及隐藏
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ShowTitle_Click(object sender, RoutedEventArgs e)
{
appData.AppConfig.ShowIconTitle = !appData.AppConfig.ShowIconTitle;
}
/// <summary>
/// 批量操作
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BatchHandle(object sender, RoutedEventArgs e)
{
if (!appData.AppConfig.IconBatch_NoWrite)
{
//开启批量操作时把所有的状态更改为未选中
foreach(var ic in IconListBox.Items)
{
IconInfo info = ic as IconInfo;
info.IsChecked_NoWrite = false;
}
}
appData.AppConfig.IconBatch_NoWrite = !appData.AppConfig.IconBatch_NoWrite;
IconListBox.SelectionMode = SelectionMode.Multiple;
}
private void IconListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//Console.WriteLine(sender.ToString());
}
}
}

View File

@@ -82,36 +82,10 @@
<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" SnapsToDevicePixels="True">
<Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}" 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:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
xmlns:local="clr-namespace:GeekDesk"
Title="Setting"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
@@ -21,13 +21,10 @@
>
<Grid Margin="30">
<Grid.Effect>
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/>
</Grid.Effect>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="9999" hc:Growl.GrowlParent="False" hc:Growl.Token="ConfigWindowAskGrowl" Grid.Column="1" Grid.Row="1"/>
<Grid hc:Dialog.Token="ConfigWindowDialog">
<hc:DialogContainer Margin="10">
<Border Style="{StaticResource BorderBG}">
@@ -39,7 +36,6 @@
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">

View File

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

View File

@@ -5,9 +5,7 @@
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"
@@ -16,49 +14,15 @@
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"
<StackPanel>
<Border MouseDown="DragMove"
VerticalAlignment="Top"
CornerRadius="8,8,0,0"
Height="20"
Background="White"
>
<Button Width="18" Height="18"
<Button Width="18" Height="18"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"
Padding="0"
Background="Transparent"
@@ -69,15 +33,17 @@
MouseEnter="Button_MouseEnter"
MouseLeave="Button_MouseLeave"
VerticalAlignment="Center">
</Button>
</Border>
</Button>
</Border>
<hc:ColorPicker HorizontalAlignment="Center"
<hc:ColorPicker HorizontalAlignment="Center"
VerticalAlignment="Bottom"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"
x:Name="MyColorPicker"
Confirmed="MyColorPicker_Confirmed"
Canceled="MyColorPicker_Canceled"
ToggleButton.Checked="MyColorPicker_Checked"/>
</StackPanel>
</Grid>
</StackPanel>
</Border>
</Window>

View File

@@ -1,8 +1,5 @@
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;
@@ -17,33 +14,10 @@ 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)
@@ -61,26 +35,14 @@ namespace GeekDesk.Control.Windows
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, RoutedEventArgs e)
private void MyColorPicker_Canceled(object sender, EventArgs e)
{
MyColorPickerClose();
}
private void MyColorPicker_Confirmed(object sender, RoutedEventArgs e)
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> 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}", c.R, c.G, c.B));
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B));
}
/// <summary>
@@ -186,28 +148,5 @@ 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" Style="{StaticResource MyTextBoxStyle}" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
<TextBox x:Name="CheckSettingUrl" 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 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" />
<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" />
</Grid>
</hc:DialogContainer>
</Border>

View File

@@ -6,12 +6,10 @@
WindowStyle="None"
AllowsTransparency="True"
Background="Black"
ResizeMode="NoResize"
PreviewMouseMove="Window_PreviewMouseMove"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
MouseRightButtonDown="Window_MouseRightButtonDown"
MouseWheel="Window_MouseWheel"
Loaded="Window_Loaded"
>
<Window.Resources>
<Style x:Key="TextKey" TargetType="TextBlock">
@@ -24,7 +22,7 @@
</Window.Resources>
<Grid>
<Image x:Name="DesktopBG" RenderOptions.BitmapScalingMode="HighQuality"/>
<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent">
<Canvas x:Name="ColorCanvas"
Width="185"

View File

@@ -3,6 +3,7 @@ using GeekDesk.Util;
using HandyControl.Controls;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@@ -11,7 +12,6 @@ using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Cursors = System.Windows.Input.Cursors;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
@@ -23,14 +23,12 @@ namespace GeekDesk.Control.Windows
/// </summary>
public partial class PixelColorPickerWindow : IWindowCommon
{
private static int PIXEL_REC_LENGTH = 10;
private static int PIXEL_REC_LENGTH = 20;
private static readonly int MIN_LENGTH = 10;
private static readonly int MAX_LENGTH = 50;
//private static System.Drawing.Bitmap bgBitmap;
private static RenderTargetBitmap renderTargetBitmap;
private static System.Drawing.Bitmap bgBitmap;
private readonly ColorPicker colorPicker;
@@ -41,12 +39,11 @@ namespace GeekDesk.Control.Windows
{
InitializeComponent();
this.colorPicker = colorPicker;
try
{
SetProcessDPIAware();
}
catch (Exception e) { }
//try
//{
// SetProcessDPIAware();
//}
//catch (Exception e) { }
ColorPickerWindow_Init();
}
@@ -55,38 +52,20 @@ namespace GeekDesk.Control.Windows
this.WindowState = WindowState.Normal;//还原窗口(非最小化和最大化)
var screens = Screen.AllScreens;
int allWidth = 0;
int allHeight = 0;
int x = 0;
int y = 0;
this.Width = SystemParameters.VirtualScreenWidth;
this.Height = SystemParameters.VirtualScreenHeight;
foreach (var screen in screens)
{
var rect = screen.Bounds;
allWidth += rect.Width;
allHeight += rect.Height;
x = Math.Min(x, rect.X);
y = Math.Min(y, rect.Y);
}
//获取缩放比例
double scale = ScreenUtil.GetScreenScalingFactor();
this.Width = allWidth;
this.Height = allHeight;
this.Left = x;
this.Top = y;
this.Left = SystemParameters.VirtualScreenLeft;
this.Top = SystemParameters.VirtualScreenTop;
DesktopBG.Width = this.Width;
DesktopBG.Height = this.Height;
this.Topmost = true;
System.Drawing.Bitmap bgBitmap = new System.Drawing.Bitmap(
//获取缩放比例
double scale = ScreenUtil.GetScreenScalingFactor();
bgBitmap = new System.Drawing.Bitmap(
(int)(Width * scale),
(int)(Height * scale),
System.Drawing.Imaging.PixelFormat.Format32bppArgb
@@ -95,8 +74,8 @@ namespace GeekDesk.Control.Windows
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bgBitmap))
{
g.CopyFromScreen(
(int)this.Left,
(int)this.Top,
0,
0,
0,
0,
bgBitmap.Size
@@ -112,23 +91,10 @@ namespace GeekDesk.Control.Windows
VisualBrush b = (VisualBrush)PixelBG.Fill;
b.Visual = DesktopBG;
Mouse.OverrideCursor = Cursors.Cross;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// 创建一个RenderTargetBitmap捕获窗口的内容
renderTargetBitmap = new RenderTargetBitmap((int)this.Width, (int)this.Height, 96, 96, PixelFormats.Pbgra32);
renderTargetBitmap.Render(this);
SetPixelAbout(null);
}
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
@@ -142,7 +108,9 @@ namespace GeekDesk.Control.Windows
{
Mouse.OverrideCursor = null;
Point pos = e.MouseDevice.GetPosition(DesktopBG);
colorPicker.SelectedBrush = new SolidColorBrush(GetColorAtPosition(Mouse.GetPosition(this)));
System.Drawing.Color colorD = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
colorPicker.SelectedBrush = new SolidColorBrush(Color.FromArgb(colorD.A, colorD.R, colorD.G, colorD.B));
DeleteObject(bgBitmap.GetHbitmap());
this.Close();
ClickColorPickerToggleButton(colorPicker);
}
@@ -161,7 +129,7 @@ namespace GeekDesk.Control.Windows
mi.Invoke(colorPicker, new object[] { null, null });
}
}
private void Window_PreviewMouseMove(object sender, MouseEventArgs e)
{
SetPixelAbout(e);
@@ -170,27 +138,19 @@ namespace GeekDesk.Control.Windows
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern bool DeleteObject(IntPtr onj);
// Constants for DPI
private const int HORZRES = 8;
private const int VERTRES = 10;
private const int LOGPIXELSX = 88;
private const int LOGPIXELSY = 90;
private static float GetDpi(bool isX)
{
IntPtr hdc = WindowUtil.GetDC(IntPtr.Zero);
int dpi = isX ? WindowUtil.GetDeviceCaps(hdc, LOGPIXELSX) : WindowUtil.GetDeviceCaps(hdc, LOGPIXELSY);
WindowUtil.ReleaseDC(IntPtr.Zero, hdc);
return dpi / 96f;
}
private void SetPixelAbout(MouseEventArgs e)
{
VisualBrush b = (VisualBrush)PixelBG.Fill;
Point pos = Mouse.GetPosition(this);
Point pos;
if (e == null)
{
pos = MouseUtil.GetMousePosition();
}
else
{
pos = e.MouseDevice.GetPosition(DesktopBG);
}
Rect viewBox = b.Viewbox;
viewBox.Width = PIXEL_REC_LENGTH;
@@ -202,59 +162,29 @@ namespace GeekDesk.Control.Windows
double x = pos.X + 10;
double y = pos.Y + 10;
//获取缩放比例
double scale = ScreenUtil.GetScreenScalingFactor();
if (x + ColorCanvas.Width > this.Width / scale)
if (x + ColorCanvas.Width > SystemParameters.VirtualScreenWidth)
{
x = pos.X - ColorCanvas.Width - 10;
}
if (y + ColorCanvas.Height > this.Height / scale)
if (y + ColorCanvas.Height > SystemParameters.VirtualScreenHeight)
{
y = pos.Y - ColorCanvas.Height - 10;
}
Canvas.SetLeft(ColorCanvas, x);
Canvas.SetTop(ColorCanvas, y);
System.Drawing.Color dColor = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
Color wColor = GetColorAtPosition(pos);
System.Drawing.Color dColor = System.Drawing.Color.FromArgb(wColor.A, wColor.R, wColor.G, wColor.B);
PixelColor_HTML.Text = "#" + dColor.Name.ToUpper().Substring(2);
PixelColor_HTML.Text = "#" + dColor.Name.ToUpper();
PixelColor_RGB.Text = dColor.R + "," + dColor.G + "," + dColor.B;
Pixel_XY.Text = (int)pos.X + "*" + (int)pos.Y;
Pixel_XY.Text = pos.X + "*" + pos.Y;
SolidColorBrush scb = (SolidColorBrush)PixelColor.Fill;
scb.Color = wColor;
//scb.Color = Color.FromArgb(dColor.A, dColor.R, dColor.G, dColor.B);
scb.Color = Color.FromArgb(dColor.A, dColor.R, dColor.G, dColor.B);
}
private Color GetColorAtPosition(Point position)
{
// 使用CroppedBitmap裁剪出鼠标位置的一个像素
CroppedBitmap croppedBitmap = new CroppedBitmap(renderTargetBitmap, new Int32Rect((int)position.X, (int)position.Y, 1, 1));
// 将像素数据复制到数组中
byte[] pixels = new byte[4];
croppedBitmap.CopyPixels(pixels, 4, 0);
// 如果像素数据有效,则返回颜色
//if (pixels.Length == 4)
//{
//}
return Color.FromArgb(pixels[3], pixels[2], pixels[1], pixels[0]);
//return Color.FromArgb(0, 0, 0, 0);
}
/// <summary>
/// 滚轮控制缩放区域
/// </summary>
@@ -283,11 +213,9 @@ namespace GeekDesk.Control.Windows
/// <param name="e"></param>
private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
Mouse.OverrideCursor = null;
GlobalColorPickerWindow.ShowOrHide();
//关闭
this.Close();
}
}
}

View File

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

View File

@@ -10,7 +10,6 @@
Height="550"
Width="1000"
Title="Task"
ResizeMode="NoResize"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
@@ -90,7 +89,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 MyBtnStyle}"
Style="{StaticResource Btn1}"
Grid.Column="1"
Margin="669,400,0,0"
Click="CreateBacklog_BtnClick" HorizontalAlignment="Left" VerticalAlignment="Top"/>

View File

@@ -2,11 +2,6 @@
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;
@@ -69,21 +64,12 @@ 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)
{
backlog.NoData.Visibility = Visibility.Collapsed;
backlog.BacklogList.Visibility = Visibility.Visible;
}
else
} else
{
backlog.NoData.Visibility = Visibility.Visible;
backlog.BacklogList.Visibility = Visibility.Collapsed;
@@ -124,7 +110,9 @@ namespace GeekDesk.Control.Windows
private static System.Windows.Window window = null;
#pragma warning disable CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
public static void Show()
#pragma warning restore CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
{
if (window == null || !window.Activate())
{

View File

@@ -10,7 +10,6 @@
WindowStyle="None"
AllowsTransparency="True"
Title=""
ResizeMode="NoResize"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown">
@@ -29,7 +28,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 MyBtnStyle}"
Style="{StaticResource Btn1}"
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>
@@ -56,8 +55,8 @@
</hc:Card.Footer>
</hc:Card>
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Style="{StaticResource MyBtnStyle}" Content="暂不更新" Click="Close_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="前往更新" Click="Confirm_Click"/>
<Button Content="暂不更新" Click="Close_Click" Style="{StaticResource Btn1}"/>
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -1,39 +0,0 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace GeekDesk.Converts
{
internal class Boolean2VisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool param = false;
if (value != null)
{
param = (bool)value;
}
if (param)
{
return Visibility.Visible;
} else
{
return (Visibility)parameter;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value)
{
return Visibility.Visible;
}
else
{
return Visibility.Hidden;
}
}
}
}

View File

@@ -26,21 +26,7 @@ namespace GeekDesk.Converts
return config.WindowWidth - config.MenuCardWidth;
} else if (WidthTypeEnum.RIGHT_CARD_HALF == type)
{
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 - config.MenuCardWidth) / 2;
}
return config.WindowWidth;

View File

@@ -1,29 +0,0 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace GeekDesk.Converts
{
class SearchResWidth : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string param = parameter as string;
if ("1".Equals(param))
{
double menuLeftWidth = double.Parse(value.ToString());
return MainWindow.mainWindow.Width - menuLeftWidth;
}
else
{
double menuLeftWidth = double.Parse(value.ToString());
return (MainWindow.mainWindow.Width - menuLeftWidth) / 2;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace GeekDesk.Converts
{
internal class TextToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
string str = value as string;
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(str));
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
string str = value as string;
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(str));
}
}
}

View File

@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace GeekDesk.Converts
{
internal class ValueConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool) {
Dictionary<bool, string> dict = (Dictionary<bool, string>)parameter;
bool val = (bool)value;
return dict[val];
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool)
{
Dictionary<bool, string> dict = (Dictionary<bool, string>)parameter;
bool val = (bool)value;
return dict[val];
}
return null;
}
}
}

View File

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

View File

@@ -1,25 +0,0 @@
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

@@ -1,14 +0,0 @@
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

@@ -1,28 +0,0 @@
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

@@ -1,492 +0,0 @@
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

@@ -1,474 +0,0 @@
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

@@ -49,10 +49,10 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\GeekDesk\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -61,13 +61,14 @@
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup>
<StartupObject>GeekDesk.App</StartupObject>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Logo.ico</ApplicationIcon>
<ApplicationIcon>Taskbar.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
@@ -85,11 +86,8 @@
<Reference Include="Gma.System.MouseKeyHook, Version=5.6.130.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\MouseKeyHook.5.6.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
</Reference>
<Reference Include="HandyControl, Version=3.5.1.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
<HintPath>packages\HandyControl.3.5.1\lib\net472\HandyControl.dll</HintPath>
</Reference>
<Reference Include="KeyMouseHook, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\KeyMouseHook.1.0.6\lib\net40\KeyMouseHook.dll</HintPath>
<Reference Include="HandyControl, Version=3.3.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
<HintPath>packages\HandyControl.3.3.0\lib\net472\HandyControl.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
@@ -108,7 +106,6 @@
<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>
@@ -132,7 +129,6 @@
<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>
@@ -149,9 +145,6 @@
<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" />
@@ -168,12 +161,10 @@
<Compile Include="Command\DelegateCommandBase.cs" />
<Compile Include="Constant\AppHideType.cs" />
<Compile Include="Constant\Constants.cs" />
<Compile Include="Constant\DictConst.cs" />
<Compile Include="Constant\HotKeyType.cs" />
<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" />
@@ -194,9 +185,6 @@
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Other\BGNmaeDialog.xaml.cs">
<DependentUpon>BGNmaeDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Other\PasswordDialog.xaml.cs">
<DependentUpon>PasswordDialog.xaml</DependentUpon>
</Compile>
@@ -206,9 +194,6 @@
<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>
@@ -263,15 +248,13 @@
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
<DependentUpon>UpdateWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Converts\ValueConvert.cs" />
<Compile Include="Converts\CountGreZero2BoolConvert.cs" />
<Compile Include="Converts\Count2VisibleConvert.cs" />
<Compile Include="Converts\GetWidthByWWConvert.cs" />
<Compile Include="Converts\SearchTypeConvert.cs" />
<Compile Include="Converts\StringAppendConvert.cs" />
<Compile Include="Converts\DoubleToGridLength.cs" />
<Compile Include="Converts\MenuInfoConvert.cs" />
<Compile Include="Converts\SearchResWidth.cs" />
<Compile Include="Converts\GetWidthByWWConvert.cs" />
<Compile Include="Converts\SortTypeConvert.cs" />
<Compile Include="Converts\TodoTaskExecConvert.cs" />
<Compile Include="Converts\IntToCornerRadius.cs" />
@@ -279,44 +262,30 @@
<Compile Include="Converts\BGStyleConvert.cs" />
<Compile Include="Converts\UpdateTypeConvert.cs" />
<Compile Include="Converts\ReverseBoolConvert.cs" />
<Compile Include="Converts\Boolean2VisibilityConverter.cs" />
<Compile Include="Converts\TextToColorConverter.cs" />
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="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\ViewModel\SecondsDataContext.cs" />
<Compile Include="Plugins\ShowSeconds\SecondsWindow.xaml.cs">
<DependentUpon>SecondsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Plugins\ShowSeconds\ViewModel\SecondsDataContext.cs" />
<Compile Include="Task\BakTask.cs" />
<Compile Include="Task\ToDoTask.cs" />
<Compile Include="MyThread\MouseHookThread.cs" />
<Compile Include="MyThread\DispatcherBuild.cs" />
<Compile Include="Task\UpdateTask.cs" />
<Compile Include="MyThread\UpdateThread.cs" />
<Compile Include="Util\AeroGlassHelper.cs" />
<Compile Include="Util\BGSettingUtil.cs" />
<Compile Include="Util\BlurGlassUtil.cs" />
<Compile Include="Util\ColorUtil.cs" />
<Compile Include="Util\DeepCopyUtil.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" />
<Compile Include="Util\KeyUtil.cs" />
<Compile Include="Util\ListBoxDragDropManager.cs" />
<Compile Include="Util\LogUtil.cs" />
@@ -328,8 +297,6 @@
<Compile Include="Util\MessageUtil.cs" />
<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" />
@@ -339,13 +306,6 @@
<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" />
@@ -372,10 +332,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\Other\BGNmaeDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\Other\PasswordDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -388,10 +344,6 @@
<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>
@@ -514,18 +466,6 @@
</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" />
@@ -594,28 +534,6 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<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>
@@ -643,8 +561,7 @@
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>; Move all assemblies and related files to lib folder
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
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " /XF Data *.exe *.config *.manifest /XD lib logs bak /E /IS /MOVE
if %25errorlevel%25 leq 4 exit 0 else exit %25errorlevel%25</PostBuildEvent>
</PropertyGroup>
</Project>

201
LICENSE
View File

@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2
LICENSE.md Normal file
View File

@@ -0,0 +1,2 @@
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
- 商用需联系作者

BIN
Logo.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

View File

@@ -11,7 +11,6 @@
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,24 +27,23 @@
MouseDown="MainWindow_MouseDown"
MouseEnter="MainWindow_MouseEnter"
GotFocus="Window_GotFocus"
Loaded="Window_Loaded"
SourceInitialized="Window_SourceInitialized"
Topmost="{Binding AppConfig.AlwaysTopmost}"
Loaded="Window_Loaded"
>
<Window.Resources>
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
<cvt:ReverseBoolConvert x:Key="ReverseBoolConvert"/>
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="23"/>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
</WindowChrome.WindowChrome>
<Window.InputBindings>
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
</Window.InputBindings>
@@ -54,95 +52,10 @@
</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}}"
<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}"
@@ -151,51 +64,38 @@
xf:Animations.SecondaryCompletionCommand="{Binding HideCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
xf:Animations.AllowOpacityReset="False"
>
<Border.Effect>
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
<Border.Effect>
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/>
</Border.Effect>
</Border.Effect>
<hc:DialogContainer Focusable="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" MouseDown="DragMove"></RowDefinition>
<RowDefinition Height="40" MouseMove="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="280"></ColumnDefinition>
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox 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" MouseDown="DragMove">
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="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"
Opacity="0.8"
HorizontalAlignment="Left"/>
<Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
</DockPanel>
<DockPanel Grid.Row="0" Grid.Column="2" MouseDown="DragMove">
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
<DockPanel.Background>
<SolidColorBrush Opacity="0.01"/>
</DockPanel.Background>
<hc:UniformSpacingPanel x:Name="MainBtnPanel" Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
<hc:UniformSpacingPanel 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"
@@ -208,13 +108,12 @@
x:Name="SettingButton"
FocusVisualStyle="{x:Null}"
>
<Button.ContextMenu>
<ContextMenu x:Name="SettingMenus" Width="130">
<MenuItem Header="设置" Click="ConfigMenuClick"/>
<MenuItem Header="待办" Click="BacklogMenuClick"/>
<MenuItem Header="新手引导" Click="Guide_Click"/>
</ContextMenu>
</Button.ContextMenu>
<Button.ContextMenu>
<ContextMenu x:Name="SettingMenus" Width="130">
<MenuItem Header="设置" Click="ConfigMenuClick"/>
<MenuItem Header="待办" Click="BacklogMenuClick"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
<Button Background="Transparent"
BorderThickness="0"
@@ -233,36 +132,7 @@
<uc:LeftCardControl x:Name="LeftCard" Grid.Row="1" Grid.Column="0"/>
<!--分割线-->
<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>
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
<!--搜索输入框-->
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
@@ -273,15 +143,10 @@
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"
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
<hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130" x:Name="TaskbarContextMenu">
@@ -300,12 +165,9 @@
<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>
</Border>
</Window>

View File

@@ -1,12 +1,9 @@
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;
@@ -17,20 +14,12 @@ 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;
@@ -43,19 +32,14 @@ namespace GeekDesk
public partial class MainWindow : Window, IWindowCommon
{
public static AppData appData;
public static AppData appData = CommonCode.GetAppDataByFile();
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();
@@ -63,6 +47,9 @@ namespace GeekDesk
//用于其他类访问
mainWindow = this;
//置于顶层
this.Topmost = true;
//执行待办提醒
ToDoTask.BackLogCheck();
@@ -73,25 +60,11 @@ namespace GeekDesk
MarginHide.StartHide();
}
}
private void Window_SourceInitialized(object sender, EventArgs e)
{
try
{
//禁用窗口最大化
WindowUtil.DisableMaxWindow(this);
}
catch (Exception) { }
}
/// <summary>
/// 搜索快捷键按下
/// </summary>
@@ -99,12 +72,9 @@ namespace GeekDesk
/// <param name="e"></param>
private void SearchHotKeyDown(object sender, CanExecuteRoutedEventArgs e)
{
if (appData.AppConfig.SearchType == SearchType.HOT_KEY && !RunTimeStatus.SEARCH_BOX_SHOW)
if (appData.AppConfig.SearchType == SearchType.HOT_KEY)
{
ShowSearchBox();
} else if (RunTimeStatus.SEARCH_BOX_SHOW)
{
HidedSearchBox();
}
}
@@ -117,9 +87,6 @@ namespace GeekDesk
RightCard.VisibilitySearchCard(Visibility.Visible);
SearchBox.Width = 400;
SearchBox.Focus();
//执行一遍a查询
//SearchBox_TextChanged(null, null);
}
/// <summary>
/// 搜索开始
@@ -128,9 +95,9 @@ namespace GeekDesk
/// <param name="e"></param>
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (!RunTimeStatus.SEARCH_BOX_SHOW
&& appData.AppConfig.SearchType != SearchType.KEY_DOWN
)
if (!RunTimeStatus.SEARCH_BOX_SHOW
&& appData.AppConfig.SearchType != SearchType.KEY_DOWN
)
{
SearchBox.TextChanged -= SearchBox_TextChanged;
SearchBox.Clear();
@@ -146,113 +113,33 @@ namespace GeekDesk
RightCard.MyPoptip.IsOpen = false;
string inputText = SearchBox.Text.ToLower();
RightCard.VerticalUFG.Visibility = Visibility.Collapsed;
if (!string.IsNullOrEmpty(inputText))
{
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)
SearchIconList.IconList.Clear();
ObservableCollection<MenuInfo> menuList = appData.MenuList;
foreach (MenuInfo menu in menuList)
{
SearchResControl control = obj as SearchResControl;
control.VerticalUFG.Visibility = Visibility.Collapsed;
ObservableCollection<IconInfo> iconList = menu.IconList;
foreach (IconInfo icon in iconList)
{
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
if (icon.Name.Contains(inputText) || pyName.Contains(inputText))
{
SearchIconList.IconList.Add(icon);
}
}
}
}
}
private void SearchDelay()
{
new Thread(() =>
else
{
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))
{
geekDeskCount++;
resList.Add(icon);
}
}
}
this.Dispatcher.Invoke(() =>
{
if (appData.AppConfig.EnableEveryThing == true)
{
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;
}
SearchResControl control = new SearchResControl(resList);
RightCard.VerticalCard.Content = control;
//关闭加载效果
RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
});
}).Start();
});
}).Start();
SearchIconList.IconList.Clear();
}
if (RightCard.SearchListBox.Items.Count > 0)
{
RightCard.SearchListBox.SelectedIndex = 0;
}
RightCard.VerticalUFG.Visibility = Visibility.Visible;
}
/// <summary>
@@ -260,33 +147,15 @@ 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;
SearchResContainer.Visibility = Visibility.Collapsed;
RightCard.VerticalCard.Content = null;
RightCard.VisibilitySearchCard(Visibility.Collapsed);
});
}).Start();
RunTimeStatus.SEARCH_BOX_SHOW = false;
SearchBox.TextChanged -= SearchBox_TextChanged;
SearchBox.Clear();
SearchBox.TextChanged += SearchBox_TextChanged;
SearchBox.Width = 0;
SearchIconList.IconList.Clear();
RightCard.VisibilitySearchCard(Visibility.Collapsed);
Keyboard.Focus(SearchBox);
App.DoEvents();
}
@@ -295,11 +164,6 @@ namespace GeekDesk
/// </summary>
private void LoadData()
{
//判断数据文件是否存在 如果不存在那么是第一次打开程序
dataFileExist = File.Exists(Constants.DATA_FILE_PATH);
appData = CommonCode.GetAppDataByFile();
this.DataContext = appData;
if (appData.MenuList.Count == 0)
{
@@ -317,6 +181,8 @@ namespace GeekDesk
/// <param name="e"></param>
void Window_Loaded(object sender, RoutedEventArgs e)
{
SecondsWindow.ShowWindow();
BGSettingUtil.BGSetting();
if (!appData.AppConfig.StartedShowPanel)
{
@@ -351,23 +217,14 @@ namespace GeekDesk
}
//注册鼠标监听事件
if (appData.AppConfig.MouseMiddleShow)
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow==true)
{
MouseHookThread.Hook();
}
//显秒插件
if (appData.AppConfig.SecondsWindow == true)
{
SecondsWindow.ShowWindow();
}
//监听实时文件夹菜单
FileWatcher.EnableLinkMenuWatcher(appData);
//更新任务开启 检测更新
UpdateTask.Start();
//更新线程开启 检测更新
UpdateThread.Update();
//建立相对路径
RelativePathThread.MakeRelativePath();
@@ -375,32 +232,9 @@ namespace GeekDesk
//毛玻璃 暂时未解决阴影问题
//BlurGlassUtil.EnableBlur(this);
//设置归属桌面 解决桌面覆盖程序界面的bug
WindowUtil.SetOwner(this, WindowUtil.GetDesktopHandle(this, DesktopLayer.Progman));
if (appData.AppConfig.EnableEveryThing == true)
{
//开启EveryThing插件
EveryThingUtil.EnableEveryThing();
}
//启动文件备份任务
BakTask.Start();
Keyboard.Focus(SearchBox);
MessageUtil.ChangeWindowMessageFilter(MessageUtil.WM_COPYDATA, 1);
if (!dataFileExist)
{
Guide();
}
}
/// <summary>
/// 注册当前窗口的热键
/// </summary>
@@ -412,17 +246,9 @@ 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 (CheckShouldShowApp())
if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0 || MarginHide.IS_HIDE)
{
ShowApp();
}
@@ -436,8 +262,7 @@ namespace GeekDesk
{
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
}
}
else
} else
{
}
}
@@ -480,7 +305,7 @@ namespace GeekDesk
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
}
}
}
catch (Exception)
{
@@ -541,9 +366,28 @@ 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();
}
}
@@ -605,10 +449,8 @@ namespace GeekDesk
if (appData.AppConfig.FollowMouse)
{
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
//ShowWindowFollowMouse.FollowMouse(mainWindow);
}
MainWindow.mainWindow.Activate();
mainWindow.Show();
//mainWindow.Visibility = Visibility.Visible;
@@ -633,8 +475,7 @@ namespace GeekDesk
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
{
mainWindow.RightCard.PDDialog.SetFocus();
}
else
} else
{
Keyboard.Focus(mainWindow.SearchBox);
}
@@ -651,7 +492,7 @@ namespace GeekDesk
appData.AppConfig.IsShow = null;
HideAppVis();
}
}
private static void HideAppVis()
@@ -665,7 +506,7 @@ namespace GeekDesk
mainWindow.Visibility = Visibility.Collapsed;
//if (!MarginHide.IS_HIDE)
//{
//}
//else
//{
@@ -727,7 +568,7 @@ namespace GeekDesk
/// <param name="e"></param>
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
{
if (CheckShouldShowApp())
if (this.Visibility == Visibility.Collapsed || this.Opacity == 0)
{
ShowApp();
}
@@ -737,14 +578,6 @@ namespace GeekDesk
}
}
private static bool CheckShouldShowApp()
{
return mainWindow.Visibility == Visibility.Collapsed
|| mainWindow.Opacity == 0
|| MarginHide.IS_HIDE
|| !WindowUtil.WindowIsTop(mainWindow);
}
/// <summary>
/// 右键任务栏图标 设置
/// </summary>
@@ -833,10 +666,6 @@ namespace GeekDesk
appData.AppConfig.WindowWidth = this.Width;
appData.AppConfig.WindowHeight = this.Height;
}
if (guideRun)
{
Guide();
}
}
@@ -848,14 +677,10 @@ namespace GeekDesk
/// <param name="e"></param>
private void ExitApp(object sender, RoutedEventArgs e)
{
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow == true)
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow==true)
{
MouseHookThread.Dispose();
}
if (appData.AppConfig.EnableEveryThing == true)
{
EveryThingUtil.DisableEveryThing();
}
Application.Current.Shutdown();
}
/// <summary>
@@ -863,9 +688,19 @@ namespace GeekDesk
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void ReStartApp(object sender, RoutedEventArgs e)
private void ReStartApp(object sender, RoutedEventArgs e)
{
ProcessUtil.ReStartApp();
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow == true)
{
MouseHookThread.Dispose();
}
Process p = new Process();
p.StartInfo.FileName = Constants.APP_DIR + "GeekDesk.exe";
p.StartInfo.WorkingDirectory = Constants.APP_DIR;
p.Start();
Application.Current.Shutdown();
}
/// <summary>
@@ -888,28 +723,23 @@ namespace GeekDesk
HideApp();
}
if (RunTimeStatus.SEARCH_BOX_SHOW && (e.Key == Key.Up
|| e.Key == Key.Down
if (RunTimeStatus.SEARCH_BOX_SHOW && (e.Key == Key.Up
|| e.Key == Key.Down
|| e.Key == Key.Tab
|| e.Key == Key.Enter
))
{
if (e.Key == Key.Down || e.Key == Key.Tab)
{
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.SearchListBoxIndexAdd();
}
else if (e.Key == Key.Up)
RightCard.SearchListBoxIndexAdd();
} else if (e.Key == Key.Up)
{
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.SearchListBoxIndexSub();
}
else if (e.Key == Key.Enter)
RightCard.SearchListBoxIndexSub();
} else if (e.Key == Key.Enter)
{
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.StartupSelectionItem();
RightCard.StartupSelectionItem();
}
}
}
}
@@ -963,9 +793,9 @@ namespace GeekDesk
//必须在其它文本框没有工作的时候才给搜索框焦点
Keyboard.Focus(SearchBox);
}
}
}
private void AppWindow_Deactivated(object sender, EventArgs e)
@@ -1046,123 +876,7 @@ 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

@@ -3,6 +3,7 @@ using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook;
using ShowSeconds;
using System;
using System.Drawing;
using System.Threading;
@@ -30,16 +31,24 @@ namespace GeekDesk.MyThread
hook.OnMouseWheelUp += OnMouseWheelUp;
}
if (appConfig.SecondsWindow == true)
{
hook.OnMouseLeftDown += OnMouseLeftDown;
hook.OnMouseLeftUp += OnMouseLeftUp;
}
hook.Start(true, false);
}));
}
private static void OnMouseLeftDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
SecondsWindow.SecondsBakColorFun(sender, e);
}
private static void OnMouseLeftUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
SecondsWindow.SecondsHookSetFuc(sender, e);
}
private static void OnMouseWheelUp(object sender, System.Windows.Forms.MouseEventArgs e)
@@ -96,8 +105,7 @@ namespace GeekDesk.MyThread
dispatcher = null;
}
}
catch (Exception ex)
{
catch (Exception ex) {
LogUtil.WriteErrorLog(ex, "关闭hook出错");
}
}

View File

@@ -22,7 +22,6 @@ 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;
@@ -36,9 +35,8 @@ namespace GeekDesk.MyThread
}
}
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
//CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
}
catch (Exception ex)
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
} catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "init相对路径出错!");
}

70
MyThread/UpdateThread.cs Normal file
View File

@@ -0,0 +1,70 @@
using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Newtonsoft.Json.Linq;
using System;
using System.Configuration;
using System.Threading;
namespace GeekDesk.MyThread
{
public class UpdateThread
{
private static AppConfig appConfig = MainWindow.appData.AppConfig;
public static void Update()
{
System.Threading.Thread t = new System.Threading.Thread(new ThreadStart(UpdateApp))
{
IsBackground = true
};
t.Start();
}
private static void UpdateApp()
{
try
{
//等待1分钟后再检查更新 有的网络连接过慢
int sleepTime = 60 * 1000;
if (Constants.DEV)
{
sleepTime = 1;
}
System.Threading.Thread.Sleep(sleepTime);
string updateUrl;
string nowVersion = ConfigurationManager.AppSettings["Version"];
switch (appConfig.UpdateType)
{
case UpdateType.GitHub:
updateUrl = ConfigurationManager.AppSettings["GitHubUpdateUrl"];
break;
default:
updateUrl = ConfigurationManager.AppSettings["GiteeUpdateUrl"];
break;
}
string updateInfo = HttpUtil.Get(updateUrl);
if (!StringUtil.IsEmpty(updateInfo))
{
JObject jo = JObject.Parse(updateInfo);
string onlineVersion = jo["version"].ToString();
if (onlineVersion.CompareTo(nowVersion) > 0)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//检测到版本更新
UpdateWindow.Show(jo);
}));
}
}
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "获取更新失败!");
}
}
}
}

Binary file not shown.

View File

@@ -1,740 +0,0 @@
; 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

@@ -1,740 +0,0 @@
; 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

@@ -1,66 +0,0 @@
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

@@ -1,126 +0,0 @@
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

@@ -1,126 +0,0 @@
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

@@ -1,347 +0,0 @@
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();
}
}
}
}

View File

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShowSeconds.Common
{
public class Constants
{
public readonly static string MY_UUID = "8400A17AEEF7C029";
//dark theam
public readonly static System.Windows.Media.SolidColorBrush darkBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(46, 50, 54),
Opacity = 0.8
};
public readonly static System.Windows.Media.SolidColorBrush darkFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(255, 255, 255)
};
//light theam
public readonly static System.Windows.Media.SolidColorBrush lightBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(236, 244, 251),
Opacity = 1
};
public readonly static System.Windows.Media.SolidColorBrush lightFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(65, 63, 61),
};
}
}

View File

@@ -1,19 +1,21 @@
<Window x:Class="ShowSeconds.SecondsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
Height="90"
Width="160"
WindowStyle="None"
Title=""
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
Height="90"
Width="160"
WindowStyle="None"
Title="ShowSeconds_Main_8400A17AEEF7C029"
AllowsTransparency="True"
Background="Transparent"
ShowInTaskbar="False"
Focusable="True"
Loaded="Window_Loaded"
>
ShowActivated="False"
>
<Grid Margin="20">
<Grid.Effect>

View File

@@ -1,13 +1,14 @@
using GeekDesk.Util;
using Gma.System.MouseKeyHook;
using ShowSeconds.Common;
using GeekDesk;
using GeekDesk.MyThread;
using GeekDesk.Util;
using ShowSeconds.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -17,14 +18,11 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using GeekDesk.MyThread;
using GeekDesk;
using System.Collections;
namespace ShowSeconds
{
@@ -34,15 +32,40 @@ namespace ShowSeconds
public partial class SecondsWindow : Window
{
private System.Drawing.Color beforeColor;
private System.Drawing.Color topBeforeColor;
private static Color beforeColor;
private static Color topBeforeColor;
private bool expandClock = true; //是否展开时钟
private System.Windows.Forms.Timer timer;
//dark theam
private readonly static System.Windows.Media.SolidColorBrush darkBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(46, 50, 54),
Opacity = 0.8
};
private readonly static System.Windows.Media.SolidColorBrush darkFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(255, 255, 255)
};
//light theam
private readonly static System.Windows.Media.SolidColorBrush lightBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(236, 244, 251),
Opacity = 1
};
private readonly static System.Windows.Media.SolidColorBrush lightFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(65, 63, 61),
};
private static bool expandClock = true; //是否展开时钟
private static System.Windows.Forms.Timer timer;
private static double lProportion = 0.82;
private static double tProportion = 0.03;
private static int sleepTime = 1000;
private static int sleepTime = 800;
public SecondsWindow()
{
SecondsDataContext dc = new SecondsDataContext
@@ -51,16 +74,9 @@ namespace ShowSeconds
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second)
};
InitializeComponent();
SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 47, 52, 44))
{
Opacity = 0.8
};
try
{
Hashtable settings = (Hashtable)ConfigurationManager.GetSection("ShowSecondsSettings");
lProportion = Convert.ToDouble(settings["LProportion"]);
@@ -71,34 +87,157 @@ namespace ShowSeconds
{
lProportion = 0.82;
tProportion = 0.03;
sleepTime = 1000;
sleepTime = 800;
}
BGBorder.Background = scb;
InitializeComponent();
this.DataContext = dc;
this.Topmost = true;
BGBorder.Visibility = Visibility.Collapsed;
this.Show();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
timer = new System.Windows.Forms.Timer();
timer.Interval = 1000;
timer.Tick += Timer_Tick;
Dispatcher secondsDP = DispatcherBuild.Build();
IKeyboardMouseEvents secondsHook = Hook.GlobalEvents();
secondsDP.Invoke((Action)(() =>
{
secondsHook.MouseDownExt += SecondsBakColorFun;
secondsHook.MouseUpExt += SecondsHookSetFuc;
}));
timer.Tick += Timer_Tick;
HideWindowUtil.HideAltTab(this);
}
public static void SecondsHookSetFuc(object sender, System.Windows.Forms.MouseEventArgs e)
{
ThreadPool.QueueUserWorkItem(state =>
{
window.Dispatcher.Invoke(() =>
{
if (ScreenUtil.IsPrimaryFullScreen()) return;
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
{
int x = e.X;
int y = e.Y;
//获取实际坐标 windows可能会有缩放
IntPtr hdc = GetDC(IntPtr.Zero);
double scale = ScreenUtil.GetScreenScalingFactor();
x = (int)(x / scale);
y = (int)(y / scale);
double w = 1920;
double h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
if (x > 1843 / w * width
&& x < 1907 / w * width
&& y > 1037 / h * height
&& y < 1074 / h * height)
{
Color c;
int count = sleepTime;
do
{
c = GetBottomBeforeColor();
if (c.A != beforeColor.A
|| c.R != beforeColor.R
|| c.G != beforeColor.G
|| c.B != beforeColor.B)
{
break;
}
Thread.Sleep(50);
count -= 50;
} while (count > 0);
if (c.A != beforeColor.A
|| c.R != beforeColor.R
|| c.G != beforeColor.G
|| c.B != beforeColor.B)
{
//判断是否展开时钟
Color ct = GetTopBeforeColor();
if (ct.A != topBeforeColor.A
|| ct.R != topBeforeColor.R
|| ct.G != topBeforeColor.G
|| ct.B != topBeforeColor.B)
{
expandClock = true;
}
else
{
expandClock = false;
}
if (!window.BGBorder.IsVisible)
{
Color theamColor = GetColor(1919, 1079);
if (CalculateLight(theamColor) > 255 / 2)
{
//light
window.BGBorder.Background = lightBG;
window.SecondsText.Foreground = lightFont;
}
else
{
// dark
window.BGBorder.Background = darkBG;
window.SecondsText.Foreground = darkFont;
}
SecondsDataContext dc = window.DataContext as SecondsDataContext;
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
int sx = (int)(width * lProportion);
int sMarginBottom = (int)(height * tProportion);
window.Left = sx - window.Width;
window.Top = SystemParameters.WorkArea.Height - window.Height;
window.BGBorder.Visibility = Visibility.Visible;
timer.Start();
}
else
{
window.BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
}
else if ((expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 598 / h * height
|| y > 1020 / h * height)
)
|| !expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 950 / h * height
|| y > 1020 / h * height)
)
{
window.BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}));
});
});
}
public static void SecondsBakColorFun(object sender, System.Windows.Forms.MouseEventArgs e)
{
ThreadPool.QueueUserWorkItem(state =>
{
window.Dispatcher.Invoke(() =>
{
beforeColor = GetBottomBeforeColor();
topBeforeColor = GetTopBeforeColor();
});
});
}
private void Timer_Tick(object sender, EventArgs e)
{
string str = (DateTime.Now.Hour).ToString() + ":" +
@@ -106,10 +245,11 @@ namespace ShowSeconds
FormatMS(DateTime.Now.Second);
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = str;
this.DataContext = null;
this.DataContext = dc;
}
private static string FormatMS(int ms)
{
if (ms < 10)
@@ -122,200 +262,57 @@ namespace ShowSeconds
}
}
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
{
//IntPtr taskBarWnd = WindowUtil.FindWindow("Shell_TrayWnd", null);
//IntPtr tray = WindowUtil.FindWindowEx(taskBarWnd, IntPtr.Zero, "TrayNotifyWnd", null);
////IntPtr trayclock = WindowUtil.FindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null);
//IntPtr trayclock = WindowUtil.GetForegroundWindow();
//StringBuilder title = new StringBuilder(256);
//WindowUtil.GetWindowText(trayclock, title, title.Capacity);//得到窗口的标题
////Console.WriteLine(title.ToString());
//if (title.Equals("通知中心"))
//{
//}
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;
double w = 1920;
double h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
if (x > 1843 / w * width
&& x < 1907 / w * width
&& y > 1037 / h * height
&& y < 1074 / h * height)
{
System.Drawing.Color c;
int count = sleepTime;
do
{
c = GetBottomBeforeColor();
if (c.A != beforeColor.A
|| c.R != beforeColor.R
|| c.G != beforeColor.G
|| c.B != beforeColor.B)
{
break;
}
Thread.Sleep(50);
count -= 50;
} while (count > 0);
if (c.A != beforeColor.A
|| c.R != beforeColor.R
|| c.G != beforeColor.G
|| c.B != beforeColor.B)
{
//判断是否展开时钟
System.Drawing.Color ct = GetTopBeforeColor();
if (ct.A != topBeforeColor.A
|| ct.R != topBeforeColor.R
|| ct.G != topBeforeColor.G
|| ct.B != topBeforeColor.B)
{
expandClock = true;
}
else
{
expandClock = false;
}
if (!BGBorder.IsVisible)
{
System.Drawing.Color theamColor = GetColor(1919, 1079);
if (CalculateLight(theamColor) > 255 / 2)
{
//light
BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
SecondsText.Foreground = Constants.lightFont;
}
else
{
// dark
//BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
BGBorder.Background = Constants.darkBG;
SecondsText.Foreground = Constants.darkFont;
}
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
int sx = (int)(SystemParameters.PrimaryScreenWidth * lProportion);
int sMarginBottom = (int)(SystemParameters.WorkArea.Height * tProportion);
Left = sx - Width;
Top = SystemParameters.WorkArea.Height - Height;
BGBorder.Visibility = Visibility.Visible;
timer.Start();
}
else
{
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
}
else if (true)
{
if ((expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 598 / h * height
|| y > 1020 / h * height)
)
|| !expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 950 / h * height
|| y > 1020 / h * height)
)
{
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
}
catch (Exception e1) { }
}));
}
}
private static System.Windows.Window window = null;
public static void ShowWindow()
{
try
{
if (window == null || !window.Activate())
{
window = new SecondsWindow();
}
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, "打开显秒窗口异常!");
}
}
public static void CloseWindow()
{
try
{
window.Close();
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, "关闭显秒窗口异常!");
}
}
private void SecondsBakColorFun(object sender, MouseEventExtArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
beforeColor = GetBottomBeforeColor();
topBeforeColor = GetTopBeforeColor();
}
}
private static System.Drawing.Color GetBottomBeforeColor()
private static Color GetBottomBeforeColor()
{
return GetColor(1760, 985);
}
private static System.Drawing.Color GetTopBeforeColor()
private static Color GetTopBeforeColor()
{
return GetColor(1751, 693);
}
private static System.Drawing.Color GetColor(int w2, int h2)
private static Color GetColor(int w2, int h2)
{
double w = 1920;
double h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width), (int)(h2 / h * height));
double scale = ScreenUtil.GetScreenScalingFactor();
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width * scale), (int)(h2 / h * height * scale));
return ScreenUtil.GetColorAt(p);
}
private static int CalculateLight(System.Drawing.Color color)
protected override void OnSourceInitialized(EventArgs e)
{
int[] colorArr = new int[] { color.R, color.G, color.B };
base.OnSourceInitialized(e);
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
if (hwndSource != null)
{
IntPtr handle = hwndSource.Handle;
hwndSource.AddHook(new HwndSourceHook(WndProc));
}
}
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == MessageUtil.WM_COPYDATA)
{
MessageUtil.CopyDataStruct cds = (MessageUtil.CopyDataStruct)System.Runtime.InteropServices.Marshal.PtrToStructure(lParam, typeof(MessageUtil.CopyDataStruct));
if ("Shutdown".Equals(cds.msg))
{
Application.Current.Shutdown();
}
}
return hwnd;
}
private static int CalculateLight(Color color)
{
int[] colorArr = new int[] {color.R, color.G, color.B};
int max = 0;
int min = 255;
@@ -328,5 +325,43 @@ namespace ShowSeconds
return avg;
}
private static SecondsWindow window = null;
public static void ShowWindow()
{
if (window == null || !window.Activate())
{
window = new SecondsWindow();
}
window.Show();
Keyboard.Focus(window);
}
//#######################################################
/// <summary>
/// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄,
/// 以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图。
/// </summary>
/// <param name="hWnd">设备上下文环境被检索的窗口的句柄如果该值为NULLGetDC则检索整个屏幕的设备上下文环境。</param>
/// <returns>如果成功返回指定窗口客户区的设备上下文环境如果失败返回值为Null。</returns>
[DllImport("user32")]
public static extern IntPtr GetDC(IntPtr hWnd);
/// <summary>
/// 该函数释放设备上下文环境DC供其他应用程序使用。函数的效果与设备上下文环境类型有关。
/// 它只释放公用的和设备上下文环境,对于类或私有的则无效。
/// </summary>
/// <param name="hWnd">指向要释放的设备上下文环境所在的窗口的句柄。</param>
/// <param name="hDC">指向要释放的设备上下文环境的句柄。</param>
/// <returns>如果释放成功则返回值为1如果没有释放成功则返回值为0。</returns>
[DllImport("user32")]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("user32")]
public static extern bool GetCursorPos(out System.Drawing.Point pt);
}
}

View File

@@ -49,5 +49,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.1.5")]
[assembly: AssemblyFileVersion("2.5.1.5")]
[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]

View File

@@ -1,63 +0,0 @@
# GeekDesk 极客桌面
小巧、**美观**的桌面快速启动管理工具, 同时集成了Everything搜索
- [中文介绍](README-zh.md)
- [English-machine translation](README.md)
<img src="https://s4.ax1x.com/2021/12/15/TSrwfU.png" a border="0" width="800px"/>
**免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
大家如果有好的建议可以提Issue
另外如果你喜欢 GeekDesk的话, 或许可以为作者购买防脱洗发水
当然, 点个**Star**也是对作者的激励哦~ 😊😊😊
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
### GitHub
[https://github.com/BookerLiu/GeekDesk](https://github.com/BookerLiu/GeekDesk)
### 码云
[https://gitee.com/BookerLiu/GeekDesk](https://gitee.com/BookerLiu/GeekDesk)
## 集成Everything 快速搜索全盘文件
- 2.5.14及之后版本集成了Everything功能
![](https://s3.bmp.ovh/imgs/2023/04/25/ecfbf59916b9b854.gif)
## 全局热键 一键呼出 鼠标跟随
- 自定义热键 设置并使用自己习惯的快捷键
- 一键呼出 使用鼠标中键呼出
- 鼠标跟随 自动追随鼠标位置
<img src="https://s4.ax1x.com/2021/12/15/TSlg8f.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
## 自定义壁纸
- 随意选择自己喜欢的壁纸
<img src="https://s4.ax1x.com/2021/12/15/TSNx4H.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
## 毛玻璃等界面效果
- 背景图片毛玻璃效果
- 界面透明度
- 界面圆角
<img src="https://s4.ax1x.com/2021/12/15/TSabTO.gif" alt="WGOYSU.gif" border="0" width="800px"/>
## 自定义菜单图标
- 80多个系统图标可供选择
- 另支持在线导入阿里巴巴icon图标
- ~~篇幅原因,公众号内回复 **自定义图标** 可以查看教程~~ 现在软件内已经贴上教程链接啦 也欢迎大家关注我的公众号:blush:
<img src="https://s4.ax1x.com/2021/12/15/TSd1NF.gif" border="0" width="800px"/>
## 定时提醒 永不忘记
- 快捷键快速新建待办事项
<img src="https://s4.ax1x.com/2021/12/15/TSDCvj.gif" alt="WJU6df.gif" border="0" width="800px"/>
## 开发框架
- wpf
- .net 4.7.2
- [HandyControl](https://github.com/HandyOrg/HandyControl)
## Stargazers over time
[![Stargazers over time](https://starchart.cc/BookerLiu/GeekDesk.svg)](https://starchart.cc/BookerLiu/GeekDesk)

View File

@@ -1,66 +1,77 @@
# GeekDesk 极客桌面
Small, **beautiful** desktop quickstart management tool with integrated Everything search
- [中文介绍](README-zh.md)
- [English-machine translation](README.md)
小巧、**美观**的桌面快速启动管理工具
———— 大风, 雨夜...
「你来了」
「我来了」
「你究竟想干什么!」
「我想做一款软件, 这个软件要Cool」
「什么软件?」
「从最常用的桌面开始吧」
「哼!现在的软件多入牛毛, 会差你一个吗」
「我不知道, 但是我想做」
「你以为凭你一个人的力量能在这大海里掀起什么波浪吗」
「但只要我想就够了, 这是我的梦想!」
「梦想? 可笑, 这世界哪有什么梦想. 不过是一日三餐, 车子和房!」
「我想...就够了...」
「...」
———— 雨停, 狂风仍在呼啸...
<img src="https://s4.ax1x.com/2021/12/15/TSrwfU.png" a border="0" width="800px"/>
Free / beautiful / highly customized is the need and direction since the birth of GeekDesk, and will develop in these directions in the future
**免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
you can raise issues if you have good suggestions
目前GeekDesk只有一个人在开发所以想法有限, 大家如果有好的建议也可以提Issue
另外如果你喜欢 GeekDesk的话, 或许可以为作者购买防脱洗发水
当然, 点个**Star**也是对作者的激励哦~ 😊😊😊
In addition, if you like GeekDesk, you may be able to buy anti-exfoliation shampoo for the author
Of course, ordering a Star is also an incentive for the author~ 😊😊😊
[**Paypal**](https://www.paypal.com/paypalme/BookerLiu)
### Other:
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
### GitHub
[https://github.com/BookerLiu/GeekDesk](https://github.com/BookerLiu/GeekDesk)
### Gitee
### 码云
[https://gitee.com/BookerLiu/GeekDesk](https://gitee.com/BookerLiu/GeekDesk)
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
## Integrate Everything to quickly search the entire disk
- Integrate Everything to quickly search the entire disk
![](https://s3.bmp.ovh/imgs/2023/04/25/ecfbf59916b9b854.gif)
## Global hotkeys / one-click callout / mouse follow
- Customize hotkeys settings and use the shortcuts you are used to
- One-click outbound call Use the middle mouse button to call out
- Mouse Follow Automatically follows the mouse position
## 全局热键 一键呼出 鼠标跟随
- 自定义热键 设置并使用自己习惯的快捷键
- 一键呼出 使用鼠标中键呼出
- 鼠标跟随 自动追随鼠标位置
<img src="https://s4.ax1x.com/2021/12/15/TSlg8f.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
## Custom wallpaper
- Feel free to choose your favorite wallpaper
## 自定义壁纸
- 随意选择自己喜欢的壁纸
<img src="https://s4.ax1x.com/2021/12/15/TSNx4H.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
## Interface effects such as frosted glass
- Background image frosted glass effect
- Interface transparency
- Interface rounded corners
## 毛玻璃等界面效果
- 背景图片毛玻璃效果
- 界面透明度
- 界面圆角
<img src="https://s4.ax1x.com/2021/12/15/TSabTO.gif" alt="WGOYSU.gif" border="0" width="800px"/>
## Customize the menu icon
- More than 80 system icons to choose from
- It also supports online import of Alibaba icon icons
- For space reasons, reply in the public account Custom icon You can view the tutorial Now the tutorial link has been pasted in the software Welcome to pay attention to my public account😊
## 自定义菜单图标
- 80多个系统图标可供选择
- 另支持在线导入阿里巴巴icon图标
- ~~篇幅原因,公众号内回复 **自定义图标** 可以查看教程~~ 现在软件内已经贴上教程链接啦 也欢迎大家关注我的公众号:blush:
<img src="https://s4.ax1x.com/2021/12/15/TSd1NF.gif" border="0" width="800px"/>
## Scheduled reminders Never forget
- Scheduled reminders Never forget
## 定时提醒 永不忘记
- 快捷键快速新建待办事项
<img src="https://s4.ax1x.com/2021/12/15/TSDCvj.gif" alt="WJU6df.gif" border="0" width="800px"/>
## Development framework
## 开发框架
- wpf
- .net 4.7.2
- [HandyControl](https://github.com/HandyOrg/HandyControl)
## Stargazers over time
[![Stargazers over time](https://starchart.cc/BookerLiu/GeekDesk.svg)](https://starchart.cc/BookerLiu/GeekDesk)
[![Stargazers over time](https://starchart.cc/Demo-Liu/GeekDesk.svg)](https://starchart.cc/Demo-Liu/GeekDesk)

View File

@@ -19,15 +19,15 @@
</Style.Setters>
</Style>
<LinearGradientBrush x:Key="BtnBG" Opacity="0.7">
<LinearGradientBrush x:Key="BtnBG" Opacity="0.97">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
<!--按钮样式-->
<Style x:Key="MyBtnStyle" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
<Style x:Key="Btn1" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
<Setter Property="Background" Value="{StaticResource BtnBG}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#E5E5E2"/>
@@ -36,50 +36,7 @@
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<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>
<Setter Property="Background" Value="#E5E5E2"/>
</Trigger>
</Style.Triggers>
</Style>
@@ -100,40 +57,4 @@
</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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -1,93 +0,0 @@
using GeekDesk.Constant;
using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Task
{
internal class BakTask
{
public static void Start()
{
System.Timers.Timer timer = new System.Timers.Timer
{
Enabled = true,
Interval = 60 * 1000 * 60 * 2, //60秒 * 60 * 2 2小时触发一次
//Interval = 6000,
};
timer.Start();
timer.Elapsed += Timer_Elapsed;
}
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
DirectoryInfo dirInfo = new DirectoryInfo(Constants.DATA_FILE_BAK_DIR_PATH);
string todayBakName = DateTime.Now.ToString("yyyy-MM-dd") + ".bak";
string bakDaysStr = ConfigurationManager.AppSettings["BakDays"];
int bakDays = 7;
if (bakDaysStr != null && !"".Equals(bakDaysStr.Trim()))
{
bakDays = Int32.Parse(bakDaysStr.Trim());
}
string bakFilePath = Constants.DATA_FILE_BAK_DIR_PATH + "\\" + todayBakName;
if (dirInfo.Exists)
{
// 获取文件信息并按创建时间倒序排序
FileInfo[] files = dirInfo.GetFiles()
.Where(f => f.Extension.Equals(".bak", StringComparison.OrdinalIgnoreCase)).ToArray();
if (files.Length > 0)
{
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
if (!sortedFiles[0].Name.Equals(todayBakName))
{
//今天未创建备份 开始创建今天的备份
createBakFile(bakFilePath);
}
//判断文件是否超过了7个 超过7个就删除
if (sortedFiles.Length > bakDays)
{
for (int i = bakDays; i < sortedFiles.Length; i++)
{
sortedFiles[i].Delete();
}
}
} else
{
//没有文件 直接创建今天的备份
createBakFile(bakFilePath);
}
}
else
{
dirInfo.Create();
}
}
//创建备份文件
private static void createBakFile(string filePath)
{
using (FileStream fs = new FileStream(filePath, FileMode.Create))
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, MainWindow.appData);
}
}
}
}

View File

@@ -34,22 +34,18 @@ namespace GeekDesk.Task
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
try
if (MainWindow.appData.ToDoList.Count > 0)
{
if (MainWindow.appData.ToDoList.Count > 0)
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ObservableCollection<ToDoInfo> exeBacklogList = MainWindow.appData.ToDoList;
foreach (ToDoInfo info in exeBacklogList)
{
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ObservableCollection<ToDoInfo> exeBacklogList = MainWindow.appData.ToDoList;
foreach (ToDoInfo info in exeBacklogList)
if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info))
{
if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info))
{
activityBacklog.Add(info, Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true));
}
activityBacklog.Add(info, Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true));
}
}
}
catch (Exception e1) { }
//ClearMemory();
}));
}
@@ -64,7 +60,7 @@ namespace GeekDesk.Task
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
}
}
}
#region

View File

@@ -1,88 +0,0 @@
using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Task
{
internal class UpdateTask
{
private static AppConfig appConfig = MainWindow.appData.AppConfig;
public static void Start()
{
System.Timers.Timer timer = new System.Timers.Timer
{
Enabled = true,
Interval = 60 * 1000 * 60 * 12, //60秒 * 60 * 12 12小时触发一次
//Interval = 6000,
};
timer.Start();
timer.Elapsed += Timer_Elapsed; ;
}
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
string updateUrl = ConfigurationManager.AppSettings["GiteeUpdateUrl"];
string nowVersion = ConfigurationManager.AppSettings["Version"];
if (appConfig != null)
{
switch (appConfig.UpdateType)
{
case UpdateType.GitHub:
updateUrl = ConfigurationManager.AppSettings["GitHubUpdateUrl"];
break;
default:
updateUrl = ConfigurationManager.AppSettings["GiteeUpdateUrl"];
break;
}
}
string updateInfo = HttpUtil.Get(updateUrl);
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)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//检测到版本更新
UpdateWindow.Show(jo);
}));
}
}
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "获取更新失败!");
}
}
}
}

View File

@@ -1,10 +1,9 @@
{
"title": "GeekDesk版本更新",
"subTitle": "V2.5.15",
"subTitle": "V2.5.12",
"msgTitle": "本次更新内容如下",
"msg": "['鸽了挺久, 我终于又来更新了, 废话不多说, 看下本次更新内容, 没有点star的记得给我star哦^_^', '增加自动多文件备份在根目录下bak文件夹, 数据文件损坏会自动寻找最近的一次备份数据, 基本不用担心数据文件损坏了!!! 备份数据默认为最近7天, 可以通过打开根目录下GeekDesk.exe.config, 找到BakDays修改', '修复多块屏幕下高分屏缩放比例不同导致的鼠标追随bug, 显示时可以正确的追随鼠标位置了', '修复多块屏幕下高分屏缩放比例不同导致的拾色器bug, 可以正常拾色了', '增加自定义纯色背景的保存功能', '修复按照使用次数排序不会自动根据使用次数排序的bug', '另外UI假死的情况, 由于并不是每个用户都出现这个bug, 这次做了尝试性修复, 各位可以看下是否还会出现切换菜单出现不会出现图标的情况', '其它优化', 'PS:最新版的windows11已经可以打开秒数显示了, 各位可以不用开启时钟显秒插件了', '升级前建议备份原目录']",
"msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '其它已知问题修复']",
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
"statisticUrl": "http://43.138.23.39:8989/bookerService/geekDeskController/userCountStatistic",
"version": "2.5.15"
}
"version": "2.5.12"
}

View File

@@ -45,6 +45,7 @@ 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),
@@ -59,7 +60,6 @@ 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

@@ -8,7 +8,6 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows;
@@ -35,7 +34,6 @@ namespace GeekDesk.Util
using (FileStream fs = File.Create(Constants.DATA_FILE_PATH)) { }
appData = new AppData();
SaveAppData(appData, Constants.DATA_FILE_PATH);
return appData;
}
else
{
@@ -45,110 +43,49 @@ namespace GeekDesk.Util
{
BinaryFormatter bf = new BinaryFormatter();
appData = bf.Deserialize(fs) as AppData;
//将菜单密码写入文件
if (!string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
SavePassword(appData.AppConfig.MenuPassword);
}
return appData;
}
}
}
catch
{
DirectoryInfo dirInfo = new DirectoryInfo(Constants.DATA_FILE_BAK_DIR_PATH);
FileInfo[] files = dirInfo.GetFiles()
.Where(f => f.Extension.Equals(".bak", StringComparison.OrdinalIgnoreCase)).ToArray(); ;
if (files.Length > 0)
if (File.Exists(Constants.DATA_FILE_BAK_PATH))
{
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
//循环获取可用备份文件
string bakFilePath = "";
foreach (FileInfo bakFile in sortedFiles)
try
{
if (!Directory.Exists(Constants.DATA_FILE_TEMP_DIR_PATH)) { Directory.CreateDirectory(Constants.DATA_FILE_TEMP_DIR_PATH); }
bakFilePath = Constants.DATA_FILE_TEMP_DIR_PATH + "\\" + bakFile.Name;
try
using (FileStream fs = new FileStream(Constants.DATA_FILE_BAK_PATH, FileMode.Open))
{
File.Copy(bakFile.FullName, bakFilePath, true);
using (FileStream fs = new FileStream(bakFilePath, FileMode.Open))
{
BinaryFormatter bf = new BinaryFormatter();
appData = bf.Deserialize(fs) as AppData;
}
DialogMsg msg = new DialogMsg();
msg.msg = "不幸的是, GeekDesk当前的数据文件已经损坏, " +
"现在已经启用系统自动备份的数据\n\n" +
"如果你有较新的备份, " +
"请退出GeekDesk, " +
"将备份文件重命名为:Data, " +
"然后将Data覆盖到GeekDesk的根目录即可\n\n" +
"启用的备份文件为: \n" + bakFilePath +
"\n\n如果当前数据就是你想要的数据, 那么请不用管它";
GlobalMsgNotification gm = new GlobalMsgNotification(msg);
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
gm.ntf = ntf;
File.Delete(bakFilePath);
SaveAppData(appData, Constants.DATA_FILE_PATH);
return appData;
}
catch {
if (File.Exists(bakFilePath))
{
File.Delete(bakFilePath);
}
BinaryFormatter bf = new BinaryFormatter();
appData = bf.Deserialize(fs) as AppData;
}
DialogMsg msg = new DialogMsg();
msg.msg = "不幸的是, GeekDesk当前的数据文件已经损坏, " +
"现在已经启用系统自动备份的数据\n\n" +
"如果你有较新的备份, " +
"请退出GeekDesk, " +
"将备份文件重命名为:Data, " +
"然后将Data覆盖到GeekDesk的根目录即可\n\n" +
"系统上次备份时间: \n" + appData.AppConfig.SysBakTime +
"\n\n如果当前数据就是你想要的数据, 那么请不用管它";
GlobalMsgNotification gm = new GlobalMsgNotification(msg);
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
gm.ntf = ntf;
} catch
{
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();
return null;
}
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();
return new AppData();
} else
{
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();
return new AppData();
return null;
}
// if (File.Exists(Constants.DATA_FILE_BAK_PATH))
//{
// try
// {
// using (FileStream fs = new FileStream(Constants.DATA_FILE_BAK_PATH, FileMode.Open))
// {
// BinaryFormatter bf = new BinaryFormatter();
// appData = bf.Deserialize(fs) as AppData;
// }
// DialogMsg msg = new DialogMsg();
// msg.msg = "不幸的是, GeekDesk当前的数据文件已经损坏, " +
// "现在已经启用系统自动备份的数据\n\n" +
// "如果你有较新的备份, " +
// "请退出GeekDesk, " +
// "将备份文件重命名为:Data, " +
// "然后将Data覆盖到GeekDesk的根目录即可\n\n" +
// "系统上次备份时间: \n" + appData.AppConfig.SysBakTime +
// "\n\n如果当前数据就是你想要的数据, 那么请不用管它";
// GlobalMsgNotification gm = new GlobalMsgNotification(msg);
// HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
// gm.ntf = ntf;
// }
// catch
// {
// MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
// Application.Current.Shutdown();
// return null;
// }
//}
//else
//{
// MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
// Application.Current.Shutdown();
// return null;
//}
}
}
return appData;
}
private readonly static object _MyLock = new object();
@@ -160,10 +97,10 @@ namespace GeekDesk.Util
{
lock (_MyLock)
{
//if (filePath.Equals(Constants.DATA_FILE_BAK_PATH))
//{
// appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//}
if (filePath.Equals(Constants.DATA_FILE_BAK_PATH))
{
appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
if (!Directory.Exists(filePath.Substring(0, filePath.LastIndexOf("\\"))))
{
Directory.CreateDirectory(filePath.Substring(0, filePath.LastIndexOf("\\")));
@@ -185,41 +122,6 @@ 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()
{
@@ -240,7 +142,7 @@ namespace GeekDesk.Util
}
}
/// <summary>
/// 根据路径获取文件图标等信息
@@ -342,47 +244,41 @@ namespace GeekDesk.Util
}
/// <summary>
/// 排序图标
/// </summary>
public static void SortIconList(bool sort = true)
public static void SortIconList()
{
try
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM)
{
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM && sort)
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
//List<IconInfo> list = new List<IconInfo>(menuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList);
List<IconInfo> list;
foreach (MenuInfo menuInfo in menuList)
{
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
//List<IconInfo> list = new List<IconInfo>(menuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList);
List<IconInfo> list;
foreach (MenuInfo menuInfo in menuList)
list = new List<IconInfo>(menuInfo.IconList);
switch (MainWindow.appData.AppConfig.IconSortType)
{
list = new List<IconInfo>(menuInfo.IconList);
switch (MainWindow.appData.AppConfig.IconSortType)
{
case SortType.COUNT_UP:
list.Sort((x, y) => x.Count.CompareTo(y.Count));
break;
case SortType.COUNT_LOW:
list.Sort((x, y) => y.Count.CompareTo(x.Count));
break;
case SortType.NAME_UP:
list.Sort((x, y) => x.Name.CompareTo(y.Name));
break;
case SortType.NAME_LOW:
list.Sort((x, y) => y.Name.CompareTo(x.Name));
break;
}
menuInfo.IconList = new ObservableCollection<IconInfo>(list);
case SortType.COUNT_UP:
list.Sort((x, y) => x.Count.CompareTo(y.Count));
break;
case SortType.COUNT_LOW:
list.Sort((x, y) => y.Count.CompareTo(x.Count));
break;
case SortType.NAME_UP:
list.Sort((x, y) => x.Name.CompareTo(y.Name));
break;
case SortType.NAME_LOW:
list.Sort((x, y) => y.Name.CompareTo(x.Name));
break;
}
MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList;
menuInfo.IconList = new ObservableCollection<IconInfo>(list);
}
MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList;
}
catch (Exception) { }
}

View File

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public static class DeepCopyUtil
{
// 使用序列化和反序列化实现深度拷贝
public static T DeepCopy<T>(T obj)
{
if (obj == null)
throw new ArgumentNullException(nameof(obj));
using (var memoryStream = new MemoryStream())
{
var formatter = new BinaryFormatter();
formatter.Serialize(memoryStream, obj); // 序列化
memoryStream.Seek(0, SeekOrigin.Begin);
return (T)formatter.Deserialize(memoryStream); // 反序列化
}
}
}
}

View File

@@ -4,7 +4,6 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using File = System.IO.File;
namespace GeekDesk.Util
{
@@ -46,22 +45,17 @@ namespace GeekDesk.Util
/// <returns></returns>
public static string GetArgByLnk(string filePath)
{
//return "";
try
{
WshShell shell = new WshShell();
if (File.Exists(filePath))
{
object shortcutObj = shell.CreateShortcut(filePath);
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shortcutObj;
return shortcut.Arguments;
}
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
return shortcut.Arguments;
}
catch (Exception e)
{
//LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
return "";
}
return "";
}
/// <summary>
@@ -178,8 +172,7 @@ namespace GeekDesk.Util
.ToString()
.Replace('/', Path.DirectorySeparatorChar)
);
}
catch (Exception ex)
} catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "建立相对路径出错:fromPath:" + fromPath + ",toPath:" + toPath);
}

View File

@@ -1,174 +0,0 @@
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,7 +20,6 @@ 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();
@@ -40,7 +39,6 @@ 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();
@@ -121,34 +119,6 @@ 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>
@@ -204,56 +174,48 @@ 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)
{
Image img = Image.FromFile(filePath);
if (img.Width <= tWidth && img.Height <= tHeight)
return GetBitmapImageByFile(filePath);
}
else
{
Bitmap loBMP = new Bitmap(filePath);
ImageFormat loFormat = loBMP.RawFormat;
decimal lnRatio;
int lnNewWidth;
int lnNewHeight;
if (loBMP.Width > loBMP.Height)
{
return GetBitmapImageByFile(filePath);
lnRatio = (decimal)tWidth / loBMP.Width;
lnNewWidth = tWidth;
decimal lnTemp = loBMP.Height * lnRatio;
lnNewHeight = (int)lnTemp;
}
else
{
Bitmap loBMP = new Bitmap(filePath);
ImageFormat loFormat = loBMP.RawFormat;
decimal lnRatio;
int lnNewWidth;
int lnNewHeight;
if (loBMP.Width > loBMP.Height)
{
lnRatio = (decimal)tWidth / loBMP.Width;
lnNewWidth = tWidth;
decimal lnTemp = loBMP.Height * lnRatio;
lnNewHeight = (int)lnTemp;
}
else
{
lnRatio = (decimal)tHeight / loBMP.Height;
lnNewHeight = tHeight;
decimal lnTemp = loBMP.Width * lnRatio;
lnNewWidth = (int)lnTemp;
}
Bitmap bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);
loBMP.Dispose();
string tempPath = Constants.APP_DIR + "\\temp";
if (File.Exists(tempPath))
{
File.Delete(tempPath);
}
bmpOut.Save(tempPath, loFormat);
BitmapImage bm = GetBitmapImageByFile(tempPath);
File.Delete(tempPath);
return bm;
lnRatio = (decimal)tHeight / loBMP.Height;
lnNewHeight = tHeight;
decimal lnTemp = loBMP.Width * lnRatio;
lnNewWidth = (int)lnTemp;
}
} else
{
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
Bitmap bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);
loBMP.Dispose();
string tempPath = Constants.APP_DIR + "\\temp";
if (File.Exists(tempPath))
{
File.Delete(tempPath);
}
bmpOut.Save(tempPath, loFormat);
BitmapImage bm = GetBitmapImageByFile(tempPath);
File.Delete(tempPath);
return bm;
}
}
catch (Exception e)
@@ -373,18 +335,14 @@ namespace GeekDesk.Util
{
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";
string[] suffixArr = suffixs.Split(',');
foreach (string suffix in suffixArr)
{
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";
string[] suffixArr = suffixs.Split(',');
foreach (string suffix in suffixArr)
if (suffix.Equals(strExt, StringComparison.InvariantCultureIgnoreCase))
{
if (suffix.Equals(strExt, StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
return true;
}
}
return false;

View File

@@ -1,297 +0,0 @@
using GeekDesk.Constant;
using GeekDesk.MyThread;
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;
using System.Windows;
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);
}
}
//启动后根据是否开启了使用次数排序判断是否执行一次排序
CommonCode.SortIconList(MainWindow.appData.AppConfig.IconSortType == (SortType.COUNT_LOW|SortType.COUNT_UP) ? true : false);
});
}
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();
}
}
public static void ReStartApp()
{
if (MainWindow.appData.AppConfig.MouseMiddleShow || MainWindow.appData.AppConfig.SecondsWindow == true)
{
MouseHookThread.Dispose();
}
Process p = new Process();
p.StartInfo.FileName = Constants.APP_DIR + "GeekDesk.exe";
p.StartInfo.WorkingDirectory = Constants.APP_DIR;
p.Start();
Application.Current.Shutdown();
}
[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();
}
}
}

View File

@@ -1,11 +1,6 @@
using GeekDesk.Constant;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Input;
using static GeekDesk.Util.ShowWindowFollowMouse;
namespace GeekDesk.Util
{
@@ -23,248 +18,89 @@ namespace GeekDesk.Util
RIGHT_CENTER = 7
}
public static void FollowMouse(Window window)
{
// Get the mouse position
var mousePosition = System.Windows.Forms.Control.MousePosition;
// Get the window size
var windowWidth = window.Width;
var windowHeight = window.Height;
Console.WriteLine("windowWidth + windowHeight:" + windowWidth + "+" + windowHeight);
// Get the screen where the mouse is located
var screen = System.Windows.Forms.Screen.FromPoint(new System.Drawing.Point(mousePosition.X, mousePosition.Y));
var workingArea = screen.WorkingArea;
// Get the DPI scaling factor for the screen
//float dpiX, dpiY;
//using (var graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero))
//{
// dpiX = graphics.DpiX / 96f; // 96 is the default DPI
// dpiY = graphics.DpiY / 96f; // 96 is the default DPI
//}
float dpiX = GetDpi( true);
float dpiY = GetDpi(false);
// Convert mouse position to logical pixels based on DPI
double mouseX = mousePosition.X / dpiX;
double mouseY = mousePosition.Y / dpiY;
// Calculate target position to center the window on the mouse
double targetLeft = mouseX - windowWidth / 2;
double targetTop = mouseY - windowHeight / 2;
// Ensure the window does not exceed the screen boundaries
if (targetLeft < workingArea.Left / dpiX)
targetLeft = workingArea.Left / dpiX;
if (targetLeft + windowWidth / dpiX > workingArea.Right / dpiX)
targetLeft = workingArea.Right / dpiX - windowWidth / dpiX;
if (targetTop < workingArea.Top / dpiY)
targetTop = workingArea.Top / dpiY;
if (targetTop + windowHeight / dpiY > workingArea.Bottom / dpiY)
targetTop = workingArea.Bottom / dpiY - windowHeight / dpiY;
// Update window position
window.Left = targetLeft * dpiX;
window.Top = targetTop * dpiY;
}
private static float GetDpi(bool isX)
{
IntPtr hdc = WindowUtil.GetDC(IntPtr.Zero);
int dpi = isX ? WindowUtil.GetDeviceCaps(hdc, LOGPIXELSX) : WindowUtil.GetDeviceCaps(hdc, LOGPIXELSY);
WindowUtil.ReleaseDC(IntPtr.Zero, hdc);
return dpi / 96f;
}
private static IntPtr GetScreenHandleFromMouse()
{
// Get the mouse position
var mousePosition = System.Windows.Forms.Control.MousePosition;
// Convert mouse position to a POINT structure
System.Drawing.Point point = new System.Drawing.Point(mousePosition.X, mousePosition.Y);
// Get the window handle from the point
IntPtr windowHandle = WindowUtil.WindowFromPoint(point);
return windowHandle;
}
// Constants for DPI
private const int HORZRES = 8;
private const int VERTRES = 10;
private const int LOGPIXELSX = 88;
private const int LOGPIXELSY = 90;
/// <summary>
/// 随鼠标位置显示面板 后面三个参数暂时没有使用
/// 随鼠标位置显示面板
/// </summary>
public static void Show(Window window, MousePosition position, double widthOffset = 0, double heightOffset = 0)
{
//获取鼠标位置
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
System.Windows.Point p = MouseUtil.GetMousePosition();
double left = SystemParameters.VirtualScreenLeft;
double top = SystemParameters.VirtualScreenTop;
double width = SystemParameters.VirtualScreenWidth;
double height = SystemParameters.WorkArea.Height;
double right = width - Math.Abs(left);
double bottom = height - Math.Abs(top);
// 获取鼠标所在的屏幕
Screen currentScreen = Screen.FromPoint(p);
float dpiX = GetDpi(true);
float dpiY = GetDpi(false);
double afterWidth;
double afterHeight;
p.X = (int)(p.X / dpiX);
p.Y = (int)(p.Y / dpiY);
//工作区宽度
double screenWidth = currentScreen.WorkingArea.Width / dpiX;
//工作区高度
double screenHeight = currentScreen.WorkingArea.Height / dpiY;
double screenX = currentScreen.WorkingArea.X / dpiX;
double screenY = currentScreen.WorkingArea.Y / dpiY;
//判断是否超出最左边缘
if (p.X - window.Width / 2 < screenX)
switch (position)
{
//超出最左边缘
window.Left = screenX - Constants.SHADOW_WIDTH;
} else
{
window.Left = p.X - window.Width / 2 + Constants.SHADOW_WIDTH;
case MousePosition.LEFT_BOTTOM:
afterWidth = 0;
afterHeight = window.Height;
break;
case MousePosition.LEFT_TOP:
afterWidth = 0;
afterHeight = 0;
break;
case MousePosition.LEFT_CENTER:
afterWidth = 0;
afterHeight = window.Height / 2;
break;
case MousePosition.RIGHT_BOTTOM:
afterWidth = window.Width;
afterHeight = window.Height;
break;
case MousePosition.RIGHT_TOP:
afterWidth = window.Width;
afterHeight = 0;
break;
case MousePosition.RIGHT_CENTER:
afterWidth = window.Width;
afterHeight = window.Height / 2;
break;
default:
afterWidth = window.Width / 2;
afterHeight = window.Height / 2;
break;
}
//判断是否超出最右边缘
if (p.X + window.Width / 2 > screenWidth + screenX)
{
//超出最右边缘
window.Left = screenWidth + screenX - window.Width + Constants.SHADOW_WIDTH;
}
afterWidth += widthOffset;
afterHeight -= heightOffset;
//判断是否超出最上边缘
if (p.Y - window.Height / 2 < screenY)
if (p.X - afterWidth < left)
{
//超出最上边缘
window.Top = screenY - Constants.SHADOW_WIDTH;
} else
//判断是否在最左边缘
window.Left = left - Constants.SHADOW_WIDTH;
}
else if (p.X + afterWidth > right)
{
window.Top = p.Y - window.Height / 2 + Constants.SHADOW_WIDTH;
//判断是否在最右边缘
window.Left = right - window.Width + Constants.SHADOW_WIDTH;
}
else
{
window.Left = p.X - afterWidth;
}
//判断是否超出最下边缘
if (p.Y + window.Height / 2 > screenHeight + screenY)
if (p.Y - afterHeight < top)
{
//超出最下边缘
window.Top = screenHeight + screenY - window.Height + Constants.SHADOW_WIDTH;
//判断是否在最上边缘
window.Top = top - Constants.SHADOW_WIDTH;
}
else if (p.Y + afterHeight > bottom)
{
//判断是否在最下边缘
window.Top = bottom - window.Height + Constants.SHADOW_WIDTH;
}
else
{
window.Top = p.Y - afterHeight;
}
//// 显示屏幕信息
//Console.WriteLine("鼠标当前所在屏幕的信息:");
//Console.WriteLine($"屏幕设备名称: {currentScreen.DeviceName}");
//Console.WriteLine($"屏幕分辨率: {currentScreen.Bounds.Width}x{currentScreen.Bounds.Height}");
//Console.WriteLine($"屏幕工作区: {currentScreen.WorkingArea}");
//Console.WriteLine($"主屏幕: {currentScreen.Primary}");
//Console.WriteLine(p.X + "=" + p.Y);
//float dpiX = GetDpi(true);
//float dpiY = GetDpi(false);
//p.X = (int)(p.X / dpiX);
//p.Y = (int)(p.Y / dpiY);
//Console.WriteLine(p.X + "=" + p.Y);
//double left = SystemParameters.VirtualScreenLeft;
//double top = SystemParameters.VirtualScreenTop;
//double width = SystemParameters.VirtualScreenWidth;
//double height = SystemParameters.WorkArea.Bottom;
//Console.WriteLine("VirtualScreenTop:" + SystemParameters.VirtualScreenTop);
//Console.WriteLine("VirtualScreenLeft:" + SystemParameters.VirtualScreenLeft);
//Console.WriteLine("VirtualScreenWidth:" + SystemParameters.VirtualScreenWidth);
//Console.WriteLine("VirtualScreenHeight:" + SystemParameters.VirtualScreenHeight);
//Console.WriteLine("WorkArea.Bottom:" + SystemParameters.WorkArea.Bottom);
//Console.WriteLine(" window.Height:" + window.Height);
//double right = width - Math.Abs(left);
//double bottom = height - Math.Abs(top);
//double afterWidth;
//double afterHeight;
//switch (position)
//{
// case MousePosition.LEFT_BOTTOM:
// afterWidth = 0;
// afterHeight = window.Height;
// break;
// case MousePosition.LEFT_TOP:
// afterWidth = 0;
// afterHeight = 0;
// break;
// case MousePosition.LEFT_CENTER:
// afterWidth = 0;
// afterHeight = window.Height / 2;
// break;
// case MousePosition.RIGHT_BOTTOM:
// afterWidth = window.Width;
// afterHeight = window.Height;
// break;
// case MousePosition.RIGHT_TOP:
// afterWidth = window.Width;
// afterHeight = 0;
// break;
// case MousePosition.RIGHT_CENTER:
// afterWidth = window.Width;
// afterHeight = window.Height / 2;
// break;
// default:
// afterWidth = window.Width / 2;
// afterHeight = window.Height / 2;
// break;
//}
//afterWidth += widthOffset;
//afterHeight -= heightOffset;
//if (p.X - afterWidth < left)
//{
// //判断是否在最左边缘
// window.Left = left - Constants.SHADOW_WIDTH;
//}
//else if (p.X + afterWidth > right)
//{
// //判断是否在最右边缘
// window.Left = right - window.Width + Constants.SHADOW_WIDTH;
//}
//else
//{
// window.Left = p.X - afterWidth;
//}
//if (p.Y - afterHeight < top)
//{
// //判断是否在最上边缘
// window.Top = top - Constants.SHADOW_WIDTH;
//}
//else if (p.Y + afterHeight > bottom)
//{
// Console.WriteLine("p.Y:" + p.Y);
// Console.WriteLine("afterHeight:" + afterHeight);
// Console.WriteLine("bottom:" + bottom);
// //判断是否在最下边缘
// window.Top = bottom - window.Height + Constants.SHADOW_WIDTH;
//}
//else
//{
// window.Top = p.Y - afterHeight;
//}
}
}

View File

@@ -1,336 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
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;
using static GeekDesk.Util.FileIcon;
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")]
public static extern IntPtr WindowFromPoint(System.Drawing.Point p);
//取得前台窗口句柄函数
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
//取得桌面窗口句柄函数
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string className, string windowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetWindow(HandleRef hWnd, int nCmd);
[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr child, IntPtr parent);
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);
[DllImport("user32.dll")]
public static extern int ReleaseDC(IntPtr window, IntPtr handle);
[DllImport("user32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID); //获取线程ID
/// <summary>
/// 枚举窗口时的委托参数
/// </summary>
/// <param name="hWnd"></param>
/// <param name="lParam"></param>
/// <returns></returns>
public delegate bool WndEnumProc(IntPtr hWnd, int lParam);
/// <summary>
/// 枚举所有窗口
/// </summary>
/// <param name="lpEnumFunc"></param>
/// <param name="lParam"></param>
/// <returns></returns>
[DllImport("user32.dll")]
public static extern bool EnumWindows(WndEnumProc lpEnumFunc, int lParam);
/// <summary>
/// 获取窗口的父窗口句柄
/// </summary>
/// <param name="hWnd"></param>
/// <returns></returns>
[DllImport("user32.dll")]
public static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int GetClassName(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll")]
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
[DllImport("user32.dll")]
public static extern bool GetWindowRect(IntPtr hWnd, ref LPRECT rect);
// Import GetDC and ReleaseDC functions from user32.dll
[DllImport("user32.dll")]
public static extern IntPtr GetDC(IntPtr hWnd);
[DllImport("gdi32.dll")]
public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
[StructLayout(LayoutKind.Sequential)]
public readonly struct LPRECT
{
public readonly int Left;
public readonly int Top;
public readonly int Right;
public readonly int Bottom;
}
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));
}
/// <summary>
/// 获取 Win32 窗口的一些基本信息。
/// </summary>
public struct WindowInfo
{
public WindowInfo(IntPtr hWnd, string className, string title, bool isVisible, Rectangle bounds) : this()
{
Hwnd = hWnd;
ClassName = className;
Title = title;
IsVisible = isVisible;
Bounds = bounds;
}
/// <summary>
/// 获取窗口句柄。
/// </summary>
public IntPtr Hwnd { get; }
/// <summary>
/// 获取窗口类名。
/// </summary>
public string ClassName { get; }
/// <summary>
/// 获取窗口标题。
/// </summary>
public string Title { get; }
/// <summary>
/// 获取当前窗口是否可见。
/// </summary>
public bool IsVisible { get; }
/// <summary>
/// 获取窗口当前的位置和尺寸。
/// </summary>
public Rectangle Bounds { get; }
/// <summary>
/// 获取窗口当前是否是最小化的。
/// </summary>
public bool IsMinimized => Bounds.Left == -32000 && Bounds.Top == -32000;
}
/// <summary>
/// 遍历窗体处理的函数
/// </summary>
/// <param name="hWnd"></param>
/// <param name="lparam"></param>
/// <returns></returns>
private static bool OnWindowEnum(IntPtr hWnd, int lparam)
{
// 仅查找顶层窗口。
//if (GetParent(hWnd) == IntPtr.Zero)
//{
// 获取窗口类名。
var lpString = new StringBuilder(512);
GetClassName(hWnd, lpString, lpString.Capacity);
var className = lpString.ToString();
// 获取窗口标题。
var lptrString = new StringBuilder(512);
GetWindowText(hWnd, lptrString, lptrString.Capacity);
var title = lptrString.ToString().Trim();
// 获取窗口可见性。
var isVisible = IsWindowVisible(hWnd);
// 获取窗口位置和尺寸。
LPRECT rect = default;
GetWindowRect(hWnd, ref rect);
var bounds = new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
// 添加到已找到的窗口列表。
windowList.Add(new WindowInfo(hWnd, className, title, isVisible, bounds));
//}
return true;
}
/// <summary>
/// 默认的查找窗口的过滤条件。可见 + 非最小化 + 包含窗口标题。
/// </summary>
private static readonly Predicate<WindowInfo> DefaultPredicate = x => x.IsVisible && !x.IsMinimized && x.Title.Length > 0;
/// <summary>
/// 窗体列表
/// </summary>
private static List<WindowInfo> windowList;
/// <summary>
/// 查找当前用户空间下所有符合条件的(顶层)窗口。如果不指定条件,将仅查找可见且有标题栏的窗口。
/// </summary>
/// <param name="match">过滤窗口的条件。如果设置为 null将仅查找可见和标题栏不为空的窗口。</param>
/// <returns>找到的所有窗口信息</returns>
public static IReadOnlyList<WindowInfo> FindAllWindows(Predicate<WindowInfo> match = null)
{
windowList = new List<WindowInfo>();
//遍历窗口并查找窗口相关WindowInfo信息
EnumWindows(OnWindowEnum, 0);
return windowList;
}
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

@@ -58,7 +58,7 @@ namespace GeekDesk.ViewModel
private string customIconUrl; //自定义图标url
private string customIconJsonUrl; //自定义图标json信息url
private bool blurEffect = true; //毛玻璃效果 默认
private bool blurEffect = false; //毛玻璃效果 默认
private double blurValue;
private UpdateType updateType = UpdateType.Gitee; //更新源 默认gitee源
@@ -74,7 +74,7 @@ namespace GeekDesk.ViewModel
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
private bool mouseMiddleShow = true; //鼠标中键呼出 默认启用
private bool mouseMiddleShow = false; //鼠标中键呼出 默认启用
private bool showBarIcon = true; //显示托盘图标 默认显示
@@ -105,89 +105,6 @@ namespace GeekDesk.ViewModel
private bool? secondsWindow; //秒数窗口 默认打开
private bool? enableEveryThing; //开启everything
private bool? alwaysTopmost; //是否置顶
private bool? showIconTitle = true; //是否显示iconTitle
private bool iconBatch = false; //批量操作图标状态
private ObservableCollection<GradientBGParam> customBGParams; //自定义纯色背景
public ObservableCollection<GradientBGParam> CustomBGParams
{
get
{
if (customBGParams == null)
{
customBGParams = new ObservableCollection<GradientBGParam>();
}
return customBGParams;
}
set
{
customBGParams = value;
OnPropertyChanged("CustomBGParams");
}
}
public bool IconBatch_NoWrite
{
get
{
return iconBatch;
}
set
{
iconBatch = value;
OnPropertyChanged("IconBatch_NoWrite");
}
}
public bool? ShowIconTitle
{
get
{
if (showIconTitle == null) showIconTitle = true;
return showIconTitle;
}
set
{
showIconTitle = value;
OnPropertyChanged("ShowIconTitle");
}
}
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
@@ -340,7 +257,7 @@ namespace GeekDesk.ViewModel
{
if (gradientBGParam == null)
{
gradientBGParam = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams[0]);
gradientBGParam = GradientBGParamList.GradientBGParams[0];
}
return gradientBGParam;
}
@@ -724,14 +641,6 @@ namespace GeekDesk.ViewModel
{
get
{
if (blurEffect)
{
BlurValue = 100;
}
else
{
BlurValue = 0;
}
return blurValue;
}
set
@@ -1077,10 +986,7 @@ 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);
}
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}
#endregion

Some files were not shown because too many files have changed in this diff Show More