|
|
@ -1,7 +1,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using AsyncKeyedLock;
|
|
|
|
using MaterialDesignThemes.Wpf;
|
|
|
|
using MaterialDesignThemes.Wpf;
|
|
|
|
using Microsoft.Win32;
|
|
|
|
using Microsoft.Win32;
|
|
|
|
using Stylet;
|
|
|
|
using Stylet;
|
|
|
@ -10,7 +10,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Framework;
|
|
|
|
|
|
|
|
|
|
|
|
public class DialogManager(IViewManager viewManager) : IDisposable
|
|
|
|
public class DialogManager(IViewManager viewManager) : IDisposable
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly SemaphoreSlim _dialogLock = new(1, 1);
|
|
|
|
private readonly AsyncNonKeyedLocker _dialogLock = new();
|
|
|
|
|
|
|
|
|
|
|
|
public async ValueTask<T?> ShowDialogAsync<T>(DialogScreen<T> dialogScreen)
|
|
|
|
public async ValueTask<T?> ShowDialogAsync<T>(DialogScreen<T> dialogScreen)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -34,16 +34,11 @@ public class DialogManager(IViewManager viewManager) : IDisposable
|
|
|
|
dialogScreen.Closed += OnScreenClosed;
|
|
|
|
dialogScreen.Closed += OnScreenClosed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await _dialogLock.WaitAsync();
|
|
|
|
using (await _dialogLock.LockAsync())
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DialogHost.Show(view, OnDialogOpened);
|
|
|
|
await DialogHost.Show(view, OnDialogOpened);
|
|
|
|
return dialogScreen.DialogResult;
|
|
|
|
return dialogScreen.DialogResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_dialogLock.Release();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string? PromptSaveFilePath(string filter = "All files|*.*", string defaultFilePath = "")
|
|
|
|
public string? PromptSaveFilePath(string filter = "All files|*.*", string defaultFilePath = "")
|
|
|
|