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="LProportion" value="0.82" />
<add key="TProportion" value="0.03" />
<add key="DelayTime" value="800" />
<add key="DelayTime" value="1500" />
</ShowSecondsSettings>
<SystemIcons>
<add key="Calculator" value="计算器" />
@@ -61,7 +61,7 @@
</assemblyBinding>
</runtime>
<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="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
<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)
{
MainWindow.RegisterHotKey(false);
} else
}
else
{
if (MainWindow.hotKeyId != -1)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

BIN
Logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

View File

@@ -88,7 +88,7 @@
<DockPanel.Background>
<SolidColorBrush Opacity="0.01"/>
</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 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}}">
<hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130" x:Name="TaskbarContextMenu">

View File

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

View File

@@ -3,7 +3,6 @@ using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook;
using ShowSeconds;
using System;
using System.Drawing;
using System.Threading;
@@ -31,24 +30,16 @@ namespace GeekDesk.MyThread
hook.OnMouseWheelUp += OnMouseWheelUp;
}
if (appConfig.SecondsWindow == true)
{
hook.OnMouseLeftDown += OnMouseLeftDown;
hook.OnMouseLeftUp += OnMouseLeftUp;
}
hook.Start(true, false);
}));
}
private static void OnMouseLeftDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
SecondsWindow.SecondsBakColorFun(sender, e);
}
private static void OnMouseLeftUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
SecondsWindow.SecondsHookSetFuc(sender, e);
}
private static void OnMouseWheelUp(object sender, System.Windows.Forms.MouseEventArgs e)
@@ -105,7 +96,8 @@ namespace GeekDesk.MyThread
dispatcher = null;
}
}
catch (Exception ex) {
catch (Exception ex)
{
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_BAK_PATH);
} catch (Exception ex)
}
catch (Exception ex)
{
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"
Width="160"
WindowStyle="None"
Title="ShowSeconds_Main_8400A17AEEF7C029"
Title=""
AllowsTransparency="True"
Background="Transparent"
ShowInTaskbar="False"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
Loaded="Window_Loaded"
ShowActivated="False"
>
<Grid Margin="20">

View File

@@ -1,14 +1,13 @@
using GeekDesk;
using GeekDesk.MyThread;
using GeekDesk.Util;
using Gma.System.MouseKeyHook;
using ShowSeconds.Common;
using GeekDesk.Util;
using ShowSeconds.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -18,11 +17,14 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using GeekDesk.MyThread;
using GeekDesk;
using System.Collections;
namespace ShowSeconds
{
@@ -32,40 +34,15 @@ namespace ShowSeconds
public partial class SecondsWindow : Window
{
private static Color beforeColor;
private static Color topBeforeColor;
private System.Drawing.Color beforeColor;
private System.Drawing.Color topBeforeColor;
//dark theam
private readonly static System.Windows.Media.SolidColorBrush darkBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(46, 50, 54),
Opacity = 0.8
};
private readonly static System.Windows.Media.SolidColorBrush darkFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(255, 255, 255)
};
private bool expandClock = true; //是否展开时钟
private System.Windows.Forms.Timer timer;
//light theam
private readonly static System.Windows.Media.SolidColorBrush lightBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(236, 244, 251),
Opacity = 1
};
private readonly static System.Windows.Media.SolidColorBrush lightFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(65, 63, 61),
};
private static bool expandClock = true; //是否展开时钟
private static System.Windows.Forms.Timer timer;
private static double lProportion = 0.82;
private static double tProportion = 0.03;
private static int sleepTime = 800;
private static int sleepTime = 1000;
public SecondsWindow()
{
SecondsDataContext dc = new SecondsDataContext
@@ -74,9 +51,16 @@ namespace ShowSeconds
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second)
};
InitializeComponent();
SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 47, 52, 44))
{
Opacity = 0.8
};
try
{
Hashtable settings = (Hashtable)ConfigurationManager.GetSection("ShowSecondsSettings");
lProportion = Convert.ToDouble(settings["LProportion"]);
@@ -87,28 +71,60 @@ namespace ShowSeconds
{
lProportion = 0.82;
tProportion = 0.03;
sleepTime = 800;
sleepTime = 1000;
}
InitializeComponent();
BGBorder.Background = scb;
this.DataContext = dc;
this.Topmost = true;
BGBorder.Visibility = Visibility.Collapsed;
this.Show();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
timer = new System.Windows.Forms.Timer();
timer.Interval = 1000;
timer.Tick += Timer_Tick;
Dispatcher secondsDP = DispatcherBuild.Build();
IKeyboardMouseEvents secondsHook = Hook.GlobalEvents();
secondsDP.Invoke((Action)(() =>
{
secondsHook.MouseDownExt += SecondsBakColorFun;
secondsHook.MouseUpExt += SecondsHookSetFuc;
}));
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;
@@ -116,25 +132,17 @@ namespace ShowSeconds
{
int x = e.X;
int y = e.Y;
//获取实际坐标 windows可能会有缩放
IntPtr hdc = GetDC(IntPtr.Zero);
double scale = ScreenUtil.GetScreenScalingFactor();
x = (int)(x / scale);
y = (int)(y / scale);
double w = 1920;
double h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
if (x > 1843 / w * width
&& x < 1907 / w * width
&& y > 1037 / h * height
&& y < 1074 / h * height)
{
Color c;
System.Drawing.Color c;
int count = sleepTime;
do
{
@@ -156,7 +164,7 @@ namespace ShowSeconds
|| c.B != beforeColor.B)
{
//判断是否展开时钟
Color ct = GetTopBeforeColor();
System.Drawing.Color ct = GetTopBeforeColor();
if (ct.A != topBeforeColor.A
|| ct.R != topBeforeColor.R
|| ct.G != topBeforeColor.G
@@ -169,42 +177,46 @@ namespace ShowSeconds
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)
{
//light
window.BGBorder.Background = lightBG;
window.SecondsText.Foreground = lightFont;
BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
SecondsText.Foreground = Constants.lightFont;
}
else
{
// dark
window.BGBorder.Background = darkBG;
window.SecondsText.Foreground = darkFont;
//BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
BGBorder.Background = Constants.darkBG;
SecondsText.Foreground = Constants.darkFont;
}
SecondsDataContext dc = window.DataContext as SecondsDataContext;
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
int sx = (int)(width * lProportion);
int sMarginBottom = (int)(height * tProportion);
window.Left = sx - window.Width;
window.Top = SystemParameters.WorkArea.Height - window.Height;
window.BGBorder.Visibility = Visibility.Visible;
int sx = (int)(SystemParameters.PrimaryScreenWidth * lProportion);
int sMarginBottom = (int)(SystemParameters.WorkArea.Height * tProportion);
Left = sx - Width;
Top = SystemParameters.WorkArea.Height - Height;
BGBorder.Visibility = Visibility.Visible;
timer.Start();
}
else
{
window.BGBorder.Visibility = Visibility.Collapsed;
BGBorder.Visibility= Visibility.Collapsed;
timer.Stop();
}
}
}
else if ((expandClock && (x < 1574 / w * width
else if (true)
{
if ((expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 598 / h * height
|| y > 1020 / h * height)
@@ -215,102 +227,73 @@ namespace ShowSeconds
|| y > 1020 / h * height)
)
{
window.BGBorder.Visibility = Visibility.Collapsed;
BGBorder.Visibility = Visibility.Collapsed;
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();
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);
}
private static Color GetTopBeforeColor()
private static System.Drawing.Color GetTopBeforeColor()
{
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 h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
double scale = ScreenUtil.GetScreenScalingFactor();
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width * scale), (int)(h2 / h * height * scale));
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width), (int)(h2 / h * height));
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)
{
if (msg == MessageUtil.WM_COPYDATA)
{
MessageUtil.CopyDataStruct cds = (MessageUtil.CopyDataStruct)System.Runtime.InteropServices.Marshal.PtrToStructure(lParam, typeof(MessageUtil.CopyDataStruct));
if ("Shutdown".Equals(cds.msg))
{
Application.Current.Shutdown();
}
}
return hwnd;
}
private static int CalculateLight(Color color)
private static int CalculateLight(System.Drawing.Color color)
{
int[] colorArr = new int[] { color.R, color.G, color.B };
@@ -325,43 +308,5 @@ namespace ShowSeconds
return avg;
}
private static SecondsWindow window = null;
public static void ShowWindow()
{
if (window == null || !window.Activate())
{
window = new SecondsWindow();
}
window.Show();
Keyboard.Focus(window);
}
//#######################################################
/// <summary>
/// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄,
/// 以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图。
/// </summary>
/// <param name="hWnd">设备上下文环境被检索的窗口的句柄如果该值为NULLGetDC则检索整个屏幕的设备上下文环境。</param>
/// <returns>如果成功返回指定窗口客户区的设备上下文环境如果失败返回值为Null。</returns>
[DllImport("user32")]
public static extern IntPtr GetDC(IntPtr hWnd);
/// <summary>
/// 该函数释放设备上下文环境DC供其他应用程序使用。函数的效果与设备上下文环境类型有关。
/// 它只释放公用的和设备上下文环境,对于类或私有的则无效。
/// </summary>
/// <param name="hWnd">指向要释放的设备上下文环境所在的窗口的句柄。</param>
/// <param name="hDC">指向要释放的设备上下文环境的句柄。</param>
/// <returns>如果释放成功则返回值为1如果没有释放成功则返回值为0。</returns>
[DllImport("user32")]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("user32")]
public static extern bool GetCursorPos(out System.Drawing.Point pt);
}
}

View File

@@ -49,5 +49,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]
[assembly: AssemblyVersion("2.5.1.3")]
[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版本更新",
"subTitle": "V2.5.12",
"subTitle": "V2.5.13",
"msgTitle": "本次更新内容如下",
"msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '其它已知问题修复']",
"msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '更改一下Logo', '其它已知问题修复']",
"githubUrl": "https://github.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);
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
gm.ntf = ntf;
} catch
}
catch
{
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();
return null;
}
} else
}
else
{
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();

View File

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

View File

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

View File

@@ -2,6 +2,7 @@
<packages>
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
<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.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="net472" developmentDependency="true" />