mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-12-26 20:26:00 +08:00
24 lines
714 B
C#
24 lines
714 B
C#
|
using System.Threading.Tasks;
|
||
|
using System.Windows;
|
||
|
using ModernWpf.Controls;
|
||
|
|
||
|
namespace BililiveRecorder.WPF.Controls
|
||
|
{
|
||
|
internal static class ContentDialogExtensions
|
||
|
{
|
||
|
internal static async Task<ContentDialogResult> ShowAndDisableMinimizeToTrayAsync(this ContentDialog contentDialog)
|
||
|
{
|
||
|
var mw = (NewMainWindow)Application.Current.MainWindow;
|
||
|
mw.HideToTrayBlockedByContentDialog = true;
|
||
|
|
||
|
#pragma warning disable RS0030 // Do not used banned APIs
|
||
|
var result = await contentDialog.ShowAsync();
|
||
|
#pragma warning restore RS0030 // Do not used banned APIs
|
||
|
|
||
|
mw.HideToTrayBlockedByContentDialog = false;
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
}
|
||
|
}
|