7 Commits

Author SHA1 Message Date
BookerLiu
ee47443c34 Merge branch '2.5.13' of https://github.com/BookerLiu/GeekDesk into 2.5.13 2022-09-02 16:52:56 +08:00
BookerLiu
ad2556a216 🐛 2022-09-02 15:35:40 +08:00
Booker
7589736751 Merge branch 'master' into 2.5.13 2022-09-02 11:30:08 +08:00
BookerLiu
de57b8d78d 🎉 2022-09-02 11:05:17 +08:00
BookerLiu
d9b0a4de89 🎉 更改logo 2022-09-02 10:56:21 +08:00
BookerLiu
d5e0dc98db 优化代码 2022-09-01 15:23:44 +08:00
BookerLiu
e82af431b5 🚑 修复可能导致输入法特定场景卡顿的问题 2022-08-30 09:06:27 +08:00
29 changed files with 638 additions and 575 deletions

View File

@@ -10,7 +10,7 @@
<add key="Version" value="1.0.01" /> <add key="Version" value="1.0.01" />
<add key="LProportion" value="0.82" /> <add key="LProportion" value="0.82" />
<add key="TProportion" value="0.03" /> <add key="TProportion" value="0.03" />
<add key="DelayTime" value="800" /> <add key="DelayTime" value="1500" />
</ShowSecondsSettings> </ShowSecondsSettings>
<SystemIcons> <SystemIcons>
<add key="Calculator" value="计算器" /> <add key="Calculator" value="计算器" />
@@ -61,7 +61,7 @@
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<appSettings> <appSettings>
<add key="Version" value="2.5.12" /> <add key="Version" value="2.5.13" />
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" /> <add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" /> <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="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />

View File

