优化时钟显示功能

This commit is contained in:
Booker
2024-01-02 19:50:41 +08:00
parent f1b4698878
commit 8fea77c304
5 changed files with 56 additions and 21 deletions

View File

@@ -9,7 +9,7 @@ namespace GeekDesk.Constant
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
// 是否为开发模式
public static bool DEV = false;
public static bool DEV = true;
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";

View File

@@ -274,6 +274,7 @@
<Compile Include="Converts\BGStyleConvert.cs" />
<Compile Include="Converts\UpdateTypeConvert.cs" />
<Compile Include="Converts\ReverseBoolConvert.cs" />
<Compile Include="Converts\Boolean2VisibilityConverter.cs" />
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />

View File

@@ -122,9 +122,23 @@ namespace ShowSeconds
}
}
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
{
IntPtr taskBarWnd = WindowUtil.FindWindow("Shell_TrayWnd", null);
IntPtr tray = WindowUtil.FindWindowEx(taskBarWnd, IntPtr.Zero, "TrayNotifyWnd", null);
//IntPtr trayclock = WindowUtil.FindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null);
IntPtr trayclock = WindowUtil.GetForegroundWindow();
StringBuilder title = new StringBuilder(256);
WindowUtil.GetWindowText(trayclock, title, title.Capacity);//得到窗口的标题
Console.WriteLine(title.ToString());
if (title.Equals("通知中心"))
{
}
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (ScreenUtil.IsPrimaryFullScreen()) return;

View File

@@ -44,29 +44,33 @@ namespace GeekDesk.Util
//取得前台窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
public static extern IntPtr GetForegroundWindow();
//取得桌面窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetWindow(HandleRef hWnd, int nCmd);
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr child, IntPtr parent);
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr window, IntPtr handle);
[DllImport("user32.dll")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
public static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string className, string windowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetWindow(HandleRef hWnd, int nCmd);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
public static extern IntPtr SetParent(IntPtr child, IntPtr parent);
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);
[DllImport("user32.dll")]
public static extern int ReleaseDC(IntPtr window, IntPtr handle);
[DllImport("user32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_STYLE = -16;

View File

@@ -105,10 +105,26 @@ namespace GeekDesk.ViewModel
private bool? secondsWindow; //秒数窗口 默认打开
private bool? enableEveryThing;
private bool? enableEveryThing; //开启everything
private bool? alwaysTopmost;
private bool? alwaysTopmost; //是否置顶
private bool? showIconTitle = true; //是否显示iconTitle
public bool? ShowIconTitle
{
get
{
if (showIconTitle == null) showIconTitle = false;
return showIconTitle;
}
set
{
showIconTitle = value;
OnPropertyChanged("ShowIconTitle");
}
}
public bool? AlwaysTopmost
{