Merge pull request #28 from Demo-Liu/2.3.21

2.3.21
This commit is contained in:
Demo-Liu
2021-12-20 16:47:05 +08:00
committed by GitHub
26 changed files with 192 additions and 100 deletions

View File

@@ -28,7 +28,7 @@
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<appSettings> <appSettings>
<add key="Version" value="2.3.20" /> <add key="Version" value="2.3.21" />
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" /> <add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" /> <add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" /> <add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />

View File

@@ -41,7 +41,7 @@
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中间呼出" Checked="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}"> <CheckBox Content="鼠标中间呼出" Checked="MouseMiddle_Changed" Unchecked="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background> <CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/> <GradientStop Color="#FF9EA3A6"/>

View File

@@ -1,5 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.Thread;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Data; using HandyControl.Data;
@@ -280,12 +281,14 @@ namespace GeekDesk.Control.UserControls.Config
/// <param name="e"></param> /// <param name="e"></param>
private void MouseMiddle_Changed(object sender, RoutedEventArgs e) private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
{ {
if (appConfig.MouseMiddleShow)
}
private void HookListener_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{ {
Console.WriteLine(e.KeyChar); MouseHookThread.MiddleHook();
} else
{
MouseHookThread.Dispose();
} }
} }
}
} }

View File

@@ -20,6 +20,7 @@
<SolidColorBrush Opacity="0"/> <SolidColorBrush Opacity="0"/>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/> <EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/>
<EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/> <EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/>
<Style.Triggers> <Style.Triggers>

View File

@@ -28,11 +28,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1) if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
{ {
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList; appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
} else }
else
{ {
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList; appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
} }
} }
DelegateCommand<int[]> _swap; DelegateCommand<int[]> _swap;
@@ -207,8 +207,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
//设置对应菜单的图标列表 //设置对应菜单的图标列表
if (MenuListBox.SelectedIndex == -1) if (MenuListBox.SelectedIndex == -1)
{ {
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count-1].IconList; appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count - 1].IconList;
} else }
else
{ {
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList; appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
} }

View File

@@ -19,6 +19,7 @@
<Setter Property="Source" Value="{Binding BitmapImage}"/> <Setter Property="Source" Value="{Binding BitmapImage}"/>
</Style> </Style>
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}"> <Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}"> <ControlTemplate TargetType="{x:Type ListBoxItem}">

View File

@@ -5,25 +5,16 @@ using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Text.RegularExpressions;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace GeekDesk.Control.UserControls.PannelCard namespace GeekDesk.Control.UserControls.PannelCard
{ {
@@ -190,8 +181,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
string path = (string)obj; string path = (string)obj;
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png); //string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png);
string ext = "";
string ext = System.IO.Path.GetExtension(path).ToLower(); if (!ImageUtil.IsSystemItem(path))
{
ext = System.IO.Path.GetExtension(path).ToLower();
}
if (".lnk".Equals(ext)) if (".lnk".Equals(ext))
{ {

View File

@@ -15,6 +15,8 @@
AllowsTransparency="True" AllowsTransparency="True"
Background="#00FFFFFF" ShowInTaskbar="False" Background="#00FFFFFF" ShowInTaskbar="False"
BorderThickness="0" BorderThickness="0"
Focusable="True"
KeyDown="OnKeyDown"
> >
<Grid Margin="30"> <Grid Margin="30">

View File

@@ -2,6 +2,7 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.UserControls; using GeekDesk.Control.UserControls;
using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.UserControls.Config;
using GeekDesk.Interface;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
@@ -15,7 +16,7 @@ namespace GeekDesk.Control.Windows
/// <summary> /// <summary>
/// ConfigDialog.xaml 的交互逻辑 /// ConfigDialog.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class ConfigWindow public partial class ConfigWindow : IWindowCommon
{ {
private static readonly AboutControl about = new AboutControl(); private static readonly AboutControl about = new AboutControl();
private static readonly ThemeControl theme = new ThemeControl(); private static readonly ThemeControl theme = new ThemeControl();
@@ -87,6 +88,15 @@ namespace GeekDesk.Control.Windows
window = new ConfigWindow(appConfig, mainWindow); window = new ConfigWindow(appConfig, mainWindow);
} }
window.Show(); window.Show();
Keyboard.Focus(window);
}
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.Close();
}
} }
} }
} }

View File

