Compare commits

...

4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
0bf21be62a Use reflection to call ShowBalloonTip to avoid JIT compilation errors
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-10-23 17:16:48 +00:00
copilot-swe-agent[bot]
35dc57006e Add try-catch wrapper around ShowBalloonTip to prevent crash on startup
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-10-23 17:08:45 +00:00
copilot-swe-agent[bot]
d397e15a2c Initial plan 2025-10-23 16:55:41 +00:00
copilot-swe-agent[bot]
4bff62f4d8 Fix Desktop file selection by using consistent IsCursorActivated check
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-10-22 01:45:23 +08:00
2 changed files with 26 additions and 4 deletions

View File

@@ -169,7 +169,7 @@ void Shell32::getSelectedFromDesktop(PWCHAR buffer)
&pwba))))
return;
if (HelperMethods::IsCursorActivated(reinterpret_cast<HWND>(LongToHandle(phwnd))))
if (HelperMethods::IsCursorActivated(0))
return;
CComPtr<IServiceProvider> psp;

View File

@@ -23,6 +23,7 @@ using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using Wpf.Ui.Violeta.Win32;
using ToolTipIcon = Wpf.Ui.Violeta.Win32.ToolTipIcon;
@@ -149,9 +150,30 @@ internal partial class TrayIconManager : IDisposable
Action closeEvent = null)
{
var icon = GetInstance()._icon;
icon.ShowBalloonTip(timeout, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info);
icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
try
{
// Use reflection to call ShowBalloonTip to avoid JIT compilation errors
// when the method signature doesn't match the expected one
var showBalloonTipMethod = icon.GetType().GetMethod("ShowBalloonTip",
new[] { typeof(int), typeof(string), typeof(string), typeof(ToolTipIcon) });
if (showBalloonTipMethod != null)
{
showBalloonTipMethod.Invoke(icon, new object[] { timeout, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info });
icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
}
else
{
System.Diagnostics.Debug.WriteLine($"ShowBalloonTip method not found: {title} - {content}");
}
}
catch (Exception ex)
{
// Fallback: If reflection fails, log and continue without showing notification
System.Diagnostics.Debug.WriteLine($"ShowBalloonTip failed: {title} - {content}. Error: {ex.Message}");
}
void OnIconOnBalloonTipClicked(object sender, EventArgs e)
{