mlaumcherb/Mlaumcherb.Client.Avalonia/холопы/ErrorHelper.cs
2024-11-06 00:04:12 +05:00

36 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Avalonia.Controls;
using DTLib.Demystifier;
using Mlaumcherb.Client.Avalonia.зримое;
using MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using MsBox.Avalonia.Enums;
using MsBox.Avalonia.Models;
namespace Mlaumcherb.Client.Avalonia.холопы;
public static class ErrorHelper
{
internal static void ShowMessageBox(string context, Exception err)
=> ShowMessageBox(context, err.ToStringDemystified());
internal static async void ShowMessageBox(string context, string err)
{
LauncherApp.Logger.LogError(context, err);
var box = MessageBoxManager.GetMessageBoxCustom(new MessageBoxCustomParams
{
ButtonDefinitions = new List<ButtonDefinition> { new() { Name = "пон" } },
ContentTitle = "ОШИБКА",
ContentMessage = err,
Icon = Icon.Error,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
CanResize = true,
MaxWidth = 1000,
MaxHeight = 1000,
SizeToContent = SizeToContent.WidthAndHeight,
ShowInCenter = true,
Topmost = true
}
);
await box.ShowAsync().ConfigureAwait(false);
}
}