mlaumcherb/Млаумчерб.Клиент/Ошибки.cs

34 lines
1.2 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.Ben.Demystifier;
using MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using MsBox.Avalonia.Models;
namespace Млаумчерб.Клиент;
public static class Ошибки
{
internal static void ПоказатьСообщение(Exception err)
=> ПоказатьСообщение(err.ToStringDemystified());
internal static async void ПоказатьСообщение(string err)
{
var box = MessageBoxManager.GetMessageBoxCustom(new MessageBoxCustomParams
{
ButtonDefinitions = new List<ButtonDefinition> { new() { Name = "пон" } },
ContentTitle = "ОШИБКА",
ContentMessage = err,
Icon = MsBox.Avalonia.Enums.Icon.Error,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
CanResize = true,
MaxWidth = 1000,
MaxHeight = 1000,
SizeToContent = SizeToContent.WidthAndHeight,
ShowInCenter = true,
Topmost = true
}
);
//TODO: write to log
await box.ShowAsync().ConfigureAwait(false);
}
}