@@ -342,7 +342,8 @@ namespace GeekDesk.Control.UserControls.Config
if (true == appConfig.EnableAppHotKey) if (true == appConfig.EnableAppHotKey)
{ {
MainWindow.RegisterHotKey(false); MainWindow.RegisterHotKey(false);
} else }
else
{ {
if (MainWindow.hotKeyId != -1) if (MainWindow.hotKeyId != -1)
{ {

View File

@@ -121,21 +121,16 @@ namespace GeekDesk.Control.UserControls.Config
private void ShowSeconds_Click(object sender, RoutedEventArgs e) private void ShowSeconds_Click(object sender, RoutedEventArgs e)
{ {
//if (MainWindow.appData.AppConfig.SecondsWindow == true) if (MainWindow.appData.AppConfig.SecondsWindow == true)
//{ {
// //StartSecondsWindow(); //StartSecondsWindow();
// //SecondsWindow.ShowWindow(); SecondsWindow.ShowWindow();
// MouseHookThread.Dispose(); }
// MouseHookThread.Hook(); else
//} {
//else SecondsWindow.CloseWindow();
//{ //StopSecondsWindow();
// MouseHookThread.Dispose(); }
// MouseHookThread.Hook();
//}
MouseHookThread.Dispose();
MouseHookThread.Hook();
} }
public static void StopSecondsWindow() public static void StopSecondsWindow()

View File

@@ -170,7 +170,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
lbi.MouseLeave -= Lbi_MouseLeave; lbi.MouseLeave -= Lbi_MouseLeave;
lbi.Background = bac; lbi.Background = bac;
lbi.Foreground = fontColor; lbi.Foreground = fontColor;
} catch { } }
catch { }
} }
@@ -333,6 +334,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
appData.AppConfig.SelectedMenuIcons = null; appData.AppConfig.SelectedMenuIcons = null;
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true; RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码"; MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.INPUT;
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible; MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
} }
else else
@@ -443,7 +445,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
} }
MenuListBox.SelectedIndex = index; MenuListBox.SelectedIndex = index;
} }
} else if (e.Delta > 0) }
else if (e.Delta > 0)
{ {
if (ScrollUtil.IsTopScrollView(scrollViewer)) if (ScrollUtil.IsTopScrollView(scrollViewer))
{ {
@@ -507,7 +510,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible; MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
//单独设置焦点 //单独设置焦点
MainWindow.mainWindow.RightCard.PDDialog.SetFocus(); MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
} else }
else
{ {
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword)) if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{ {
@@ -552,7 +556,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword)) if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{ {
AlterPW1.Visibility = Visibility.Collapsed; AlterPW1.Visibility = Visibility.Collapsed;
} else }
else
{ {
AlterPW1.Visibility = Visibility.Visible; AlterPW1.Visibility = Visibility.Visible;
} }
@@ -585,7 +590,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (info.IsEncrypt) if (info.IsEncrypt)
{ {
mi.Header = "取消加密此列表"; mi.Header = "取消加密此列表";
} else }
else
{ {
mi.Header = "加密此列表"; mi.Header = "加密此列表";
} }

View File

@@ -154,6 +154,7 @@
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/> <StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
<WrapPanel Orientation="Horizontal" <WrapPanel Orientation="Horizontal"
Margin="10"
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.IsContainerVirtualizable="True"
@@ -283,6 +284,7 @@
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling" <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.IsContainerVirtualizable="True"
Margin="10"
> >
<UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}"> <UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">--> <!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->

View File

@@ -175,18 +175,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false) private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
{ {
try try
{ {
Process p = new Process(); using (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; string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg)) if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
@@ -200,7 +192,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath); string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
path = Path.GetFullPath(fullPath); path = Path.GetFullPath(fullPath);
} else }
else
{ {
path = icon.Path; path = icon.Path;
} }
@@ -218,7 +211,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
StartIconApp(icon, type, true); StartIconApp(icon, type, true);
return; return;
} else }
else
{ {
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!"); HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return; return;
@@ -228,7 +222,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
switch (type) switch (type)
{ {
case IconStartType.ADMIN_STARTUP: case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas"; p.StartInfo.Verb = "runas";
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
//p.StartInfo.ErrorDialog = false;
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL) if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{ {
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口 //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
@@ -288,15 +286,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
} }
} }
p.Start(); p.Start();
p.Close();
p.Dispose();
if (useRelativePath) if (useRelativePath)
{ {
//如果使用相对路径启动成功 那么重新设置程序绝对路径 //如果使用相对路径启动成功 那么重新设置程序绝对路径
icon.Path = path; icon.Path = path;
} }
} }
//} }
icon.Count++; icon.Count++;
//隐藏搜索框 //隐藏搜索框
@@ -773,7 +769,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (RunTimeStatus.LOCK_APP_PANEL) if (RunTimeStatus.LOCK_APP_PANEL)
{ {
CardLockCM.Header = "解锁主面板"; CardLockCM.Header = "解锁主面板";
} else }
else
{ {
CardLockCM.Header = "锁定主面板"; CardLockCM.Header = "锁定主面板";
} }
@@ -865,7 +862,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL) if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{ {
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500; RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
} else }
else
{ {
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true; RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;

View File

@@ -39,11 +39,12 @@ namespace GeekDesk.Control.Windows
{ {
InitializeComponent(); InitializeComponent();
this.colorPicker = colorPicker; this.colorPicker = colorPicker;
//try
//{ try
// SetProcessDPIAware(); {
//} SetProcessDPIAware();
//catch (Exception e) { } }
catch (Exception e) { }
ColorPickerWindow_Init(); ColorPickerWindow_Init();
} }
@@ -87,6 +88,7 @@ namespace GeekDesk.Control.Windows
Int32Rect.Empty, Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions() BitmapSizeOptions.FromEmptyOptions()
); );
DesktopBG.Source = bs; DesktopBG.Source = bs;
VisualBrush b = (VisualBrush)PixelBG.Fill; VisualBrush b = (VisualBrush)PixelBG.Fill;
b.Visual = DesktopBG; b.Visual = DesktopBG;
@@ -213,6 +215,7 @@ namespace GeekDesk.Control.Windows
/// <param name="e"></param> /// <param name="e"></param>
private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e) private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{ {
Mouse.OverrideCursor = null;
GlobalColorPickerWindow.ShowOrHide(); GlobalColorPickerWindow.ShowOrHide();
//关闭 //关闭
this.Close(); this.Close();

View File

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

View File

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

@@ -49,10 +49,10 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\GeekDesk\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -61,14 +61,13 @@
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject> <StartupObject>GeekDesk.App</StartupObject>
</StartupObject>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignManifests>false</SignManifests> <SignManifests>false</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Taskbar.ico</ApplicationIcon> <ApplicationIcon>Logo.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetZone>LocalIntranet</TargetZone> <TargetZone>LocalIntranet</TargetZone>
@@ -89,6 +88,9 @@
<Reference Include="HandyControl, Version=3.3.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL"> <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> <HintPath>packages\HandyControl.3.3.0\lib\net472\HandyControl.dll</HintPath>
</Reference> </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>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <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> <HintPath>packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference> </Reference>
@@ -250,11 +252,12 @@
</Compile> </Compile>
<Compile Include="Converts\CountGreZero2BoolConvert.cs" /> <Compile Include="Converts\CountGreZero2BoolConvert.cs" />
<Compile Include="Converts\Count2VisibleConvert.cs" /> <Compile Include="Converts\Count2VisibleConvert.cs" />
<Compile Include="Converts\GetWidthByWWConvert.cs" />
<Compile Include="Converts\SearchTypeConvert.cs" /> <Compile Include="Converts\SearchTypeConvert.cs" />
<Compile Include="Converts\StringAppendConvert.cs" /> <Compile Include="Converts\StringAppendConvert.cs" />
<Compile Include="Converts\DoubleToGridLength.cs" /> <Compile Include="Converts\DoubleToGridLength.cs" />
<Compile Include="Converts\MenuInfoConvert.cs" /> <Compile Include="Converts\MenuInfoConvert.cs" />
<Compile Include="Converts\GetWidthByWWConvert.cs" /> <Compile Include="Converts\SearchResWidth.cs" />
<Compile Include="Converts\SortTypeConvert.cs" /> <Compile Include="Converts\SortTypeConvert.cs" />
<Compile Include="Converts\TodoTaskExecConvert.cs" /> <Compile Include="Converts\TodoTaskExecConvert.cs" />
<Compile Include="Converts\IntToCornerRadius.cs" /> <Compile Include="Converts\IntToCornerRadius.cs" />
@@ -268,10 +271,12 @@
<Compile Include="Converts\HideTypeConvert.cs" /> <Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Interface\IWindowCommon.cs" /> <Compile Include="Interface\IWindowCommon.cs" />
<Compile Include="MyThread\RelativePathThread.cs" /> <Compile Include="MyThread\RelativePathThread.cs" />
<Compile Include="Plugins\ShowSeconds\ViewModel\SecondsDataContext.cs" /> <Compile Include="Plugins\ShowSeconds\Common\Constants.cs" />
<Compile Include="Plugins\ShowSeconds\SecondsWindow.xaml.cs"> <Compile Include="Plugins\ShowSeconds\SecondsWindow.xaml.cs">
<DependentUpon>SecondsWindow.xaml</DependentUpon> <DependentUpon>SecondsWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Plugins\ShowSeconds\ViewModel\SecondsDataContext.cs" />
<Compile Include="Task\ShowSecondTask.cs" />
<Compile Include="Task\ToDoTask.cs" /> <Compile Include="Task\ToDoTask.cs" />
<Compile Include="MyThread\MouseHookThread.cs" /> <Compile Include="MyThread\MouseHookThread.cs" />
<Compile Include="MyThread\DispatcherBuild.cs" /> <Compile Include="MyThread\DispatcherBuild.cs" />
@@ -280,12 +285,15 @@
<Compile Include="Util\BGSettingUtil.cs" /> <Compile Include="Util\BGSettingUtil.cs" />
<Compile Include="Util\BlurGlassUtil.cs" /> <Compile Include="Util\BlurGlassUtil.cs" />
<Compile Include="Util\ColorUtil.cs" /> <Compile Include="Util\ColorUtil.cs" />
<Compile Include="Util\DefaultIcons.cs" />
<Compile Include="Util\DragAdorner.cs" /> <Compile Include="Util\DragAdorner.cs" />
<Compile Include="Util\GlobalHotKey.cs" /> <Compile Include="Util\GlobalHotKey.cs" />
<Compile Include="Util\CommonCode.cs" /> <Compile Include="Util\CommonCode.cs" />
<Compile Include="Util\FileIcon.cs" /> <Compile Include="Util\FileIcon.cs" />
<Compile Include="Util\FileUtil.cs" /> <Compile Include="Util\FileUtil.cs" />
<Compile Include="Util\HideWindowUtil.cs" /> <Compile Include="Util\HideWindowUtil.cs" />
<Compile Include="Util\IconHelper.cs" />
<Compile Include="Util\IconUtil.cs" />
<Compile Include="Util\KeyUtil.cs" /> <Compile Include="Util\KeyUtil.cs" />
<Compile Include="Util\ListBoxDragDropManager.cs" /> <Compile Include="Util\ListBoxDragDropManager.cs" />
<Compile Include="Util\LogUtil.cs" /> <Compile Include="Util\LogUtil.cs" />
@@ -297,6 +305,7 @@
<Compile Include="Util\MessageUtil.cs" /> <Compile Include="Util\MessageUtil.cs" />
<Compile Include="Util\MouseHook.cs" /> <Compile Include="Util\MouseHook.cs" />
<Compile Include="Util\MouseUtil.cs" /> <Compile Include="Util\MouseUtil.cs" />
<Compile Include="Util\NativeMethods.cs" />
<Compile Include="Util\RegisterUtil.cs" /> <Compile Include="Util\RegisterUtil.cs" />
<Compile Include="Util\RelayCommand.cs" /> <Compile Include="Util\RelayCommand.cs" />
<Compile Include="Util\ScreenUtil.cs" /> <Compile Include="Util\ScreenUtil.cs" />
@@ -306,6 +315,7 @@
<Compile Include="Util\StringUtil.cs" /> <Compile Include="Util\StringUtil.cs" />
<Compile Include="Util\SvgToGeometry.cs" /> <Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="Util\UserActivityHook.cs" /> <Compile Include="Util\UserActivityHook.cs" />
<Compile Include="Util\WindowsThumbnailProvider.cs" />
<Compile Include="ViewModel\AppConfig.cs" /> <Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" /> <Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\GradientBGParam.cs" /> <Compile Include="ViewModel\GradientBGParam.cs" />
@@ -534,7 +544,9 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Resource Include="Logo.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions> <ProjectExtensions>
<VisualStudio> <VisualStudio>

BIN
Logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

View File

@@ -88,7 +88,7 @@
<DockPanel.Background> <DockPanel.Background>
<SolidColorBrush Opacity="0.01"/> <SolidColorBrush Opacity="0.01"/>
</DockPanel.Background> </DockPanel.Background>
<Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/> <Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" RenderOptions.BitmapScalingMode="HighQuality" Margin="10,0,0,0" Width="200" Height="30" HorizontalAlignment="Left"/>
</DockPanel> </DockPanel>
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove"> <DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
@@ -146,7 +146,7 @@
/> />
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon" <hc:NotifyIcon Icon="/Logo.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}"> Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
<hc:NotifyIcon.ContextMenu> <hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130" x:Name="TaskbarContextMenu"> <ContextMenu Width="130" x:Name="TaskbarContextMenu">

View File

@@ -181,8 +181,6 @@ namespace GeekDesk
/// <param name="e"></param> /// <param name="e"></param>
void Window_Loaded(object sender, RoutedEventArgs e) void Window_Loaded(object sender, RoutedEventArgs e)
{ {
SecondsWindow.ShowWindow();
BGSettingUtil.BGSetting(); BGSettingUtil.BGSetting();
if (!appData.AppConfig.StartedShowPanel) if (!appData.AppConfig.StartedShowPanel)
{ {
@@ -217,11 +215,17 @@ namespace GeekDesk
} }
//注册鼠标监听事件 //注册鼠标监听事件
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow==true) if (appData.AppConfig.MouseMiddleShow)
{ {
MouseHookThread.Hook(); MouseHookThread.Hook();
} }
//显秒插件
if (appData.AppConfig.SecondsWindow == true)
{
SecondsWindow.ShowWindow();
}
//更新线程开启 检测更新 //更新线程开启 检测更新
UpdateThread.Update(); UpdateThread.Update();
@@ -262,7 +266,8 @@ namespace GeekDesk
{ {
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl"); HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
} }
} else }
else
{ {
} }
} }
@@ -475,7 +480,8 @@ namespace GeekDesk
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX) if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
{ {
mainWindow.RightCard.PDDialog.SetFocus(); mainWindow.RightCard.PDDialog.SetFocus();
} else }
else
{ {
Keyboard.Focus(mainWindow.SearchBox); Keyboard.Focus(mainWindow.SearchBox);
} }
@@ -677,7 +683,7 @@ 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 || appData.AppConfig.SecondsWindow==true) if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow == true)
{ {
MouseHookThread.Dispose(); MouseHookThread.Dispose();
} }
@@ -732,10 +738,12 @@ namespace GeekDesk
if (e.Key == Key.Down || e.Key == Key.Tab) if (e.Key == Key.Down || e.Key == Key.Tab)
{ {
RightCard.SearchListBoxIndexAdd(); RightCard.SearchListBoxIndexAdd();
} else if (e.Key == Key.Up) }
else if (e.Key == Key.Up)
{ {
RightCard.SearchListBoxIndexSub(); RightCard.SearchListBoxIndexSub();
} else if (e.Key == Key.Enter) }
else if (e.Key == Key.Enter)
{ {
RightCard.StartupSelectionItem(); RightCard.StartupSelectionItem();
} }