@@ -14,6 +14,8 @@
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False" Background="Transparent" ShowInTaskbar="False"
BorderThickness="0" BorderThickness="0"
Focusable="True"
KeyDown="OnKeyDown"
> >
<Window.Resources> <Window.Resources>
@@ -39,7 +41,7 @@
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray" <DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/> RenderingBias="Quality" ShadowDepth="2"/>
</Grid.Effect> </Grid.Effect>
<Border MouseDown="DragMove" Style="{StaticResource BorderBG}"> <Border MouseDown="DragMove" Style="{StaticResource BorderBG}" hc:Dialog.Token="IconUrlDialog">
<!--<Border.Background> <!--<Border.Background>
--><!--<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>--><!-- --><!--<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>--><!--
<LinearGradientBrush Opacity="0.97"> <LinearGradientBrush Opacity="0.97">
@@ -47,6 +49,7 @@
<GradientStop Color="#97D282" Offset="1"/> <GradientStop Color="#97D282" Offset="1"/>
</LinearGradientBrush> </LinearGradientBrush>
</Border.Background>--> </Border.Background>-->
<hc:DialogContainer>
<Grid MouseDown="DragMove"> <Grid MouseDown="DragMove">
<TextBox x:Name="CheckSettingUrl" 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" <hc:TabControl x:Name="MyTabControl"
@@ -76,6 +79,7 @@
<Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Style="{StaticResource Btn1}" Margin="447,397.5,71,22.5"/> <Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Style="{StaticResource Btn1}" Margin="447,397.5,71,22.5"/>
<Button Content="确定" Click="Confirm_Click" Style="{StaticResource Btn1}" Margin="534,397.5,20,22.5" /> <Button Content="确定" Click="Confirm_Click" Style="{StaticResource Btn1}" Margin="534,397.5,20,22.5" />
</Grid> </Grid>
</hc:DialogContainer>
</Border> </Border>
</Grid> </Grid>

View File

@@ -1,4 +1,5 @@
using GeekDesk.Control.Other; using GeekDesk.Control.Other;
using GeekDesk.Interface;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
@@ -17,7 +18,7 @@ namespace GeekDesk.Control.Windows
/// <summary> /// <summary>
/// IconfontWindow.xaml 的交互逻辑 /// IconfontWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class IconfontWindow : Window public partial class IconfontWindow : Window, IWindowCommon
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static MenuInfo menuInfo; private static MenuInfo menuInfo;
@@ -71,7 +72,7 @@ namespace GeekDesk.Control.Windows
{ {
LoadingEle.Visibility = Visibility.Visible; LoadingEle.Visibility = Visibility.Visible;
CustomIcon.Visibility = Visibility.Collapsed; CustomIcon.Visibility = Visibility.Collapsed;
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig)); HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
} else } else
{ {
if (customIcons == null) if (customIcons == null)
@@ -132,6 +133,7 @@ namespace GeekDesk.Control.Windows
window = new IconfontWindow(listInfo, menuInfo); window = new IconfontWindow(listInfo, menuInfo);
} }
window.Show(); window.Show();
Keyboard.Focus(window);
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false); ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
} }
@@ -172,6 +174,13 @@ namespace GeekDesk.Control.Windows
} }
} }
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.Close();
}
}
public class IconfontViewModel : INotifyPropertyChanged public class IconfontViewModel : INotifyPropertyChanged
{ {

View File

@@ -11,8 +11,11 @@
Height="450" Height="450"
Width="510" Width="510"
WindowStyle="None" WindowStyle="None"
Title=""
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False" Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown"
> >
<Window.Resources> <Window.Resources>
<cvt:TodoTaskExecConvert x:Key="TodoTaskExecConvert"/> <cvt:TodoTaskExecConvert x:Key="TodoTaskExecConvert"/>

View File

@@ -1,4 +1,5 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Interface;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
@@ -22,7 +23,7 @@ namespace GeekDesk.Control.Windows
/// <summary> /// <summary>
/// BacklogInfoWindow.xaml 的交互逻辑 /// BacklogInfoWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class ToDoInfoWindow public partial class ToDoInfoWindow : IWindowCommon
{ {
private static int windowType = -1; private static int windowType = -1;
@@ -207,6 +208,7 @@ namespace GeekDesk.Control.Windows
{ {
window = new ToDoInfoWindow(); window = new ToDoInfoWindow();
window.Show(); window.Show();
Keyboard.Focus(window);
} }
window.Visibility = Visibility.Collapsed; window.Visibility = Visibility.Collapsed;
windowType = NEW_TODO; windowType = NEW_TODO;
@@ -222,6 +224,7 @@ namespace GeekDesk.Control.Windows
} }
windowType = DETAIL_TODO; windowType = DETAIL_TODO;
window2.Show(); window2.Show();
Keyboard.Focus(window2);
} }
private void ExecType_Checked(object sender, RoutedEventArgs e) private void ExecType_Checked(object sender, RoutedEventArgs e)
@@ -239,5 +242,13 @@ namespace GeekDesk.Control.Windows
break; break;
} }
} }
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.Close();
}
}
} }
} }

