mlaumcherb/Млаумчерб.Клиент/Ошибки.cs
2024-09-24 16:18:06 +05:00

35 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 MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using MsBox.Avalonia.Enums;
using MsBox.Avalonia.Models;
namespace Млаумчерб.Клиент;
public static class Ошибки
{
internal static void ПоказатьСообщение(string context, Exception err)
=> ПоказатьСообщение(context, err.ToStringDemystified());
internal static async void ПоказатьСообщение(string context, string err)
{
Приложение.Логгер.LogError(nameof(Ошибки), 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);
}
}