From f3f1bf2d756e7255c70c7b6f8aac744a0ecf631e Mon Sep 17 00:00:00 2001 From: Ravi Patel Date: Sun, 27 Oct 2024 12:11:42 +0530 Subject: [PATCH] Now invoking MessageBox in UI thread to prevent any issues. --- AutoUpdater.NET/AutoUpdater.NET.csproj | 484 +++++++++--------- .../build/Autoupdater.NET.Official.nuspec | 12 +- ZipExtractor/FormMain.cs | 20 +- ZipExtractor/ZipExtractor.csproj | 8 +- 4 files changed, 266 insertions(+), 258 deletions(-) diff --git a/AutoUpdater.NET/AutoUpdater.NET.csproj b/AutoUpdater.NET/AutoUpdater.NET.csproj index 4a83c8a..2d680f5 100644 --- a/AutoUpdater.NET/AutoUpdater.NET.csproj +++ b/AutoUpdater.NET/AutoUpdater.NET.csproj @@ -1,245 +1,245 @@ - - {FB9E7E6B-B19F-4F37-A708-2996190CEF13} - library - net462;netcoreapp3.1;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows - true - true - AutoUpdaterDotNET - AutoUpdater.NET - RBSoft - AutoUpdater.NET - Copyright © 2012-2024 RBSoft - 1.9.3.0 - 1.9.3.0 - 1.9.3.0 - 1.9.3.0 - true - AutoUpdater.NET.snk - en - Autoupdater.NET.Official - true - MIT - AutoUpdater.NET - rbsoft - AutoUpdater.NET is a class library that allows .NET developers to easily add auto update functionality to their WinForms or WPF application projects. - https://github.com/ravibpatel/AutoUpdater.NET - autoupdate updater c# vb wpf winforms - https://github.com/ravibpatel/AutoUpdater.NET/releases - build - $(OutDir)\AutoUpdater.NET.xml - latest - - - pdbonly - - - full - - - - - - - - - - - - - - - - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - DownloadUpdateDialog.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - RemindLaterForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - - UpdateForm.cs - - + + {FB9E7E6B-B19F-4F37-A708-2996190CEF13} + library + net462;netcoreapp3.1;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows + true + true + AutoUpdaterDotNET + AutoUpdater.NET + RBSoft + AutoUpdater.NET + Copyright © 2012-2024 RBSoft + 1.9.3.0 + 1.9.3.0 + 1.9.3.0 + 1.9.3.0 + true + AutoUpdater.NET.snk + en + Autoupdater.NET.Official + true + MIT + AutoUpdater.NET + rbsoft + AutoUpdater.NET is a class library that allows .NET developers to easily add auto update functionality to their WinForms or WPF application projects. + https://github.com/ravibpatel/AutoUpdater.NET + autoupdate updater c# vb wpf winforms + https://github.com/ravibpatel/AutoUpdater.NET/releases + build + $(OutDir)\AutoUpdater.NET.xml + latest + + + pdbonly + + + full + + + + + + + + + + + + + + + + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + DownloadUpdateDialog.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + RemindLaterForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + + UpdateForm.cs + + \ No newline at end of file diff --git a/AutoUpdater.NET/build/Autoupdater.NET.Official.nuspec b/AutoUpdater.NET/build/Autoupdater.NET.Official.nuspec index 0928bd7..f71cf5c 100644 --- a/AutoUpdater.NET/build/Autoupdater.NET.Official.nuspec +++ b/AutoUpdater.NET/build/Autoupdater.NET.Official.nuspec @@ -18,22 +18,22 @@ autoupdate updater c# vb wpf winforms - + - + - + - + - + - + diff --git a/ZipExtractor/FormMain.cs b/ZipExtractor/FormMain.cs index 43c538a..bed5bb1 100644 --- a/ZipExtractor/FormMain.cs +++ b/ZipExtractor/FormMain.cs @@ -83,6 +83,7 @@ private void FormMain_Shown(object sender, EventArgs e) _backgroundWorker.DoWork += (_, eventArgs) => { foreach (Process process in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(currentExe))) + { try { if (process.MainModule is { FileName: not null } && process.MainModule.FileName.Equals(currentExe)) @@ -97,10 +98,11 @@ private void FormMain_Shown(object sender, EventArgs e) { Debug.WriteLine(exception.Message); } + } _logBuilder.AppendLine("BackgroundWorker started successfully."); - ControlBox = false; + Invoke(new Action(() => { ControlBox = false; })); // Ensures that the last character on the extraction path // is the directory separator char. @@ -227,11 +229,17 @@ private void FormMain_Shown(object sender, EventArgs e) foreach (Process lockingProcess in lockingProcesses) { - DialogResult dialogResult = MessageBox.Show(this, - string.Format(Resources.FileStillInUseMessage, - lockingProcess.ProcessName, filePath), - Resources.FileStillInUseCaption, - MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); + var dialogResult = DialogResult.None; + + Invoke(new Action(() => + { + dialogResult = MessageBox.Show(this, + string.Format(Resources.FileStillInUseMessage, + lockingProcess.ProcessName, filePath), + Resources.FileStillInUseCaption, + MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); + })); + if (dialogResult == DialogResult.Cancel) { throw; diff --git a/ZipExtractor/ZipExtractor.csproj b/ZipExtractor/ZipExtractor.csproj index 7694269..b27d1ac 100644 --- a/ZipExtractor/ZipExtractor.csproj +++ b/ZipExtractor/ZipExtractor.csproj @@ -9,10 +9,10 @@ RBSoft ZipExtractor Copyright © 2012-2024 RBSoft - 1.5.3.0 - 1.5.3.0 - 1.5.3.0 - 1.5.3.0 + 1.5.4.0 + 1.5.4.0 + 1.5.4.0 + 1.5.4.0 ZipExtractor.ico app.manifest true