View File

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

View File

@@ -36,7 +36,8 @@ namespace GeekDesk.MyThread
} }
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH); CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH); CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
} catch (Exception ex) }
catch (Exception ex)
{ {
LogUtil.WriteErrorLog(ex, "init相对路径出错!"); LogUtil.WriteErrorLog(ex, "init相对路径出错!");
} }

View File

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

@@ -8,13 +8,11 @@
Height="90" Height="90"
Width="160" Width="160"
WindowStyle="None" WindowStyle="None"
Title="ShowSeconds_Main_8400A17AEEF7C029" Title=""
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" Background="Transparent" ShowInTaskbar="False"
ShowInTaskbar="False"
Focusable="True" Focusable="True"
Loaded="Window_Loaded" Loaded="Window_Loaded"
ShowActivated="False"
> >
<Grid Margin="20"> <Grid Margin="20">

View File

@@ -1,14 +1,13 @@
using GeekDesk; using GeekDesk.Util;
using GeekDesk.MyThread; using Gma.System.MouseKeyHook;
using ShowSeconds.Common;
using GeekDesk.Util; using GeekDesk.Util;
using ShowSeconds.ViewModel; using ShowSeconds.ViewModel;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -18,11 +17,14 @@ using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop; 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 System.Windows.Threading; using System.Windows.Threading;
using GeekDesk.MyThread;
using GeekDesk;
using System.Collections;
namespace ShowSeconds namespace ShowSeconds
{ {
@@ -32,40 +34,15 @@ namespace ShowSeconds
public partial class SecondsWindow : Window public partial class SecondsWindow : Window
{ {
private static Color beforeColor; private System.Drawing.Color beforeColor;
private static Color topBeforeColor; private System.Drawing.Color topBeforeColor;
//dark theam private bool expandClock = true; //是否展开时钟
private readonly static System.Windows.Media.SolidColorBrush darkBG private System.Windows.Forms.Timer timer;
= 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 lProportion = 0.82;
private static double tProportion = 0.03; private static double tProportion = 0.03;
private static int sleepTime = 800; private static int sleepTime = 1000;
public SecondsWindow() public SecondsWindow()
{ {
SecondsDataContext dc = new SecondsDataContext SecondsDataContext dc = new SecondsDataContext
@@ -74,9 +51,16 @@ namespace ShowSeconds
FormatMS(DateTime.Now.Minute) + ":" + FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second) FormatMS(DateTime.Now.Second)
}; };
InitializeComponent();
SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 47, 52, 44))
{
Opacity = 0.8
};
try try
{ {
Hashtable settings = (Hashtable)ConfigurationManager.GetSection("ShowSecondsSettings"); Hashtable settings = (Hashtable)ConfigurationManager.GetSection("ShowSecondsSettings");
lProportion = Convert.ToDouble(settings["LProportion"]); lProportion = Convert.ToDouble(settings["LProportion"]);
@@ -87,28 +71,60 @@ namespace ShowSeconds
{ {
lProportion = 0.82; lProportion = 0.82;
tProportion = 0.03; tProportion = 0.03;
sleepTime = 800; sleepTime = 1000;
} }
InitializeComponent(); BGBorder.Background = scb;
this.DataContext = dc; this.DataContext = dc;
this.Topmost = true; this.Topmost = true;
BGBorder.Visibility = Visibility.Collapsed; BGBorder.Visibility = Visibility.Collapsed;
this.Show();
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
timer = new System.Windows.Forms.Timer(); timer = new System.Windows.Forms.Timer();
timer.Interval = 1000; timer.Interval = 1000;
timer.Tick += Timer_Tick; timer.Tick += Timer_Tick;
Dispatcher secondsDP = DispatcherBuild.Build();
IKeyboardMouseEvents secondsHook = Hook.GlobalEvents();
secondsDP.Invoke((Action)(() =>
{
secondsHook.MouseDownExt += SecondsBakColorFun;
secondsHook.MouseUpExt += SecondsHookSetFuc;
}));
HideWindowUtil.HideAltTab(this); HideWindowUtil.HideAltTab(this);
} }
public static void SecondsHookSetFuc(object sender, System.Windows.Forms.MouseEventArgs e) private void Timer_Tick(object sender, EventArgs e)
{ {
ThreadPool.QueueUserWorkItem(state => string str = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = str;
}
private static string FormatMS(int ms)
{ {
window.Dispatcher.Invoke(() => if (ms < 10)
{
return "0" + ms;
}
else
{
return ms.ToString();
}
}
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{ {
if (ScreenUtil.IsPrimaryFullScreen()) return; if (ScreenUtil.IsPrimaryFullScreen()) return;
@@ -116,25 +132,17 @@ namespace ShowSeconds
{ {
int x = e.X; int x = e.X;
int y = e.Y; 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 w = 1920;
double h = 1080; double h = 1080;
double width = SystemParameters.PrimaryScreenWidth; double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight; double height = SystemParameters.PrimaryScreenHeight;
if (x > 1843 / w * width if (x > 1843 / w * width
&& x < 1907 / w * width && x < 1907 / w * width
&& y > 1037 / h * height && y > 1037 / h * height
&& y < 1074 / h * height) && y < 1074 / h * height)
{ {
Color c;
System.Drawing.Color c;
int count = sleepTime; int count = sleepTime;
do do
{ {
@@ -156,7 +164,7 @@ namespace ShowSeconds
|| c.B != beforeColor.B) || c.B != beforeColor.B)
{ {
//判断是否展开时钟 //判断是否展开时钟
Color ct = GetTopBeforeColor(); System.Drawing.Color ct = GetTopBeforeColor();
if (ct.A != topBeforeColor.A if (ct.A != topBeforeColor.A
|| ct.R != topBeforeColor.R || ct.R != topBeforeColor.R
|| ct.G != topBeforeColor.G || ct.G != topBeforeColor.G
@@ -169,42 +177,46 @@ namespace ShowSeconds
expandClock = false; expandClock = false;
} }
if (!window.BGBorder.IsVisible) if (!BGBorder.IsVisible)
{ {
Color theamColor = GetColor(1919, 1079);
System.Drawing.Color theamColor = GetColor(1919, 1079);
if (CalculateLight(theamColor) > 255 / 2) if (CalculateLight(theamColor) > 255 / 2)
{ {
//light //light
window.BGBorder.Background = lightBG; BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
window.SecondsText.Foreground = lightFont; SecondsText.Foreground = Constants.lightFont;
} }
else else
{ {
// dark // dark
window.BGBorder.Background = darkBG; //BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
window.SecondsText.Foreground = darkFont; BGBorder.Background = Constants.darkBG;
SecondsText.Foreground = Constants.darkFont;
} }
SecondsDataContext dc = window.DataContext as SecondsDataContext; SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" + dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" + FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second); FormatMS(DateTime.Now.Second);
int sx = (int)(width * lProportion); int sx = (int)(SystemParameters.PrimaryScreenWidth * lProportion);
int sMarginBottom = (int)(height * tProportion); int sMarginBottom = (int)(SystemParameters.WorkArea.Height * tProportion);
window.Left = sx - window.Width; Left = sx - Width;
window.Top = SystemParameters.WorkArea.Height - window.Height; Top = SystemParameters.WorkArea.Height - Height;
window.BGBorder.Visibility = Visibility.Visible; BGBorder.Visibility = Visibility.Visible;
timer.Start(); timer.Start();
} }
else else
{ {
window.BGBorder.Visibility = Visibility.Collapsed; BGBorder.Visibility= Visibility.Collapsed;
timer.Stop(); timer.Stop();
} }
} }
} }
else if ((expandClock && (x < 1574 / w * width else if (true)
{
if ((expandClock && (x < 1574 / w * width
|| x > 1906 / w * width || x > 1906 / w * width
|| y < 598 / h * height || y < 598 / h * height
|| y > 1020 / h * height) || y > 1020 / h * height)
@@ -215,104 +227,75 @@ namespace ShowSeconds
|| y > 1020 / h * height) || y > 1020 / h * height)
) )
{ {
window.BGBorder.Visibility = Visibility.Collapsed; BGBorder.Visibility = Visibility.Collapsed;
timer.Stop(); timer.Stop();
} }
}
})); }));
}); }
}); }
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 SecondsBakColorFun(object sender, System.Windows.Forms.MouseEventArgs e) public static void CloseWindow()
{ {
ThreadPool.QueueUserWorkItem(state => try
{ {
window.Dispatcher.Invoke(() => 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(); beforeColor = GetBottomBeforeColor();
topBeforeColor = GetTopBeforeColor(); topBeforeColor = GetTopBeforeColor();
});
});
}
private void Timer_Tick(object sender, EventArgs e)
{
string str = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
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)
{
return "0" + ms;
}
else
{
return ms.ToString();
} }
} }
private static Color GetBottomBeforeColor() private static System.Drawing.Color GetBottomBeforeColor()
{ {
return GetColor(1760, 985); return GetColor(1760, 985);
} }
private static Color GetTopBeforeColor() private static System.Drawing.Color GetTopBeforeColor()
{ {
return GetColor(1751, 693); return GetColor(1751, 693);
} }
private static Color GetColor(int w2, int h2) private static System.Drawing.Color GetColor(int w2, int h2)
{ {
double w = 1920; double w = 1920;
double h = 1080; double h = 1080;
double width = SystemParameters.PrimaryScreenWidth; double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight; double height = SystemParameters.PrimaryScreenHeight;
double scale = ScreenUtil.GetScreenScalingFactor(); System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width), (int)(h2 / h * height));
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width * scale), (int)(h2 / h * height * scale));
return ScreenUtil.GetColorAt(p); return ScreenUtil.GetColorAt(p);
} }
protected override void OnSourceInitialized(EventArgs e)
{
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) private static int CalculateLight(System.Drawing.Color color)
{ {
if (msg == MessageUtil.WM_COPYDATA) int[] colorArr = new int[] { color.R, color.G, color.B };
{
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 max = 0;
int min = 255; int min = 255;
@@ -325,43 +308,5 @@ namespace ShowSeconds
return avg; 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("1.0.*")]
[assembly: AssemblyVersion("2.5.1.0")] [assembly: AssemblyVersion("2.5.1.3")]
[assembly: AssemblyFileVersion("2.5.1.0")] [assembly: AssemblyFileVersion("2.5.1.3")]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 101 KiB

31
Task/ShowSecondTask.cs Normal file
View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Task
{
internal class ShowSecondTask
{
public static void SHowSecond()
{
System.Timers.Timer timer = new System.Timers.Timer
{
Enabled = true,
Interval = 5000
};
timer.Start();
timer.Elapsed += Timer_Elapsed;
}
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
Process[] pcArr = Process.GetProcessesByName("ShellExperienceHost.exe");
Thread.Sleep(1000);
}
}
}

View File

@@ -1,9 +1,9 @@
{ {
"title": "GeekDesk版本更新", "title": "GeekDesk版本更新",
"subTitle": "V2.5.12", "subTitle": "V2.5.13",
"msgTitle": "本次更新内容如下", "msgTitle": "本次更新内容如下",
"msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '其它已知问题修复']", "msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '更改一下Logo', '其它已知问题修复']",
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases", "githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases", "giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
"version": "2.5.12" "version": "2.5.13"
} }

View File

@@ -69,14 +69,16 @@ namespace GeekDesk.Util
GlobalMsgNotification gm = new GlobalMsgNotification(msg); GlobalMsgNotification gm = new GlobalMsgNotification(msg);
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true); HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
gm.ntf = ntf; gm.ntf = ntf;
} catch }
catch
{ {
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!"); MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown(); Application.Current.Shutdown();
return null; return null;
} }
} else }
else
{ {
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!"); MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown(); Application.Current.Shutdown();

View File

@@ -172,7 +172,8 @@ namespace GeekDesk.Util
.ToString() .ToString()
.Replace('/', Path.DirectorySeparatorChar) .Replace('/', Path.DirectorySeparatorChar)
); );
} catch (Exception ex) }
catch (Exception ex)
{ {
LogUtil.WriteErrorLog(ex, "建立相对路径出错:fromPath:" + fromPath + ",toPath:" + toPath); LogUtil.WriteErrorLog(ex, "建立相对路径出错:fromPath:" + fromPath + ",toPath:" + toPath);
} }

View File

@@ -54,8 +54,8 @@
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings> <windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware> <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings> </windowsSettings>
</application> </application>

View File

@@ -2,6 +2,7 @@
<packages> <packages>
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" /> <package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
<package id="HandyControl" version="3.3.0" targetFramework="net472" /> <package id="HandyControl" version="3.3.0" targetFramework="net472" />
<package id="KeyMouseHook" version="1.0.6" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.Build.Tasks.Git" version="1.0.0" targetFramework="net472" developmentDependency="true" /> <package id="Microsoft.Build.Tasks.Git" version="1.0.0" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" /> <package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="net472" developmentDependency="true" /> <package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="net472" developmentDependency="true" />