mlaumcherb/Млаумчерб.Клиент/Errors.cs
2024-08-31 23:55:57 +05:00

34 lines
1.1 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 Errors
{
internal static void ShowMessageBox(Exception err)
=> ShowMessageBox(err.ToStringDemystified());
internal static async void ShowMessageBox(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);
}
}