View File

@@ -13,6 +13,8 @@
WindowStyle="None" WindowStyle="None"
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False" Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown"
> >
<Grid Margin="50"> <Grid Margin="50">

View File

@@ -1,4 +1,5 @@
using GeekDesk.Control.UserControls.Backlog; using GeekDesk.Control.UserControls.Backlog;
using GeekDesk.Interface;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using System; using System;
@@ -21,7 +22,7 @@ namespace GeekDesk.Control.Windows
/// <summary> /// <summary>
/// BacklogWindow.xaml 的交互逻辑 /// BacklogWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class ToDoWindow public partial class ToDoWindow : IWindowCommon
{ {
private static TodoControl backlog = new TodoControl(); private static TodoControl backlog = new TodoControl();
private AppData appData = MainWindow.appData; private AppData appData = MainWindow.appData;
@@ -94,8 +95,15 @@ namespace GeekDesk.Control.Windows
window = new ToDoWindow(); window = new ToDoWindow();
} }
window.Show(); window.Show();
Keyboard.Focus(window);
} }
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.Close();
}
}
} }
} }

View File

@@ -9,7 +9,10 @@
Height="460" Width="610" Height="460" Width="610"
WindowStyle="None" WindowStyle="None"
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"> Title=""
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown">
<Grid Margin="20"> <Grid Margin="20">
<Grid.Effect> <Grid.Effect>
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray" <DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"

View File

@@ -1,4 +1,5 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Interface;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@@ -23,7 +24,7 @@ namespace GeekDesk.Control.Windows
/// <summary> /// <summary>
/// UpdateWindow.xaml 的交互逻辑 /// UpdateWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class UpdateWindow : Window public partial class UpdateWindow : Window, IWindowCommon
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static string githubUrl = ""; private static string githubUrl = "";
@@ -103,6 +104,15 @@ namespace GeekDesk.Control.Windows
window = new UpdateWindow(jo); window = new UpdateWindow(jo);
} }
window.Show(); window.Show();
Keyboard.Focus(window);
}
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.Close();
}
} }
} }
} }

View File

@@ -189,6 +189,7 @@
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" /> <Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" /> <Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="Converts\HideTypeConvert.cs" /> <Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Interface\IWindowCommon.cs" />
<Compile Include="Task\ToDoTask.cs" /> <Compile Include="Task\ToDoTask.cs" />
<Compile Include="Thread\MouseHookThread.cs" /> <Compile Include="Thread\MouseHookThread.cs" />
<Compile Include="Thread\DispatcherBuild.cs" /> <Compile Include="Thread\DispatcherBuild.cs" />

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace GeekDesk.Interface
{
public interface IWindowCommon
{
void OnKeyDown(object sender, KeyEventArgs e);
}
}

View File

@@ -9,7 +9,7 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
x:Name="window" x:Name="window"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
Title="GeekDesk" Title="GeekDesk"
d:DesignHeight="500" d:DesignWidth="700" d:DesignHeight="500" d:DesignWidth="700"
WindowStyle="None" WindowStyle="None"
@@ -19,6 +19,8 @@
Opacity="0" Opacity="0"
Deactivated="Window_Deactivated" Deactivated="Window_Deactivated"
SizeChanged="Window_SizeChanged" SizeChanged="Window_SizeChanged"
KeyDown="OnKeyDown"
Focusable="True"
> >
<WindowChrome.WindowChrome> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/> <WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
@@ -92,6 +94,7 @@
Click="ConfigButtonClick" Click="ConfigButtonClick"
Initialized="SettingButton_Initialized" Initialized="SettingButton_Initialized"
x:Name="SettingButton" x:Name="SettingButton"
FocusVisualStyle="{x:Null}"
> >
<Button.ContextMenu> <Button.ContextMenu>
<ContextMenu x:Name="SettingMenus" Width="130"> <ContextMenu x:Name="SettingMenus" Width="130">
@@ -107,6 +110,7 @@
hc:IconElement.Width="18" hc:IconElement.Width="18"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Click="CloseButtonClick" Click="CloseButtonClick"
FocusVisualStyle="{x:Null}"
/> />
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
@@ -114,6 +118,7 @@
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/> <uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
<!--分割线--> <!--分割线-->
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/> <GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
@@ -124,7 +129,7 @@
<hc:NotifyIcon.ContextMenu> <hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130"> <ContextMenu Width="130">
<MenuItem Header="打开面板" Click="ShowApp"/> <MenuItem Header="打开面板" Click="ShowApp"/>
<MenuItem Header="关闭托盘图标" Click="CloseBarIcon"/> <MenuItem Header="关闭图标" Click="CloseBarIcon"/>
<MenuItem Header="待办" Click="BacklogMenuClick"/> <MenuItem Header="待办" Click="BacklogMenuClick"/>
<MenuItem Header="程序目录" Click="OpenThisDir"/> <MenuItem Header="程序目录" Click="OpenThisDir"/>
<MenuItem Header="设置" Click="ConfigApp"/> <MenuItem Header="设置" Click="ConfigApp"/>

