'边缘吸附功能','窗口淡入淡出动画','待办任务快捷键(默认Ctrl+Shift+Q)','右键任务栏图标打开程序目录菜单'
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="Version" value="2.1" />
|
<add key="Version" value="2.2" />
|
||||||
<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" />
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ namespace GeekDesk
|
|||||||
private void App_Startup(object sender, StartupEventArgs e)
|
private void App_Startup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool ret;
|
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
System.Threading.Thread.Sleep(2000);
|
||||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
@@ -32,6 +35,7 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,5 +14,6 @@ namespace GeekDesk.Constant
|
|||||||
IMAGE_HEIGHT_AM = 52, //动画变换高度
|
IMAGE_HEIGHT_AM = 52, //动画变换高度
|
||||||
IMAGE_PANEL_WIDTH = 110, //图标容器宽度
|
IMAGE_PANEL_WIDTH = 110, //图标容器宽度
|
||||||
IMAGE_PANEL_HEIGHT = 90, //图标容器高度
|
IMAGE_PANEL_HEIGHT = 90, //图标容器高度
|
||||||
|
WINDOW_ANIMATION_TIME = 200, //主窗口动画时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace GeekDesk.Constant
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// app数据文件路径
|
/// app数据文件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string DATA_FILE_PATH = APP_DIR + "//Data"; //app数据文件路径
|
public static string DATA_FILE_PATH = APP_DIR + "Data"; //app数据文件路径
|
||||||
|
|
||||||
//默认文件夹图标
|
//默认文件夹图标
|
||||||
public static string DEFAULT_DIR_IMAGE_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASISURBVHhe7dvPi9R1HMfx/Qu6RYfqEp1CZ8Yko0MQRNEPgnQ36FJEFyPoF/0DHbx06dSlnVkF6SgEgocOYUEG0cFWpQ476yhbQfTDslJxk+k79S1IP/NSF3f2O+7jBY/TKgvz/j5nXMUZMzMzMzMzMzMzMzMzMzMzu959023dsbSw9YGlbuchyk7v3XbP0t5tt9Yvmd3MW3r//luWu623TvbahytDrtvBQa/9xvJ85776JbWbZf359s7quCcKR2cNqjeaQ/35zgv1y2vTvOqgOy4/MDdG9abzwWC+06lfapu2jf4cXTosN9SZ5W7n9folt2nZ6Ifw6niDy47JelloH6hfepuGLffa7xQPyfpZaL9Xv/zW5K307r27eEDWXfXG9GJ9BmvqqneyV0rHYzL63a3b61NYEzfodT4rHY4J8UetZq/6mF8pHo6J8SnS4JUOxqS19tTnsKatfDAm7Hh9DmvaCsdiAwx6rcfqk1iTVjoWkzfotd+uT2JNWulYTN5yr/VFfRJr0krHYoN0t7Tqs1hTVjwUG6L6OeS1+izWlJUOxYb5xb+JNGyFI7Gxfqp+YN83+h+drK/+wtbH+3u33FmnUF7hQLCpLPfaSycX2u/WSfx/pd8Am1H1yf3d6FOlTuOflX4hbGrd1vN1HgKBou6W2wQC4+0XCASnuu1dAoGxWnsEAmMMeq1DAoExRn/tKxAIBALBmgMZ7Nsx/Pbgc9B4J3udK57fa7WmQEbf1GyatnLg6eKzfDVrCuTcypH625pNx37rHyo+y1ezpkAufL9Yf1uz6dgfpz8uPstXIxDbFBOIWZhAzMIEYhYmELMwgZiFCcQsTCBmYQIxCxOIWZhAzMIEYhYmELMwgZiFrTmQ0/u3D89+8tjw/OdPXbPVr18eXlp6E6bG6le7i8/yOL8efnR4at+24czvR54Y/nl8DrjM6INjpvQFYG548ehOgcA4AoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCC4e3XVJIDBG9QmyKhAY4+Li7HmBwBirx2bPCgTGOTH3g0BgHIFAIBAI6kDOXPEFoDLbn7l0bG53+YuwyS3OPTsz2oVjs3etLs49OM65T5/c9fNHj7z044cPvwrTbvQsj57p0rP+r3NfPnP733GYmZmZmZmZmZmZmZmZmZnZf5uZ+QsdP8v10G4AYgAAAABJRU5ErkJggg==";
|
public static string DEFAULT_DIR_IMAGE_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASISURBVHhe7dvPi9R1HMfx/Qu6RYfqEp1CZ8Yko0MQRNEPgnQ36FJEFyPoF/0DHbx06dSlnVkF6SgEgocOYUEG0cFWpQ476yhbQfTDslJxk+k79S1IP/NSF3f2O+7jBY/TKgvz/j5nXMUZMzMzMzMzMzMzMzMzMzMzu959023dsbSw9YGlbuchyk7v3XbP0t5tt9Yvmd3MW3r//luWu623TvbahytDrtvBQa/9xvJ85776JbWbZf359s7quCcKR2cNqjeaQ/35zgv1y2vTvOqgOy4/MDdG9abzwWC+06lfapu2jf4cXTosN9SZ5W7n9folt2nZ6Ifw6niDy47JelloH6hfepuGLffa7xQPyfpZaL9Xv/zW5K307r27eEDWXfXG9GJ9BmvqqneyV0rHYzL63a3b61NYEzfodT4rHY4J8UetZq/6mF8pHo6J8SnS4JUOxqS19tTnsKatfDAm7Hh9DmvaCsdiAwx6rcfqk1iTVjoWkzfotd+uT2JNWulYTN5yr/VFfRJr0krHYoN0t7Tqs1hTVjwUG6L6OeS1+izWlJUOxYb5xb+JNGyFI7Gxfqp+YN83+h+drK/+wtbH+3u33FmnUF7hQLCpLPfaSycX2u/WSfx/pd8Am1H1yf3d6FOlTuOflX4hbGrd1vN1HgKBou6W2wQC4+0XCASnuu1dAoGxWnsEAmMMeq1DAoExRn/tKxAIBALBmgMZ7Nsx/Pbgc9B4J3udK57fa7WmQEbf1GyatnLg6eKzfDVrCuTcypH625pNx37rHyo+y1ezpkAufL9Yf1uz6dgfpz8uPstXIxDbFBOIWZhAzMIEYhYmELMwgZiFCcQsTCBmYQIxCxOIWZhAzMIEYhYmELMwgZiFrTmQ0/u3D89+8tjw/OdPXbPVr18eXlp6E6bG6le7i8/yOL8efnR4at+24czvR54Y/nl8DrjM6INjpvQFYG548ehOgcA4AoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCC4e3XVJIDBG9QmyKhAY4+Li7HmBwBirx2bPCgTGOTH3g0BgHIFAIBAI6kDOXPEFoDLbn7l0bG53+YuwyS3OPTsz2oVjs3etLs49OM65T5/c9fNHj7z044cPvwrTbvQsj57p0rP+r3NfPnP733GYmZmZmZmZmZmZmZmZmZnZf5uZ+QsdP8v10G4AYgAAAABJRU5ErkJggg==";
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<hc:SimplePanel Margin="20,50,20,20" >
|
<hc:SimplePanel Margin="20,50,20,20" >
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
||||||
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
|
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk V"/>
|
||||||
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
||||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
|
|||||||
@@ -13,11 +13,11 @@
|
|||||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid Background="AliceBlue" MouseDown="DragMove">
|
<Grid Background="AliceBlue" MouseDown="DragMove">
|
||||||
<hc:SimplePanel Margin="20" >
|
<StackPanel Margin="10">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -36,10 +36,31 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,89.49,-30,-79.49" Grid.ColumnSpan="4">
|
|
||||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Checked="MarginHide_Changed" Unchecked="MarginHide_Changed">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,115,20,-102.337" Grid.ColumnSpan="4">
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Content="主窗口动画效果" IsChecked="{Binding AppAnimation}" Checked="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="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
||||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
||||||
@@ -51,11 +72,11 @@
|
|||||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,164.49,-30,-154.49" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="热键设置" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
<TextBlock Text="热键设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板:" Width="55"/>
|
<TextBlock Text="主面板:" VerticalAlignment="Center" Width="55"/>
|
||||||
<hc:TextBox HorizontalAlignment="Left"
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
Tag="Main"
|
Tag="Main"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
@@ -65,9 +86,9 @@
|
|||||||
Text="{Binding HotkeyStr}"
|
Text="{Binding HotkeyStr}"
|
||||||
KeyDown="HotKeyDown"
|
KeyDown="HotKeyDown"
|
||||||
KeyUp="HotKeyUp"
|
KeyUp="HotKeyUp"
|
||||||
Margin="12.967,-7.38,-12.967,0"/>
|
/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<!--<hc:UniformSpacingPanel Spacing="10" Margin="30,229,0,-216.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="新建待办:" Width="55"/>
|
<TextBlock Text="新建待办:" Width="55"/>
|
||||||
<hc:TextBox HorizontalAlignment="Left"
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
Tag="ToDo"
|
Tag="ToDo"
|
||||||
@@ -78,10 +99,10 @@
|
|||||||
Text="{Binding ToDoHotkeyStr}"
|
Text="{Binding ToDoHotkeyStr}"
|
||||||
KeyDown="HotKeyDown"
|
KeyDown="HotKeyDown"
|
||||||
KeyUp="HotKeyUp"
|
KeyUp="HotKeyUp"
|
||||||
Margin="12.967,-7.38,-12.967,0"/>
|
/>
|
||||||
</hc:UniformSpacingPanel>-->
|
</hc:UniformSpacingPanel>
|
||||||
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
|
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
|
||||||
</hc:SimplePanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
@@ -19,6 +20,7 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using static GeekDesk.Util.GlobalHotKey;
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
{
|
{
|
||||||
@@ -212,14 +214,16 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
{
|
{
|
||||||
if (MainWindow.hotKeyId != -1)
|
if (MainWindow.hotKeyId != -1)
|
||||||
{
|
{
|
||||||
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||||
}
|
}
|
||||||
MainWindow.RegisterHotKey(false);
|
MainWindow.RegisterHotKey(false);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (MainWindow.toDoHotKeyId != -1)
|
if (MainWindow.toDoHotKeyId != -1)
|
||||||
{
|
{
|
||||||
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||||
}
|
}
|
||||||
MainWindow.RegisterCreateToDoHotKey(false);
|
MainWindow.RegisterCreateToDoHotKey(false);
|
||||||
}
|
}
|
||||||
@@ -242,66 +246,30 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void ShowApp(MainWindow mainWindow)
|
private void MarginHide_Changed(object sender, RoutedEventArgs e)
|
||||||
//{
|
{
|
||||||
// if (appConfig.FollowMouse)
|
if (appConfig.MarginHide)
|
||||||
// {
|
{
|
||||||
// ShowAppAndFollowMouse(mainWindow);
|
MainWindow.hide.TimerSet();
|
||||||
// }
|
} else
|
||||||
// else
|
{
|
||||||
// {
|
if (MainWindow.hide.timer != null)
|
||||||
// this.Visibility = Visibility.Visible;
|
{
|
||||||
// }
|
MainWindow.hide.TimerStop();
|
||||||
// Keyboard.Focus(this);
|
}
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
///// <summary>
|
|
||||||
///// 随鼠标位置显示面板 (鼠标始终在中间)
|
private void Animation_Checked(object sender, RoutedEventArgs e)
|
||||||
///// </summary>
|
{
|
||||||
//private void ShowAppAndFollowMouse(MainWindow mainWindow)
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed)
|
||||||
//{
|
{
|
||||||
// //获取鼠标位置
|
MainWindow.mainWindow.Visibility = Visibility.Visible;
|
||||||
// System.Windows.Point p = MouseUtil.GetMousePosition();
|
// 执行一下动画 防止太过突兀
|
||||||
// double left = SystemParameters.VirtualScreenLeft;
|
MainWindow.FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
// double top = SystemParameters.VirtualScreenTop;
|
}
|
||||||
// double width = SystemParameters.VirtualScreenWidth;
|
}
|
||||||
// double height = SystemParameters.VirtualScreenHeight;
|
|
||||||
// double right = width - Math.Abs(left);
|
|
||||||
// double bottom = height - Math.Abs(top);
|
|
||||||
|
|
||||||
|
|
||||||
// if (p.X - mainWindow.Width / 2 < left)
|
|
||||||
// {
|
|
||||||
// //判断是否在最左边缘
|
|
||||||
// mainWindow.Left = left;
|
|
||||||
// }
|
|
||||||
// else if (p.X + mainWindow.Width / 2 > right)
|
|
||||||
// {
|
|
||||||
// //判断是否在最右边缘
|
|
||||||
// mainWindow.Left = right - mainWindow.Width;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// mainWindow.Left = p.X - mainWindow.Width / 2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// if (p.Y - mainWindow.Height / 2 < top)
|
|
||||||
// {
|
|
||||||
// //判断是否在最上边缘
|
|
||||||
// mainWindow.Top = top;
|
|
||||||
// }
|
|
||||||
// else if (p.Y + mainWindow.Height / 2 > bottom)
|
|
||||||
// {
|
|
||||||
// //判断是否在最下边缘
|
|
||||||
// mainWindow.Top = bottom - mainWindow.Height;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// mainWindow.Top = p.Y - mainWindow.Height / 2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// mainWindow.Visibility = Visibility.Visible;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
MouseEnter="StackPanel_MouseEnter"
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
>
|
>
|
||||||
<Image CacheMode="{Binding BitmapCache}" Style="{StaticResource ImageStyle}"/>
|
<Image Style="{StaticResource ImageStyle}"/>
|
||||||
<TextBlock MaxWidth="80"
|
<TextBlock MaxWidth="80"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
|
|||||||
@@ -130,15 +130,35 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
p.StartInfo.ErrorDialog = false;
|
p.StartInfo.ErrorDialog = false;
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||||
{
|
{
|
||||||
Window parentWin = Window.GetWindow(this);
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
parentWin.Visibility = Visibility.Collapsed;
|
if (appData.AppConfig.MarginHide)
|
||||||
|
{
|
||||||
|
if (!MainWindow.hide.IsMargin())
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;// c#好像不能case穿透
|
break;// c#好像不能case穿透
|
||||||
case IconStartType.DEFAULT_STARTUP:
|
case IconStartType.DEFAULT_STARTUP:
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||||
{
|
{
|
||||||
Window parentWin = Window.GetWindow(this);
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
parentWin.Visibility = Visibility.Collapsed;
|
if (appData.AppConfig.MarginHide)
|
||||||
|
{
|
||||||
|
if (!MainWindow.hide.IsMargin())
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IconStartType.SHOW_IN_EXPLORE:
|
case IconStartType.SHOW_IN_EXPLORE:
|
||||||
@@ -243,16 +263,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
|
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
ImgStroyBoard(sender, (int)CommonEnum.IMAGE_HEIGHT_AM, (int)CommonEnum.IMAGE_WIDTH_AM, 1);
|
ImgStoryBoard(sender, (int)CommonEnum.IMAGE_HEIGHT_AM, (int)CommonEnum.IMAGE_WIDTH_AM, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
ImgStroyBoard(sender, (int)CommonEnum.IMAGE_HEIGHT, (int)CommonEnum.IMAGE_WIDTH, 500);
|
ImgStoryBoard(sender, (int)CommonEnum.IMAGE_HEIGHT, (int)CommonEnum.IMAGE_WIDTH, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ImgStroyBoard(object sender, int height, int width, int milliseconds)
|
private void ImgStoryBoard(object sender, int height, int width, int milliseconds)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (appData.AppConfig.PMModel) return;
|
if (appData.AppConfig.PMModel) return;
|
||||||
@@ -278,6 +298,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
Timeline.SetDesiredFrameRate(heightAnimation, 60);
|
Timeline.SetDesiredFrameRate(heightAnimation, 60);
|
||||||
Timeline.SetDesiredFrameRate(widthAnimation, 60);
|
Timeline.SetDesiredFrameRate(widthAnimation, 60);
|
||||||
|
|
||||||
|
img.BeginAnimation(HeightProperty, null);
|
||||||
|
img.BeginAnimation(WidthProperty, null);
|
||||||
|
|
||||||
img.BeginAnimation(HeightProperty, heightAnimation);
|
img.BeginAnimation(HeightProperty, heightAnimation);
|
||||||
img.BeginAnimation(WidthProperty, widthAnimation);
|
img.BeginAnimation(WidthProperty, widthAnimation);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,6 +149,18 @@ namespace GeekDesk.Control.Windows
|
|||||||
window.Visibility = Visibility.Visible;
|
window.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ShowOrHide()
|
||||||
|
{
|
||||||
|
if (window == null || !window.Activate())
|
||||||
|
{
|
||||||
|
window = new ToDoInfoWindow();
|
||||||
|
window.Show();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static System.Windows.Window GetThis()
|
public static System.Windows.Window GetThis()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -160,12 +160,13 @@
|
|||||||
<Compile Include="Task\ToDoTask.cs" />
|
<Compile Include="Task\ToDoTask.cs" />
|
||||||
<Compile Include="Thread\UpdateThread.cs" />
|
<Compile Include="Thread\UpdateThread.cs" />
|
||||||
<Compile Include="Util\AeroGlassHelper.cs" />
|
<Compile Include="Util\AeroGlassHelper.cs" />
|
||||||
|
<Compile Include="Util\GlobalHotKey.cs" />
|
||||||
<Compile Include="Util\CommonCode.cs" />
|
<Compile Include="Util\CommonCode.cs" />
|
||||||
<Compile Include="Util\ConsoleManager.cs" />
|
<Compile Include="Util\ConsoleManager.cs" />
|
||||||
<Compile Include="Util\DragAdorner.cs" />
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
<Compile Include="Util\FileIcon.cs" />
|
<Compile Include="Util\FileIcon.cs" />
|
||||||
<Compile Include="Util\FileUtil.cs" />
|
<Compile Include="Util\FileUtil.cs" />
|
||||||
<Compile Include="Util\HotKey.cs" />
|
<Compile Include="Util\MarginHide.cs" />
|
||||||
<Compile Include="Util\HttpUtil.cs" />
|
<Compile Include="Util\HttpUtil.cs" />
|
||||||
<Compile Include="Util\ImageUtil.cs" />
|
<Compile Include="Util\ImageUtil.cs" />
|
||||||
<Compile Include="Util\ListViewDragDropManager.cs" />
|
<Compile Include="Util\ListViewDragDropManager.cs" />
|
||||||
|
|||||||
@@ -14,10 +14,12 @@
|
|||||||
d:DesignHeight="500" d:DesignWidth="700"
|
d:DesignHeight="500" d:DesignWidth="700"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent"
|
Background="#00FFFFFF"
|
||||||
OpacityMask ="White"
|
OpacityMask ="White"
|
||||||
Deactivated="window_Deactivated"
|
ShowInTaskbar="False"
|
||||||
SizeChanged="window_SizeChanged"
|
Opacity="0"
|
||||||
|
Deactivated="Window_Deactivated"
|
||||||
|
SizeChanged="Window_SizeChanged"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
|
||||||
@@ -114,7 +116,9 @@
|
|||||||
<ContextMenu Width="130">
|
<ContextMenu Width="130">
|
||||||
<MenuItem Header="打开面板" Click="ShowApp"/>
|
<MenuItem Header="打开面板" Click="ShowApp"/>
|
||||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||||
|
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
||||||
<MenuItem Header="设置" Click="ConfigApp"/>
|
<MenuItem Header="设置" Click="ConfigApp"/>
|
||||||
|
<MenuItem Header="重启" Click="ReStartApp"/>
|
||||||
<MenuItem Header="退出" Click="ExitApp"/>
|
<MenuItem Header="退出" Click="ExitApp"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:NotifyIcon.ContextMenu>
|
</hc:NotifyIcon.ContextMenu>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
@@ -35,6 +36,7 @@ namespace GeekDesk
|
|||||||
public static int hotKeyId = -1;
|
public static int hotKeyId = -1;
|
||||||
public static int toDoHotKeyId = -1;
|
public static int toDoHotKeyId = -1;
|
||||||
public static MainWindow mainWindow;
|
public static MainWindow mainWindow;
|
||||||
|
public static MarginHide hide;
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
@@ -44,6 +46,13 @@ namespace GeekDesk
|
|||||||
this.Loaded += Window_Loaded;
|
this.Loaded += Window_Loaded;
|
||||||
this.SizeChanged += MainWindow_Resize;
|
this.SizeChanged += MainWindow_Resize;
|
||||||
ToDoTask.BackLogCheck();
|
ToDoTask.BackLogCheck();
|
||||||
|
|
||||||
|
////实例化隐藏 Hide类,进行时间timer设置
|
||||||
|
hide = new MarginHide(this);
|
||||||
|
if (appData.AppConfig.MarginHide)
|
||||||
|
{
|
||||||
|
hide.TimerSet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
@@ -62,14 +71,20 @@ namespace GeekDesk
|
|||||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!appData.AppConfig.StartedShowPanel)
|
if (!appData.AppConfig.StartedShowPanel)
|
||||||
|
{
|
||||||
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
this.Opacity = 0;
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
RegisterHotKey(true);
|
RegisterHotKey(true);
|
||||||
//RegisterCreateToDoHotKey(true);
|
RegisterCreateToDoHotKey(true);
|
||||||
|
|
||||||
if (!appData.AppConfig.SelfStartUped)
|
if (!appData.AppConfig.SelfStartUped)
|
||||||
{
|
{
|
||||||
@@ -88,18 +103,18 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
if (appData.AppConfig.HotkeyModifiers != 0)
|
if (appData.AppConfig.HotkeyModifiers != 0)
|
||||||
{
|
{
|
||||||
//加载完毕注册热键
|
|
||||||
hotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
{
|
{
|
||||||
if (mainWindow.Visibility == Visibility.Collapsed)
|
if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0)
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWindow.Visibility = Visibility.Collapsed;
|
HideApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -123,6 +138,39 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
|
||||||
|
{
|
||||||
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
DoubleAnimation opacityAnimation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = mainWindow.Opacity,
|
||||||
|
To = opacity,
|
||||||
|
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
|
||||||
|
};
|
||||||
|
opacityAnimation.Completed += (s, e) =>
|
||||||
|
{
|
||||||
|
mainWindow.BeginAnimation(OpacityProperty, null);
|
||||||
|
if (visibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
mainWindow.Opacity = 1;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
mainWindow.Opacity = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Timeline.SetDesiredFrameRate(opacityAnimation, 30);
|
||||||
|
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//防止关闭动画后 窗体仍是0透明度
|
||||||
|
mainWindow.Opacity = 1;
|
||||||
|
mainWindow.Visibility = visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册新建待办的热键
|
/// 注册新建待办的热键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -130,14 +178,15 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
|
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
|
||||||
{
|
{
|
||||||
//加载完毕注册热键
|
//加载完毕注册热键
|
||||||
toDoHotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
{
|
{
|
||||||
ToDoInfoWindow.ShowNone();
|
ToDoInfoWindow.ShowOrHide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -159,22 +208,6 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void DisplayWindowHotKeyPress(object sender, KeyPressedEventArgs e)
|
|
||||||
//{
|
|
||||||
// if (e.HotKey.Key == Key.Y)
|
|
||||||
// {
|
|
||||||
// if (this.Visibility == Visibility.Collapsed)
|
|
||||||
// {
|
|
||||||
// ShowApp();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// this.Visibility = Visibility.Collapsed;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow_Resize(object sender, System.EventArgs e)
|
void MainWindow_Resize(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -230,9 +263,15 @@ namespace GeekDesk
|
|||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -261,14 +300,17 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
||||||
} else
|
|
||||||
{
|
|
||||||
mainWindow.Visibility = Visibility.Visible;
|
|
||||||
}
|
}
|
||||||
|
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
Keyboard.Focus(mainWindow);
|
Keyboard.Focus(mainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void HideApp()
|
||||||
|
{
|
||||||
|
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -279,13 +321,13 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
|
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.Visibility == Visibility.Collapsed)
|
if (this.Visibility == Visibility.Collapsed || this.Opacity == 0)
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
HideApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +341,20 @@ namespace GeekDesk
|
|||||||
ConfigWindow.Show(appData.AppConfig, this);
|
ConfigWindow.Show(appData.AppConfig, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 右键任务栏图标打开程序目录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OpenThisDir(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = "Explorer.exe";
|
||||||
|
p.StartInfo.Arguments = "/e,/select," + Constants.APP_DIR + Constants.MY_NAME + ".exe";
|
||||||
|
p.Start();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 右键任务栏图标退出
|
/// 右键任务栏图标退出
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -311,17 +367,6 @@ namespace GeekDesk
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//public static void ShowContextMenu(IntPtr hAppWnd, Window taskBar, System.Windows.Point pt)
|
|
||||||
//{
|
|
||||||
// WindowInteropHelper helper = new WindowInteropHelper(taskBar);
|
|
||||||
// IntPtr callingTaskBarWindow = helper.Handle;
|
|
||||||
// IntPtr wMenu = GetSystemMenu(hAppWnd, false);
|
|
||||||
// // Display the menu
|
|
||||||
// uint command = TrackPopupMenuEx(wMenu, TPM.LEFTBUTTON | TPM.RETURNCMD, (int) pt.X, (int) pt.Y, callingTaskBarWindow, IntPtr.Zero);
|
|
||||||
// if (command == 0) return;
|
|
||||||
// PostMessage(hAppWnd, WM.SYSCOMMAND, new IntPtr(command), IntPtr.Zero);
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置图标
|
/// 设置图标
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -363,12 +408,16 @@ namespace GeekDesk
|
|||||||
private void App_LostFocus(object sender, RoutedEventArgs e)
|
private void App_LostFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
||||||
|
{
|
||||||
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
|
if (appData.AppConfig.MarginHide && !hide.IsMargin())
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void window_Deactivated(object sender, EventArgs e)
|
private void Window_Deactivated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
||||||
{
|
{
|
||||||
@@ -376,7 +425,7 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.DataContext != null)
|
if (this.DataContext != null)
|
||||||
{
|
{
|
||||||
@@ -385,6 +434,20 @@ namespace GeekDesk
|
|||||||
appData.AppConfig.WindowHeight = this.Height;
|
appData.AppConfig.WindowHeight = this.Height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重启
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ReStartApp(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = Constants.APP_DIR + Constants.MY_NAME + ".exe";
|
||||||
|
p.StartInfo.WorkingDirectory = Constants.APP_DIR;
|
||||||
|
p.Start();
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.1")]
|
[assembly: AssemblyVersion("2.2")]
|
||||||
[assembly: AssemblyFileVersion("2.1")]
|
[assembly: AssemblyFileVersion("2.2")]
|
||||||
|
|||||||
10
Update.json
10
Update.json
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title" : "<22>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
|
"title" : "<22>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
|
||||||
"subTitle" : "V2.1 <20><>ʽ<EFBFBD><CABD>",
|
"subTitle" : "V2.2 <20><>ʽ<EFBFBD><CABD>",
|
||||||
"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" : "['<27><><EFBFBD>ֳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD>ͼ<EFBFBD>깦<EFBFBD>ܳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>URL<52><4C>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>']",
|
"msg" : "['<27><>Ե<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD>ڵ<EFBFBD><EFBFBD>뵭<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>(Ĭ<><C4AC>Ctrl+Shift+Q)','<27>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><F2BFAAB3><EFBFBD>Ŀ¼<C4BF>˵<EFBFBD>']",
|
||||||
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag/2.1",
|
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag",
|
||||||
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases/2.1",
|
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||||
"version": "2.1"
|
"version": "2.2"
|
||||||
}
|
}
|
||||||
95
Util/GlobalHotKey.cs
Normal file
95
Util/GlobalHotKey.cs
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class GlobalHotKey
|
||||||
|
{
|
||||||
|
public enum HotkeyModifiers
|
||||||
|
{
|
||||||
|
MOD_ALT = 0x1,
|
||||||
|
MOD_CONTROL = 0x2,
|
||||||
|
MOD_SHIFT = 0x4,
|
||||||
|
MOD_WIN = 0x8
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int currentID;
|
||||||
|
const int WM_HOTKEY = 0x312;
|
||||||
|
private static Dictionary<int, Window> handleTemp = new Dictionary<int, Window>();
|
||||||
|
public static Dictionary<int, HotKeyCallBackHanlder> callbackTemp = new Dictionary<int, HotKeyCallBackHanlder>();
|
||||||
|
|
||||||
|
public delegate void HotKeyCallBackHanlder();
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a global hotkey
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="aKeyGestureString">e.g. Alt + Shift + Control + Win + S</param>
|
||||||
|
/// <param name="callback">Action to be called when hotkey is pressed</param>
|
||||||
|
/// <returns>true, if registration succeeded, otherwise false</returns>
|
||||||
|
public static int RegisterHotKey(string aKeyGestureString, HotKeyCallBackHanlder callback)
|
||||||
|
{
|
||||||
|
var c = new KeyGestureConverter();
|
||||||
|
KeyGesture aKeyGesture = (KeyGesture)c.ConvertFrom(aKeyGestureString);
|
||||||
|
return RegisterHotKey((HotkeyModifiers)aKeyGesture.Modifiers, aKeyGesture.Key, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int RegisterHotKey(HotkeyModifiers aModifier, Key key, HotKeyCallBackHanlder callback)
|
||||||
|
{
|
||||||
|
Window window = new Window
|
||||||
|
{
|
||||||
|
WindowStyle = WindowStyle.None,
|
||||||
|
Height = 0,
|
||||||
|
Width = 0,
|
||||||
|
Visibility = Visibility.Collapsed,
|
||||||
|
ShowInTaskbar = false
|
||||||
|
};
|
||||||
|
window.Show();
|
||||||
|
IntPtr handle = new WindowInteropHelper(window).Handle;
|
||||||
|
HwndSource hs = HwndSource.FromHwnd(handle);
|
||||||
|
hs.AddHook(WndProc);
|
||||||
|
currentID += 1;
|
||||||
|
if (!RegisterHotKey(handle, currentID, aModifier, (uint)KeyInterop.VirtualKeyFromKey(key)))
|
||||||
|
{
|
||||||
|
window.Close();
|
||||||
|
throw new Exception("RegisterHotKey Failed");
|
||||||
|
}
|
||||||
|
handleTemp.Add(currentID, window);
|
||||||
|
callbackTemp.Add(currentID, callback);
|
||||||
|
return currentID;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 快捷键消息处理
|
||||||
|
/// </summary>
|
||||||
|
static IntPtr WndProc(IntPtr windowHandle, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
|
{
|
||||||
|
if (msg == WM_HOTKEY)
|
||||||
|
{
|
||||||
|
int id = wParam.ToInt32();
|
||||||
|
if (callbackTemp.TryGetValue(id, out var callback))
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Dispose(int id)
|
||||||
|
{
|
||||||
|
bool test = UnregisterHotKey(new WindowInteropHelper(handleTemp[id]).Handle, id);
|
||||||
|
GlobalHotKey.handleTemp[id].Close();
|
||||||
|
GlobalHotKey.handleTemp.Remove(id);
|
||||||
|
GlobalHotKey.callbackTemp.Remove(id);
|
||||||
|
Console.WriteLine(test);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registers a hot key with Windows.
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);
|
||||||
|
// Unregisters the hot key with Windows.
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Interop;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 热键注册
|
|
||||||
/// </summary>
|
|
||||||
namespace GeekDesk.Util
|
|
||||||
{
|
|
||||||
|
|
||||||
class Hotkey
|
|
||||||
{
|
|
||||||
#region 系统api
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 注册快捷键
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="window">持有快捷键窗口</param>
|
|
||||||
/// <param name="fsModifiers">组合键</param>
|
|
||||||
/// <param name="key">快捷键</param>
|
|
||||||
/// <param name="callBack">回调函数</param>
|
|
||||||
public static int Regist(IntPtr windowHandle, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
|
|
||||||
{
|
|
||||||
HwndSource hs = HwndSource.FromHwnd(windowHandle);
|
|
||||||
hs.AddHook(WndProc);
|
|
||||||
|
|
||||||
int id = keyid++;
|
|
||||||
int vk = KeyInterop.VirtualKeyFromKey(key);
|
|
||||||
keymap.Add(id, callBack);
|
|
||||||
if (!RegisterHotKey(windowHandle, id, fsModifiers, (uint)vk)) throw new Exception("RegisterHotKey Failed");
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 快捷键消息处理
|
|
||||||
/// </summary>
|
|
||||||
static IntPtr WndProc(IntPtr windowHandle, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
|
||||||
{
|
|
||||||
if (msg == WM_HOTKEY)
|
|
||||||
{
|
|
||||||
int id = wParam.ToInt32();
|
|
||||||
if (keymap.TryGetValue(id, out var callback))
|
|
||||||
{
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return IntPtr.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 注销快捷键
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hWnd">持有快捷键窗口的句柄</param>
|
|
||||||
/// <param name="callBack">回调函数</param>
|
|
||||||
public static void UnRegist(IntPtr windowHandle, HotKeyCallBackHanlder callBack)
|
|
||||||
{
|
|
||||||
List<int> list = new List<int>(keymap.Keys);
|
|
||||||
for (int i=0; i < list.Count; i++)
|
|
||||||
{
|
|
||||||
if (keymap[list[i]] == callBack)
|
|
||||||
{
|
|
||||||
HwndSource hs = HwndSource.FromHwnd(windowHandle);
|
|
||||||
hs.RemoveHook(WndProc);
|
|
||||||
UnregisterHotKey(windowHandle, list[i]);
|
|
||||||
keymap.Remove(list[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int WM_HOTKEY = 0x312;
|
|
||||||
static int keyid = 10;
|
|
||||||
public static Dictionary<int, HotKeyCallBackHanlder> keymap = new Dictionary<int, HotKeyCallBackHanlder>();
|
|
||||||
|
|
||||||
public delegate void HotKeyCallBackHanlder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum HotkeyModifiers
|
|
||||||
{
|
|
||||||
MOD_ALT = 0x1,
|
|
||||||
MOD_CONTROL = 0x2,
|
|
||||||
MOD_SHIFT = 0x4,
|
|
||||||
MOD_WIN = 0x8
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
199
Util/MarginHide.cs
Normal file
199
Util/MarginHide.cs
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using System.Drawing; //添加引用
|
||||||
|
using System.Windows.Forms;//添加引用
|
||||||
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
|
||||||
|
enum HidePosition
|
||||||
|
{
|
||||||
|
TOP = 1,
|
||||||
|
LEFT = 2,
|
||||||
|
RIGHT = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MarginHide
|
||||||
|
{
|
||||||
|
readonly Window window;//定义使用该方法的窗体
|
||||||
|
|
||||||
|
private readonly int hideTime = 150;
|
||||||
|
|
||||||
|
private readonly int taskTime = 200;
|
||||||
|
|
||||||
|
private bool isHide;
|
||||||
|
|
||||||
|
public Timer timer;
|
||||||
|
//构造函数,传入将要匹配的窗体
|
||||||
|
public MarginHide(Window window)
|
||||||
|
{
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗体是否贴边
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool IsMargin()
|
||||||
|
{
|
||||||
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
|
double screenWidth = SystemParameters.VirtualScreenWidth;
|
||||||
|
|
||||||
|
double windowWidth = window.Width;
|
||||||
|
|
||||||
|
double windowTop = window.Top;
|
||||||
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
//窗体是否贴边
|
||||||
|
return (windowLeft <= screenLeft
|
||||||
|
|| windowTop <= screenTop
|
||||||
|
|| windowLeft + windowWidth + Math.Abs(screenLeft) >= screenWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 窗体贴边隐藏功能
|
||||||
|
private void TimerDealy(object o, EventArgs e)
|
||||||
|
{
|
||||||
|
if (window.Visibility != Visibility.Visible) return;
|
||||||
|
|
||||||
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
|
double screenWidth = SystemParameters.VirtualScreenWidth;
|
||||||
|
|
||||||
|
double windowHeight = window.Height;
|
||||||
|
double windowWidth = window.Width;
|
||||||
|
|
||||||
|
double windowTop = window.Top;
|
||||||
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
//获取鼠标位置
|
||||||
|
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||||
|
double mouseX = p.X;
|
||||||
|
double mouseY = p.Y;
|
||||||
|
|
||||||
|
//鼠标不在窗口上
|
||||||
|
if (mouseX < windowLeft || mouseX > windowLeft + windowWidth
|
||||||
|
|| mouseY < windowTop || mouseY > windowTop + windowHeight)
|
||||||
|
{
|
||||||
|
//上方隐藏条件
|
||||||
|
if (windowTop <= screenTop)
|
||||||
|
{
|
||||||
|
HideAnimation(windowTop, screenTop - windowHeight + 1, Window.TopProperty);
|
||||||
|
isHide = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//左侧隐藏条件
|
||||||
|
if (windowLeft <= screenLeft)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenLeft - windowWidth + 1, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//右侧隐藏条件
|
||||||
|
if (windowLeft + windowWidth + Math.Abs(screenLeft) >= screenWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - 1, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
|
||||||
|
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight)
|
||||||
|
{
|
||||||
|
//上方显示
|
||||||
|
if (windowTop <= screenTop - 1)
|
||||||
|
{
|
||||||
|
HideAnimation(windowTop, screenTop, Window.TopProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//左侧显示
|
||||||
|
if (windowLeft <= screenLeft -1)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenLeft, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//右侧显示
|
||||||
|
if (windowLeft + Math.Abs(screenLeft) == screenWidth -1)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - windowWidth, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public void TimerSet()
|
||||||
|
{
|
||||||
|
timer = new Timer();//添加timer计时器,隐藏功能
|
||||||
|
#region 计时器设置,隐藏功能
|
||||||
|
timer.Interval = taskTime;
|
||||||
|
timer.Tick += TimerDealy;
|
||||||
|
timer.Start();
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TimerStop()
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
//功能关闭 如果界面是隐藏状态 那么要显示界面 ↓
|
||||||
|
|
||||||
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
|
double screenWidth = SystemParameters.VirtualScreenWidth;
|
||||||
|
|
||||||
|
double windowWidth = window.Width;
|
||||||
|
|
||||||
|
double windowTop = window.Top;
|
||||||
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
//左侧显示
|
||||||
|
if (windowLeft <= screenLeft - 1)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenLeft, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//上方显示
|
||||||
|
if (windowTop <= screenTop - 1)
|
||||||
|
{
|
||||||
|
HideAnimation(windowTop, screenTop, Window.TopProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//右侧显示
|
||||||
|
if (windowLeft + Math.Abs(screenLeft) == screenWidth - 1)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - windowWidth, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void HideAnimation(double from, double to, DependencyProperty property)
|
||||||
|
{
|
||||||
|
DoubleAnimation da = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = from,
|
||||||
|
To = to,
|
||||||
|
Duration = new Duration(TimeSpan.FromMilliseconds(hideTime))
|
||||||
|
};
|
||||||
|
da.Completed += (s, e) =>
|
||||||
|
{
|
||||||
|
window.BeginAnimation(property, null);
|
||||||
|
};
|
||||||
|
Timeline.SetDesiredFrameRate(da, 30);
|
||||||
|
window.BeginAnimation(property, da);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -18,9 +18,9 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 随鼠标位置显示面板 (鼠标始终在中间)
|
/// 随鼠标位置显示面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Show(Window window, MousePosition position, double widthOffset, double heightOffset)
|
public static void Show(Window window, MousePosition position, double widthOffset = 0, double heightOffset = 0, bool visibility = true)
|
||||||
{
|
{
|
||||||
//获取鼠标位置
|
//获取鼠标位置
|
||||||
System.Windows.Point p = MouseUtil.GetMousePosition();
|
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||||
@@ -100,8 +100,12 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
window.Top = p.Y - afterHeight;
|
window.Top = p.Y - afterHeight;
|
||||||
}
|
}
|
||||||
|
if (visibility)
|
||||||
|
{
|
||||||
|
window.Opacity = 0;
|
||||||
window.Visibility = Visibility.Visible;
|
window.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.ComponentModel;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using static GeekDesk.Util.GlobalHotKey;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 程序设置
|
/// 程序设置
|
||||||
@@ -42,9 +43,9 @@ namespace GeekDesk.ViewModel
|
|||||||
private HotkeyModifiers hotkeyModifiers = HotkeyModifiers.MOD_CONTROL; //默认启动面板快捷键
|
private HotkeyModifiers hotkeyModifiers = HotkeyModifiers.MOD_CONTROL; //默认启动面板快捷键
|
||||||
private Key hotkey = Key.Q; //默认启动面板快捷键
|
private Key hotkey = Key.Q; //默认启动面板快捷键
|
||||||
|
|
||||||
private string toDoHotkeyStr; //待办任务快捷键
|
private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键
|
||||||
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
|
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
|
||||||
private Key toDoHotkey; //待办任务快捷键
|
private Key toDoHotkey = Key.E; //待办任务快捷键
|
||||||
|
|
||||||
private string customIconUrl; //自定义图标url
|
private string customIconUrl; //自定义图标url
|
||||||
private string customIconJsonUrl; //自定义图标json信息url
|
private string customIconJsonUrl; //自定义图标json信息url
|
||||||
@@ -61,9 +62,39 @@ namespace GeekDesk.ViewModel
|
|||||||
private double imgPanelWidth = (double)CommonEnum.IMAGE_PANEL_WIDTH;
|
private double imgPanelWidth = (double)CommonEnum.IMAGE_PANEL_WIDTH;
|
||||||
private double imgPanelHeight = (double)CommonEnum.IMAGE_PANEL_HEIGHT;
|
private double imgPanelHeight = (double)CommonEnum.IMAGE_PANEL_HEIGHT;
|
||||||
|
|
||||||
|
private bool marginHide = false; //贴边隐藏
|
||||||
|
|
||||||
|
private bool appAnimation = false; //主窗口动画效果
|
||||||
|
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
|
||||||
|
public bool AppAnimation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return appAnimation;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
appAnimation = value;
|
||||||
|
OnPropertyChanged("AppAnimation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MarginHide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return marginHide;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
marginHide = value;
|
||||||
|
OnPropertyChanged("MarginHide");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double ImgPanelWidth
|
public double ImgPanelWidth
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -150,6 +181,11 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
//兼容老版本
|
||||||
|
if (toDoHotkey == Key.None)
|
||||||
|
{
|
||||||
|
toDoHotkey = Key.Q;
|
||||||
|
}
|
||||||
return toDoHotkey;
|
return toDoHotkey;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -164,6 +200,10 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (toDoHotkeyModifiers == 0)
|
||||||
|
{
|
||||||
|
toDoHotkeyModifiers = HotkeyModifiers.MOD_CONTROL | HotkeyModifiers.MOD_SHIFT;
|
||||||
|
}
|
||||||
return toDoHotkeyModifiers;
|
return toDoHotkeyModifiers;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -177,6 +217,11 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
//兼容老版本
|
||||||
|
if (toDoHotkeyStr == null)
|
||||||
|
{
|
||||||
|
toDoHotkeyStr = "Ctrl + Shift + Q";
|
||||||
|
}
|
||||||
return toDoHotkeyStr;
|
return toDoHotkeyStr;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -283,6 +328,10 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (hotkeyModifiers == 0)
|
||||||
|
{
|
||||||
|
hotkeyModifiers = HotkeyModifiers.MOD_CONTROL;
|
||||||
|
}
|
||||||
return hotkeyModifiers;
|
return hotkeyModifiers;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
|||||||
Reference in New Issue
Block a user