Skip to content

Commit

Permalink
Ensure the Save Module progress dialog always shows up (fixes #336)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektroKill committed Jul 31, 2024
1 parent a1cec85 commit 49bdc48
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Extensions/dnSpy.AsmEditor/SaveModule/SaveModuleWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,31 @@ You should have received a copy of the GNU General Public License

using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using dnSpy.AsmEditor.Properties;
using dnSpy.Contracts.App;
using dnSpy.Contracts.Controls;

namespace dnSpy.AsmEditor.SaveModule {
class SaveModuleWindow : WindowBase {
private const int minimumWaitMs = 250;
Task? waitTask;

public SaveModuleWindow() => Loaded += SaveMultiModule_Loaded;

void SaveMultiModule_Loaded(object? sender, RoutedEventArgs e) {
var data = (SaveMultiModuleVM)DataContext;
data.OnSavedEvent += SaveMultiModuleVM_OnSavedEvent;
waitTask = Task.Run(() => Task.Delay(minimumWaitMs));
}

void SaveMultiModuleVM_OnSavedEvent(object? sender, EventArgs e) {
var data = (SaveMultiModuleVM)DataContext;
if (!data.HasError)
if (!data.HasError) {
waitTask?.Wait(TimeSpan.FromMilliseconds(minimumWaitMs));
okButton_Click(null, null);
}
}

protected override void OnClosing(CancelEventArgs e) {
Expand Down

0 comments on commit 49bdc48

Please sign in to comment.