View File

@@ -3,6 +3,7 @@ using GeekDesk.Constant;
using GeekDesk.Control; using GeekDesk.Control;
using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.Interface;
using GeekDesk.Task; using GeekDesk.Task;
using GeekDesk.Thread; using GeekDesk.Thread;
using GeekDesk.Util; using GeekDesk.Util;
@@ -29,13 +30,10 @@ namespace GeekDesk
/// MainWindow.xaml 的交互逻辑 /// MainWindow.xaml 的交互逻辑
/// </summary> /// </summary>
/// ///
public partial class MainWindow : Window public partial class MainWindow : Window, IWindowCommon
{ {
//public IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
public static AppData appData = CommonCode.GetAppDataByFile(); public static AppData appData = CommonCode.GetAppDataByFile();
//public static ToDoInfoWindow toDoInfoWindow = (ToDoInfoWindow)ToDoInfoWindow.GetThis();
public static ToDoInfoWindow toDoInfoWindow; public static ToDoInfoWindow toDoInfoWindow;
public static int hotKeyId = -1; public static int hotKeyId = -1;
public static int toDoHotKeyId = -1; public static int toDoHotKeyId = -1;
@@ -95,6 +93,7 @@ namespace GeekDesk
ShowApp(); ShowApp();
} }
//给任务栏图标一个名字
BarIcon.Text = Constants.MY_NAME; BarIcon.Text = Constants.MY_NAME;
//注册热键 //注册热键
@@ -108,36 +107,15 @@ namespace GeekDesk
} }
//注册鼠标中键监听事件 //注册鼠标中键监听事件
//m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt; if (appData.AppConfig.MouseMiddleShow)
{
MouseHookThread.MiddleHook(); MouseHookThread.MiddleHook();
}
//更新线程开启 检测更新 //更新线程开启 检测更新
UpdateThread.Update(); UpdateThread.Update();
} }
/// <summary>
/// 鼠标中键呼出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//private void M_GlobalHook_MouseUpExt(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// if (appData.AppConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
// {
// if (MotionControl.hotkeyFinished)
// {
// if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0)
// {
// ShowApp();
// }
// else
// {
// HideApp();
// }
// }
// }
//}
/// <summary> /// <summary>
/// 注册当前窗口的热键 /// 注册当前窗口的热键
/// </summary> /// </summary>
@@ -283,10 +261,6 @@ namespace GeekDesk
/// <param name="e"></param> /// <param name="e"></param>
private void DragMove(object sender, MouseEventArgs e) private void DragMove(object sender, MouseEventArgs e)
{ {
//if (e.LeftButton == MouseButtonState.Pressed)
//{
// this.DragMove();
//}
if (e.LeftButton == MouseButtonState.Pressed) if (e.LeftButton == MouseButtonState.Pressed)
{ {
@@ -303,7 +277,6 @@ namespace GeekDesk
(When clicking the drag area, make the window follow) */ (When clicking the drag area, make the window follow) */
DragMove(); DragMove();
if (this.ResizeMode != windowMode) if (this.ResizeMode != windowMode)
{ {
this.ResizeMode = windowMode; this.ResizeMode = windowMode;
@@ -426,6 +399,10 @@ namespace GeekDesk
/// <param name="e"></param> /// <param name="e"></param>
private void ExitApp(object sender, RoutedEventArgs e) private void ExitApp(object sender, RoutedEventArgs e)
{ {
if (appData.AppConfig.MouseMiddleShow)
{
MouseHookThread.Dispose();
}
Application.Current.Shutdown(); Application.Current.Shutdown();
} }
@@ -506,10 +483,13 @@ namespace GeekDesk
/// <param name="e"></param> /// <param name="e"></param>
private void ReStartApp(object sender, RoutedEventArgs e) private void ReStartApp(object sender, RoutedEventArgs e)
{ {
MouseHookThread.Dispose();
Process p = new Process(); Process p = new Process();
p.StartInfo.FileName = Constants.APP_DIR + Constants.MY_NAME + ".exe"; p.StartInfo.FileName = Constants.APP_DIR + Constants.MY_NAME + ".exe";
p.StartInfo.WorkingDirectory = Constants.APP_DIR; p.StartInfo.WorkingDirectory = Constants.APP_DIR;
p.Start(); p.Start();
Application.Current.Shutdown(); Application.Current.Shutdown();
} }
@@ -522,6 +502,15 @@ namespace GeekDesk
{ {
appData.AppConfig.ShowBarIcon = false; appData.AppConfig.ShowBarIcon = false;
} }
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
HideApp();
}
}
} }

View File

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

View File

@@ -15,19 +15,28 @@ namespace GeekDesk.Thread
public class MouseHookThread public class MouseHookThread
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
public static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents(); private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
private static Dispatcher dispatcher;
public static void MiddleHook() public static void MiddleHook()
{ {
//使用dispatcher来单独监听UI线程 防止程序卡顿 //使用dispatcher来单独监听UI线程 防止程序卡顿
Dispatcher dispatcher = DispatcherBuild.Build(); dispatcher = DispatcherBuild.Build();
dispatcher.Invoke((Action)(() => dispatcher.Invoke((Action)(() =>
{ {
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt; m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
})); }));
} }
public static void Dispose()
{
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose();
dispatcher.InvokeShutdown();
}
/// <summary> /// <summary>
/// 鼠标中键呼出 /// 鼠标中键呼出
/// </summary> /// </summary>

View File

@@ -1,9 +1,9 @@
{ {
"title": "<22><EFBFBD><E6B1BE><EFBFBD><EFBFBD>", "title": "GeekDesk<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"subTitle": "V2.3.20 <20><>ʽ<EFBFBD><CABD>", "subTitle": "V2.3.21",
"msgTitle": "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "msgTitle": "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"msg": "['һ<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>޸<EFBFBD><DEB8><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>bug<75><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ֹ<EFBFBD><D6B9><EFBFBD>','<27>޸<EFBFBD><DEB8>޷<EFBFBD><DEB7>޸IJ˵<C4B2>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>bug','<27>޸<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״bug','<27>޸<EFBFBD><DEB8>ȼ<EFBFBD><C8BC><EFBFBD>֧<EFBFBD><D6A7>Alt<6C><74>bug','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>star<EFBFBD><EFBFBD>']", "msg": "['<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>ڿ<EFBFBD>Esc<EFBFBD>˳<EFBFBD>','<27>޸<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BUG,<2C><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>D<EFBFBD>̵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ','<27>޸<EFBFBD><DEB8><EFBFBD>֪<EFBFBD><D6AA><EFBFBD><EFBFBD>']",
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases", "githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases", "giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.3.20" "version": "2.3.21"
} }

View File

@@ -74,7 +74,6 @@ namespace GeekDesk.Util
myEncoderParameters.Param[0] = myEncoderParameter; myEncoderParameters.Param[0] = myEncoderParameter;
bmp.Save(strm, myImageCodecInfo, myEncoderParameters); bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
bmp.Save("d:\\test.png", myImageCodecInfo, myEncoderParameters);
BitmapImage bmpImage = new BitmapImage(); BitmapImage bmpImage = new BitmapImage();
bmpImage.BeginInit(); bmpImage.BeginInit();
strm.Seek(0, SeekOrigin.Begin); strm.Seek(0, SeekOrigin.Begin);

View File

@@ -4,6 +4,7 @@ using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using System.Windows; using System.Windows;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
@@ -13,6 +14,7 @@ namespace GeekDesk.Util
{ {
class ImageUtil class ImageUtil
{ {
private static readonly string SYSTEM_ITEM = "::{.*}";
/// <summary> /// <summary>
/// 图片数组转 BitmapImage /// 图片数组转 BitmapImage
@@ -84,7 +86,7 @@ namespace GeekDesk.Util
/// <returns></returns> /// <returns></returns>
public static BitmapImage GetBitmapIconByPath(string filePath) public static BitmapImage GetBitmapIconByPath(string filePath)
{ {
if (File.Exists(filePath)) if (File.Exists(filePath) || IsSystemItem(filePath))
{ {
if (IsImage(filePath)) { if (IsImage(filePath)) {
//图片 //图片
@@ -334,5 +336,15 @@ namespace GeekDesk.Util
} }
/// <summary>
/// 判断是否为系统项
/// </summary>
/// <returns></returns>
public static bool IsSystemItem(string path)
{
return Regex.IsMatch(path, SYSTEM_ITEM);
}
} }
} }