From 25ee3d2043efc82bd3920863c3fac5c15a39ce0b Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sun, 26 Jun 2022 10:56:47 +0200 Subject: [PATCH] [BUG] Fix wrong error message and unwanted drag (#405), version 1.2.9.25 --- Business/Menus.cs | 6 ++++-- DataClasses/RowData.cs | 4 +--- Properties/AssemblyInfo.cs | 4 ++-- Utilities/Log.cs | 6 ++++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Business/Menus.cs b/Business/Menus.cs index 209af0f..b7dba59 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -939,6 +939,7 @@ namespace SystemTrayMenu.Business hitTestInfo.RowIndex > -1 && hitTestInfo.RowIndex < dgv.Rows.Count) { + lastMouseDownRowIndex = -1; RowData rowData = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value; rowData.MouseClick(e, out bool toCloseByClick); waitToOpenMenu.ClickOpensInstantly(dgv, hitTestInfo.RowIndex); @@ -959,8 +960,9 @@ namespace SystemTrayMenu.Business if (hitTestInfo.RowIndex > -1 && dgv.Rows.Count > hitTestInfo.RowIndex) { - RowData trigger = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value; - trigger.DoubleClick(e, out bool toCloseByDoubleClick); + lastMouseDownRowIndex = -1; + RowData rowData = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value; + rowData.DoubleClick(e, out bool toCloseByDoubleClick); InvalidateRowIfIndexInRange(dgv, hitTestInfo.RowIndex); if (toCloseByDoubleClick) { diff --git a/DataClasses/RowData.cs b/DataClasses/RowData.cs index 16a9b20..b4de9ec 100644 --- a/DataClasses/RowData.cs +++ b/DataClasses/RowData.cs @@ -242,7 +242,6 @@ namespace SystemTrayMenu.DataClasses internal void MouseClick(MouseEventArgs e, out bool toCloseByDoubleClick) { IsClicking = false; - toCloseByDoubleClick = false; if (Properties.Settings.Default.OpenItemWithOneClick) { @@ -263,7 +262,6 @@ namespace SystemTrayMenu.DataClasses internal void DoubleClick(MouseEventArgs e, out bool toCloseByDoubleClick) { IsClicking = false; - toCloseByDoubleClick = false; if (!Properties.Settings.Default.OpenItemWithOneClick) { @@ -288,7 +286,7 @@ namespace SystemTrayMenu.DataClasses { ProcessStarted = true; string workingDirectory = System.IO.Path.GetDirectoryName(ResolvedPath); - Log.ProcessStart(Path, string.Empty, false, workingDirectory, true); + Log.ProcessStart(Path, string.Empty, false, workingDirectory, true, ResolvedPath); if (!Properties.Settings.Default.StaysOpenWhenItemClicked) { toCloseByOpenItem = true; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 9f44bcd..03d66a5 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.9.24")] -[assembly: AssemblyFileVersion("1.2.9.24")] +[assembly: AssemblyVersion("1.2.9.25")] +[assembly: AssemblyFileVersion("1.2.9.25")] diff --git a/Utilities/Log.cs b/Utilities/Log.cs index c199329..ada3aa5 100644 --- a/Utilities/Log.cs +++ b/Utilities/Log.cs @@ -149,7 +149,8 @@ namespace SystemTrayMenu.Utilities string arguments = "", bool doubleQuoteArg = false, string workingDirectory = "", - bool createNoWindow = false) + bool createNoWindow = false, + string resolvedPath = "") { if (doubleQuoteArg && !string.IsNullOrEmpty(arguments)) { @@ -175,7 +176,8 @@ namespace SystemTrayMenu.Utilities { Warn($"fileName:'{fileName}' arguments:'{arguments}'", ex); - if (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 1223) + if ((ex.NativeErrorCode == 2 || ex.NativeErrorCode == 1223) && + (string.IsNullOrEmpty(resolvedPath) || !File.Exists(resolvedPath))) { new Thread(ShowProblemWithShortcut).Start(); static void ShowProblemWithShortcut()